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

/* ── Light Theme (default) ───────────────────────────────────────────────── */
html {
  --bg:          #f4f6fb;
  --surface:     #ffffff;
  --surface2:    #f0f2f8;
  --border:      rgba(0,0,0,0.08);
  --primary:     #3b7ef8;
  --primary-dim: #dbeafe;
  --accent:      #7c3aed;
  --positive:    #16a34a;
  --negative:    #dc2626;
  --warning:     #d97706;
  --text:        #111827;
  --muted:       #6b7280;
  --sidebar-w:   240px;
  --radius:      12px;
  --shadow:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
}

/* ── Dark Theme (JS sets inline vars; this is a fallback) ────────────────── */
html.dark {
  --bg:          #0d0f14;
  --surface:     #151820;
  --surface2:    #1c2030;
  --border:      rgba(255,255,255,0.07);
  --primary:     #4f8ef7;
  --primary-dim: #1e3a6e;
  --accent:      #a78bfa;
  --positive:    #22c55e;
  --negative:    #ef4444;
  --warning:     #f59e0b;
  --text:        #f1f5f9;
  --muted:       #64748b;
  --shadow:      0 1px 3px rgba(0,0,0,0.4);
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  transition: background 0.25s, color 0.25s;
}

a { color: inherit; text-decoration: none; }

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
}
.logo-mark {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff;
  flex-shrink: 0;
}
.logo-text { font-weight: 700; font-size: 15px; }
.logo-badge {
  font-size: 10px; font-weight: 600;
  background: var(--primary-dim);
  color: var(--primary);
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: auto;
}

.sidebar-nav {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  transition: all 0.15s;
}
.sidebar-nav li a:hover,
.sidebar-nav li.active a {
  background: var(--surface2);
  color: var(--text);
}
.sidebar-nav li.active a { color: var(--primary); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 16px 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-chip { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.admin-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.admin-name  { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-role  { font-size: 11px; color: var(--muted); }
.logout-btn  { color: var(--muted); font-size: 18px; transition: color 0.15s; flex-shrink: 0; }
.logout-btn:hover { color: var(--negative); }

/* ── Theme Toggle Button ─────────────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
  flex-shrink: 0;
  color: var(--muted);
  line-height: 1;
}
.theme-toggle:hover { background: var(--primary-dim); color: var(--primary); border-color: var(--primary); }

/* ── Overlay (mobile) ─────────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── Hamburger Button ─────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  transition: background 0.15s;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.25s;
}
.hamburger:hover { background: var(--surface2); }

/* ── Main Layout ──────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: background 0.25s;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
  transition: background 0.25s, border-color 0.25s;
  gap: 12px;
}
.topbar h1 { font-size: 18px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 6px var(--positive);
  flex-shrink: 0;
}
.page-content { padding: 28px; }

/* ── Cards & Grid ─────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: background 0.25s, border-color 0.25s;
}
.stat-card .stat-label { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; margin: 6px 0 2px; }
.stat-card .stat-sub   { font-size: 12px; color: var(--muted); }
.stat-card.primary  .stat-value { color: var(--primary); }
.stat-card.accent   .stat-value { color: var(--accent); }
.stat-card.positive .stat-value { color: var(--positive); }
.stat-card.warning  .stat-value { color: var(--warning); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: background 0.25s, border-color 0.25s;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body  { padding: 20px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface2);
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-premium  { background: rgba(124,58,237,0.12); color: var(--accent); }
.badge-free     { background: rgba(107,114,128,0.12); color: var(--muted); }
.badge-positive { background: rgba(22,163,74,0.12);  color: var(--positive); }
.badge-negative { background: rgba(220,38,38,0.12);  color: var(--negative); }
.badge-cache    { background: rgba(59,126,248,0.12); color: var(--primary); }

html.dark .badge-premium  { background: rgba(167,139,250,0.15); }
html.dark .badge-free     { background: rgba(100,116,139,0.15); }
html.dark .badge-positive { background: rgba(34,197,94,0.12);  }
html.dark .badge-negative { background: rgba(239,68,68,0.12);  }
html.dark .badge-cache    { background: rgba(79,142,247,0.12); }

/* ── Forms & Inputs ───────────────────────────────────────────────────────── */
.search-bar { display: flex; gap: 10px; align-items: center; }
.form-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.25s;
}
.form-input:focus { border-color: var(--primary); }
.form-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: background 0.25s;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  font-family: inherit;
}
.btn:hover { opacity: 0.85; }
.btn-primary  { background: var(--primary);  color: #fff; }
.btn-accent   { background: var(--accent);   color: #fff; }
.btn-danger   { background: var(--negative); color: #fff; }
.btn-ghost    { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-sm       { padding: 5px 10px; font-size: 12px; }

/* ── Login Page ───────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
html.dark .login-wrap {
  background: radial-gradient(ellipse at 60% 40%, rgba(79,142,247,0.08) 0%, transparent 60%), var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
html.dark .login-card { box-shadow: 0 4px 24px rgba(0,0,0,0.4); }

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-circle {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: #fff;
  margin: 0 auto 12px;
}
.login-logo h2 { font-size: 22px; font-weight: 700; }
.login-logo p  { color: var(--muted); font-size: 13px; margin-top: 4px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group .form-input { width: 100%; }

.login-btn {
  width: 100%;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.15s;
  font-family: inherit;
}
.login-btn:hover { opacity: 0.9; }

/* Login sayfası tema toggle */
.login-theme-toggle {
  position: fixed;
  top: 20px; right: 20px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  transition: all 0.15s;
  z-index: 999;
}
.login-theme-toggle:hover { background: var(--surface2); }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-error   { background: rgba(220,38,38,0.08);  color: var(--negative); border: 1px solid rgba(220,38,38,0.2); }
.alert-success { background: rgba(22,163,74,0.08);  color: var(--positive); border: 1px solid rgba(22,163,74,0.2); }

html.dark .alert-error   { background: rgba(239,68,68,0.1); }
html.dark .alert-success { background: rgba(34,197,94,0.1); }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.pagination a, .pagination span {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
}
.pagination a { background: var(--surface2); }
.pagination a:hover { background: var(--primary-dim); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; }
.pagination .total { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ── Chart Container ──────────────────────────────────────────────────────── */
.chart-container { position: relative; height: 200px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  }

  .main { margin-left: 0; }

  .hamburger { display: flex; }

  .topbar { padding: 12px 16px; }
  .page-content { padding: 16px; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card .stat-value { font-size: 22px; }

  /* Topbar-right'taki bazı metinleri gizle */
  .topbar-right span { display: none; }
  .topbar-right .status-dot { display: block; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .login-card { margin: 16px; padding: 28px 24px; }
}
