:root {
    /* --- Profesyonel Renk Paleti (Slate & Blue) --- */
    
    /* Arkaplanlar */
    --bg-main: #0f172a;      /* Ana Arkaplan (Slate 900) */
    --bg-secondary: #1e293b; /* Kart/Panel Arkaplanı (Slate 800) */
    --bg-tertiary: #334155;  /* Input/Hover Arkaplanı (Slate 700) */
    
    /* Metin Renkleri */
    --text-primary: #f8fafc; /* Ana Metin (Slate 50) */
    --text-secondary: #94a3b8; /* İkincil Metin (Slate 400) */
    --text-muted: #64748b;     /* Soluk Metin (Slate 500) */
    
    /* Vurgu (Accent) Renkleri */
    --accent-color: #3b82f6; /* Ana Mavi (Blue 500) */
    --accent-hover: #2563eb; /* Hover Mavisi (Blue 600) */
    --accent-light: rgba(59, 130, 246, 0.1); /* Hafif Mavi Arkaplan */
    
    /* Durum Renkleri */
    --success: #10b981;      /* Başarılı (Emerald 500) */
    --danger: #ef4444;       /* Hata (Red 500) */
    --warning: #f59e0b;      /* Uyarı (Amber 500) */
    
    /* Yapısal */
    --border-color: #334155; /* Kenarlıklar */
    --radius-md: 8px;        /* Köşe Yuvarlama */
    --radius-sm: 4px;
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
}

/* --- Temel Ayarlar --- */
* { box-sizing: border-box; outline: none; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }

/* --- Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.grid {
    display: grid;
    gap: 1.5rem;
}

/* --- Bileşenler: Kartlar --- */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

/* --- Bileşenler: Butonlar --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    background: var(--accent-color);
    color: white;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}
.btn:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* --- Form Elemanları --- */
input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-light);
}

/* --- Durum Göstergeleri --- */
.status-online { color: var(--success); font-weight: 600; display: inline-flex; align-items: center; gap: 0.4rem; }
.status-online::before { content: ''; width: 8px; height: 8px; background: currentColor; border-radius: 50%; box-shadow: 0 0 8px currentColor; }

.status-offline { color: var(--text-secondary); font-weight: 500; display: inline-flex; align-items: center; gap: 0.4rem; }
.status-offline::before { content: ''; width: 8px; height: 8px; background: currentColor; border-radius: 50%; }

/* --- Yardımcı Sınıflar --- */
.flash-message { padding: 1rem; border-radius: var(--radius-md); margin-bottom: 1.5rem; border-left: 4px solid; }
.flash-success { background: rgba(16, 185, 129, 0.1); border-color: var(--success); color: var(--success); }
.status-offline.flash-message { background: rgba(239, 68, 68, 0.1); border-color: var(--danger); color: var(--danger); }

.info-row {
    display: flex; justify-content: space-between; padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color); font-size: 0.9rem;
}
.info-row:last-child { border-bottom: none; }
.info-row span:first-child { color: var(--text-secondary); }

/* --- Loading Screen (Remote) --- */
.loading {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--bg-main); z-index: 50; color: var(--text-primary);
}
.lds-ring { display: inline-block; position: relative; width: 80px; height: 80px; margin-bottom: 20px; }
.lds-ring div {
    box-sizing: border-box; display: block; position: absolute;
    width: 64px; height: 64px; margin: 8px;
    border: 6px solid var(--accent-color); border-radius: 50%;
    animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    border-color: var(--accent-color) transparent transparent transparent;
}
.lds-ring div:nth-child(1) { animation-delay: -0.45s; }
.lds-ring div:nth-child(2) { animation-delay: -0.3s; }
.lds-ring div:nth-child(3) { animation-delay: -0.15s; }
@keyframes lds-ring { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- Editor --- */
.editor-container {
    background: #0d1117; color: #e6edf3;
    font-family: 'Fira Code', monospace;
    border: 1px solid var(--border-color);
}

iframe#esp32-frame { width: 100%; height: 100%; border: none; background: white; }