/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0f1117;
  --surface:    #1a1d27;
  --surface2:   #232638;
  --border:     #2e3147;
  --text:       #e2e4f0;
  --text-muted: #7a7f9a;
  --accent:     #e8476a;
  --accent2:    #5b6af0;
  --green:      #34d399;
  --yellow:     #fbbf24;
  --red:        #f87171;
  --sidebar-w:  240px;
  --topbar-h:   56px;
  --radius:     8px;
  --font:       'Segoe UI', system-ui, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
}
.brand-icon { font-size: 22px; }

.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-group { margin-bottom: 8px; }

.nav-group-label {
  display: block;
  padding: 8px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  font-size: 13.5px;
}
.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}
.nav-item.active {
  background: var(--surface2);
  color: var(--text);
  border-left-color: var(--accent);
}
.nav-icon { font-size: 15px; min-width: 18px; text-align: center; }

/* ── Main Wrap ── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.topbar-search input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 7px 14px;
  font-size: 13px;
  width: 280px;
  outline: none;
  transition: border-color 0.2s;
}
.topbar-search input:focus { border-color: var(--accent2); }
.topbar-search input::placeholder { color: var(--text-muted); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-date { color: var(--text-muted); font-size: 12px; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}

.user-name { font-size: 13px; font-weight: 600; }

.btn-logout {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 18px;
  padding: 4px;
  transition: color 0.15s;
}
.btn-logout:hover { color: var(--red); }

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: 28px 32px;
}

.page-header {
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

/* ── KPI Kartları ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.kpi-label { font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-muted); }
.kpi-value { font-size: 28px; font-weight: 700; margin: 8px 0 4px; }
.kpi-sub   { font-size: 12px; color: var(--text-muted); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-admin    { background: #3b1f2b; color: var(--accent); }
.badge-sef      { background: #1e2a3b; color: var(--accent2); }
.badge-operator { background: #1e2e26; color: var(--green); }
.badge-success  { background: #1e2e26; color: var(--green); }
.badge-warning  { background: #2e2618; color: var(--yellow); }
.badge-danger   { background: #2e1e1e; color: var(--red); }
.badge-info     { background: #1e2a3b; color: var(--accent2); }

/* ── Card / Panel ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

/* ── Tablo ── */
.table-wrap { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--surface2); }
.data-table .muted { color: var(--text-muted); }

/* ── Formlar ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.form-control:focus { border-color: var(--accent2); }
.form-control::placeholder { color: var(--text-muted); }

/* ── Butonlar ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s, background 0.15s;
}
.btn:hover { opacity: 0.88; }
.btn-primary   { background: var(--accent);  color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-success   { background: #059669; color: #fff; }
.btn-danger    { background: #dc2626; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Alert ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  border-left: 4px solid;
}
.alert-success { background: #1e2e26; color: var(--green); border-color: var(--green); }
.alert-danger  { background: #2e1e1e; color: var(--red);   border-color: var(--red); }
.alert-warning { background: #2e2618; color: var(--yellow); border-color: var(--yellow); }
.alert-info    { background: #1e2a3b; color: var(--accent2); border-color: var(--accent2); }

/* ── Login Sayfası ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
  width: 360px;
}
.login-logo {
  text-align: center;
  font-size: 36px;
  margin-bottom: 8px;
}
.login-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.login-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 28px;
}

/* ── Setup Sayfası ── */
.setup-page { max-width: 700px; margin: 40px auto; }
.setup-step { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.setup-step .ok  { color: var(--green); font-weight: 700; }
.setup-step .err { color: var(--red);   font-weight: 700; }

/* ── Tema Değiştirme Butonu (topbar) ── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 9px;
  transition: background 0.15s, border-color 0.15s;
}
.theme-toggle:hover { background: var(--surface2); border-color: var(--accent2); }

/* ── Açık Tema (light) ──
   :root (dark) ile aynı özgüllükte; kaynak sırasında SONRA geldiği için
   data-theme="light" varken değişkenleri ezer. accent (vurgu) korunur. */
[data-theme="light"] {
  --bg:         #f3f4f7;
  --surface:    #ffffff;
  --surface2:   #eceef3;
  --border:     #d9dce4;
  --text:       #1b1e2b;
  --text-muted: #5c6373;
  --accent2:    #4f46e5;
  --green:      #047857;
  --yellow:     #b45309;
  --red:        #dc2626;
}

/* Kartlara açık temada hafif gölge (kenarlık tek başına yetersiz) */
[data-theme="light"] .card,
[data-theme="light"] .kpi-card { box-shadow: 0 1px 3px rgba(16, 24, 40, 0.07); }

/* Rozet arka planları açık tema için açık tonlar */
[data-theme="light"] .badge-admin    { background: #fde8ee; color: #be123c; }
[data-theme="light"] .badge-sef      { background: #e0e7ff; color: #4338ca; }
[data-theme="light"] .badge-operator { background: #dcfce7; color: #15803d; }
[data-theme="light"] .badge-success  { background: #dcfce7; color: #15803d; }
[data-theme="light"] .badge-warning  { background: #fef3c7; color: #b45309; }
[data-theme="light"] .badge-danger   { background: #fee2e2; color: #b91c1c; }
[data-theme="light"] .badge-info     { background: #e0e7ff; color: #4338ca; }

/* Alert arka planları açık tema */
[data-theme="light"] .alert-success { background: #ecfdf5; color: #047857; border-color: #047857; }
[data-theme="light"] .alert-danger  { background: #fef2f2; color: #b91c1c; border-color: #dc2626; }
[data-theme="light"] .alert-warning { background: #fffbeb; color: #b45309; border-color: #f59e0b; }
[data-theme="light"] .alert-info    { background: #eef2ff; color: #4338ca; border-color: #6366f1; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrap {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: block;
  }
  .topbar-search { display: none; }
}
