/* ============================================================
   Admin Dashboard — Custom Styles
   Aesthetic: Refined Dark-Sidebar / Clean Professional
   ============================================================ */

   @import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

   /* ── Variables ─────────────────────────────────────────────── */
   :root {
     --sidebar-w: 260px;
     --topbar-h: 64px;
   
     --bg:        #f5f6fa;
     --surface:   #ffffff;
     --surface-2: #f0f1f6;
   
     --sidebar-bg:      #0f1117;
     --sidebar-text:    #8b92a5;
     --sidebar-active:  #ffffff;
     --sidebar-accent:  #4f6ef7;
     --sidebar-hover-bg: rgba(255,255,255,0.06);
     --sidebar-active-bg: rgba(79,110,247,0.18);
   
     --topbar-bg:    #ffffff;
     --topbar-border: #e8eaf0;
   
     --text-primary:   #1a1d2e;
     --text-secondary: #6b7280;
     --text-muted:     #9ca3af;
   
     --accent:       #4f6ef7;
     --accent-light: #eef1fe;
     --accent-hover: #3b58e8;
   
     --success:      #22c55e;
     --success-light:#dcfce7;
     --warning:      #f59e0b;
     --warning-light:#fef3c7;
     --danger:       #ef4444;
     --danger-light: #fee2e2;
     --info:         #06b6d4;
     --info-light:   #cffafe;
   
     --border:       #e8eaf0;
     --border-focus: #4f6ef7;
   
     --radius-sm: 6px;
     --radius:    10px;
     --radius-lg: 16px;
     --radius-xl: 24px;
   
     --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
     --shadow:    0 4px 16px rgba(0,0,0,.08);
     --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
   
     --transition: 0.2s ease;
   }
   
   /* ── Reset / Base ───────────────────────────────────────────── */
   *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
   
   html { font-size: 16px; scroll-behavior: smooth; }
   
   body {
     font-family: 'DM Sans', sans-serif;
     font-size: 0.9rem;
     background: var(--bg);
     color: var(--text-primary);
     line-height: 1.6;
     -webkit-font-smoothing: antialiased;
   }
   
   h1, h2, h3, h4, h5, h6 {
     font-family: 'Syne', sans-serif;
     font-weight: 700;
     line-height: 1.2;
     color: var(--text-primary);
   }
   
   a { text-decoration: none; color: inherit; }
   
   /* ── Layout Shell ───────────────────────────────────────────── */
   .admin-shell {
     display: flex;
     min-height: 100vh;
   }
   
   /* ── Sidebar ────────────────────────────────────────────────── */
   #sidebar {
     width: var(--sidebar-w);
     min-height: 100vh;
     background: var(--sidebar-bg);
     position: fixed;
     top: 0; left: 0;
     display: flex;
     flex-direction: column;
     z-index: 1000;
     transition: transform var(--transition);
     overflow-y: auto;
     overflow-x: hidden;
   }
   
   .sidebar-brand {
     display: flex;
     align-items: center;
     gap: 12px;
     padding: 20px 24px 16px;
     border-bottom: 1px solid rgba(255,255,255,0.06);
   }
   
   .sidebar-brand-icon {
     width: 36px; height: 36px;
     background: var(--sidebar-accent);
     border-radius: var(--radius-sm);
     display: flex; align-items: center; justify-content: center;
     font-size: 18px;
     flex-shrink: 0;
     box-shadow: 0 0 16px rgba(79,110,247,0.4);
   }
   
   .sidebar-brand-name {
     font-family: 'Syne', sans-serif;
     font-weight: 800;
     font-size: 1rem;
     color: #ffffff;
     letter-spacing: -0.01em;
   }
   
   .sidebar-brand-sub {
     font-size: 0.7rem;
     color: var(--sidebar-text);
     font-weight: 400;
     letter-spacing: 0.04em;
   }
   
   .sidebar-section-label {
     font-size: 0.65rem;
     font-weight: 600;
     letter-spacing: 0.1em;
     text-transform: uppercase;
     color: rgba(139,146,165,0.5);
     padding: 20px 24px 8px;
   }
   
   .sidebar-nav {
     list-style: none;
     padding: 8px 12px;
     flex: 1;
   }
   
   .sidebar-nav .nav-item { margin-bottom: 2px; }
   
   .sidebar-nav .nav-link {
     display: flex;
     align-items: center;
     gap: 12px;
     padding: 10px 14px;
     border-radius: var(--radius-sm);
     color: var(--sidebar-text);
     font-size: 0.875rem;
     font-weight: 500;
     transition: all var(--transition);
     position: relative;
     white-space: nowrap;
   }
   
   .sidebar-nav .nav-link i {
     font-size: 1.05rem;
     width: 20px;
     text-align: center;
     flex-shrink: 0;
     transition: color var(--transition);
   }
   
   .sidebar-nav .nav-link:hover {
     background: var(--sidebar-hover-bg);
     color: #ffffff;
   }
   
   .sidebar-nav .nav-link.active {
     background: var(--sidebar-active-bg);
     color: var(--sidebar-active);
   }
   
   .sidebar-nav .nav-link.active i {
     color: var(--sidebar-accent);
   }
   
   .sidebar-nav .nav-link.active::before {
     content: '';
     position: absolute;
     left: 0; top: 6px; bottom: 6px;
     width: 3px;
     background: var(--sidebar-accent);
     border-radius: 0 3px 3px 0;
   }
   
   .sidebar-footer {
     padding: 16px 12px;
     border-top: 1px solid rgba(255,255,255,0.06);
   }
   
   .sidebar-footer .nav-link {
     display: flex;
     align-items: center;
     gap: 12px;
     padding: 10px 14px;
     border-radius: var(--radius-sm);
     color: var(--sidebar-text);
     font-size: 0.875rem;
     font-weight: 500;
     transition: all var(--transition);
   }
   
   .sidebar-footer .nav-link:hover {
     background: rgba(239,68,68,0.12);
     color: #fc8181;
   }
   
   /* ── Top Bar ────────────────────────────────────────────────── */
   #topbar {
     position: fixed;
     top: 0;
     left: var(--sidebar-w);
     right: 0;
     height: var(--topbar-h);
     background: var(--topbar-bg);
     border-bottom: 1px solid var(--topbar-border);
     display: flex;
     align-items: center;
     justify-content: space-between;
     padding: 0 28px;
     z-index: 900;
     gap: 16px;
   }
   
   .topbar-left { display: flex; align-items: center; gap: 12px; }
   
   .topbar-page-title {
     font-family: 'Syne', sans-serif;
     font-weight: 700;
     font-size: 1rem;
     color: var(--text-primary);
   }
   
   .topbar-right {
     display: flex;
     align-items: center;
     gap: 8px;
   }
   
   .topbar-avatar {
     width: 36px; height: 36px;
     border-radius: 50%;
     background: var(--accent);
     color: #fff;
     display: flex;
     align-items: center;
     justify-content: center;
     font-weight: 700;
     font-size: 0.85rem;
     cursor: pointer;
   }
   
   .topbar-btn {
     width: 36px; height: 36px;
     border-radius: var(--radius-sm);
     border: 1px solid var(--border);
     background: var(--surface);
     display: flex;
     align-items: center;
     justify-content: center;
     color: var(--text-secondary);
     cursor: pointer;
     font-size: 1rem;
     transition: all var(--transition);
   }
   
   .topbar-btn:hover {
     background: var(--surface-2);
     color: var(--text-primary);
     border-color: #d0d4e0;
   }
   
   /* ── Main Content ───────────────────────────────────────────── */
   #main-content {
     margin-left: var(--sidebar-w);
     padding-top: var(--topbar-h);
     min-height: 100vh;
     flex: 1;
   }
   
   .page-content {
     padding: 28px;
   }
   
   /* ── Page Header ────────────────────────────────────────────── */
   .page-header {
     display: flex;
     align-items: flex-start;
     justify-content: space-between;
     margin-bottom: 24px;
     gap: 16px;
     flex-wrap: wrap;
   }
   
   .page-header h1 {
     font-size: 1.6rem;
     font-weight: 800;
     color: var(--text-primary);
     margin: 0;
   }
   
   .page-header p {
     color: var(--text-secondary);
     margin: 4px 0 0;
     font-size: 0.875rem;
   }
   
   /* ── Cards ──────────────────────────────────────────────────── */
   .card {
     background: var(--surface);
     border: 1px solid var(--border);
     border-radius: var(--radius-lg);
     box-shadow: var(--shadow-sm);
     overflow: hidden;
   }
   
   .card-header {
     background: transparent;
     border-bottom: 1px solid var(--border);
     padding: 18px 20px;
     display: flex;
     align-items: center;
     justify-content: space-between;
     gap: 12px;
   }
   
   .card-header-title {
     font-family: 'Syne', sans-serif;
     font-weight: 700;
     font-size: 0.95rem;
     color: var(--text-primary);
   }
   
   .card-body { padding: 20px; }
   
   /* ── Stat Cards ─────────────────────────────────────────────── */
   .stat-card {
     background: var(--surface);
     border: 1px solid var(--border);
     border-radius: var(--radius-lg);
     padding: 22px;
     display: flex;
     align-items: center;
     gap: 18px;
     box-shadow: var(--shadow-sm);
     transition: box-shadow var(--transition), transform var(--transition);
     position: relative;
     overflow: hidden;
   }
   
   .stat-card::after {
     content: '';
     position: absolute;
     top: 0; right: 0;
     width: 80px; height: 80px;
     border-radius: 50%;
     opacity: 0.06;
     transform: translate(20px, -20px);
   }
   
   .stat-card:hover {
     box-shadow: var(--shadow);
     transform: translateY(-2px);
   }
   
   .stat-card-icon {
     width: 52px; height: 52px;
     border-radius: var(--radius);
     display: flex; align-items: center; justify-content: center;
     font-size: 1.4rem;
     flex-shrink: 0;
   }
   
   .stat-card-value {
     font-family: 'Syne', sans-serif;
     font-size: 1.9rem;
     font-weight: 800;
     line-height: 1;
     margin-bottom: 4px;
   }
   
   .stat-card-label {
     font-size: 0.8rem;
     color: var(--text-secondary);
     font-weight: 500;
   }
   
   .stat-card-badge {
     margin-left: auto;
     font-size: 0.72rem;
     font-weight: 600;
     padding: 3px 8px;
     border-radius: 20px;
     align-self: flex-start;
   }
   
   /* Colour variants */
   .stat-blue  { --sc: var(--accent); --scl: var(--accent-light); }
   .stat-green { --sc: var(--success); --scl: var(--success-light); }
   .stat-yellow{ --sc: var(--warning); --scl: var(--warning-light); }
   .stat-red   { --sc: var(--danger); --scl: var(--danger-light); }
   
   .stat-card.stat-blue::after,
   .stat-card.stat-green::after,
   .stat-card.stat-yellow::after,
   .stat-card.stat-red::after  { background: var(--sc); opacity: 0.08; }
   
   .stat-card .stat-card-icon { background: var(--scl); color: var(--sc); }
   .stat-card .stat-card-value { color: var(--sc); }
   
   /* ── Buttons ────────────────────────────────────────────────── */
   .btn {
     font-family: 'DM Sans', sans-serif;
     font-weight: 600;
     font-size: 0.85rem;
     border-radius: var(--radius-sm);
     padding: 8px 16px;
     transition: all var(--transition);
     display: inline-flex;
     align-items: center;
     gap: 7px;
     border: 1px solid transparent;
     cursor: pointer;
     line-height: 1.4;
   }
   
   .btn-primary {
     background: var(--accent);
     color: #fff;
     border-color: var(--accent);
     box-shadow: 0 2px 8px rgba(79,110,247,0.3);
   }
   .btn-primary:hover {
     background: var(--accent-hover);
     border-color: var(--accent-hover);
     box-shadow: 0 4px 12px rgba(79,110,247,0.4);
     color: #fff;
   }
   
   .btn-outline-secondary {
     background: transparent;
     color: var(--text-secondary);
     border-color: var(--border);
   }
   .btn-outline-secondary:hover {
     background: var(--surface-2);
     color: var(--text-primary);
     border-color: #d0d4e0;
   }
   
   .btn-danger {
     background: var(--danger);
     color: #fff;
     border-color: var(--danger);
   }
   .btn-danger:hover {
     background: #dc2626;
     border-color: #dc2626;
     color: #fff;
   }
   
   .btn-sm { padding: 5px 11px; font-size: 0.78rem; }
   
   /* ── Tables ─────────────────────────────────────────────────── */
   .table-wrapper {
     border-radius: var(--radius-lg);
     overflow: hidden;
     border: 1px solid var(--border);
     background: var(--surface);
     box-shadow: var(--shadow-sm);
   }
   
   .table {
     margin: 0 !important;
     font-size: 0.875rem;
   }
   
   .table thead th {
     background: #f8f9fc;
     color: var(--text-muted);
     font-weight: 600;
     font-size: 0.73rem;
     letter-spacing: 0.06em;
     text-transform: uppercase;
     border-bottom: 1px solid var(--border) !important;
     padding: 13px 16px;
     white-space: nowrap;
   }
   
   .table tbody td {
     padding: 13px 16px;
     border-bottom: 1px solid var(--surface-2);
     color: var(--text-primary);
     vertical-align: middle;
   }
   
   .table tbody tr:last-child td { border-bottom: none; }
   
   .table tbody tr { transition: background var(--transition); }
   .table tbody tr:hover td { background: #f8f9fc; }
   
   /* ── Action Buttons in Table ────────────────────────────────── */
   .action-btns {
     display: flex;
     gap: 6px;
     align-items: center;
   }
   
   .action-btn {
     width: 30px; height: 30px;
     border-radius: var(--radius-sm);
     border: 1px solid var(--border);
     background: transparent;
     display: inline-flex;
     align-items: center;
     justify-content: center;
     font-size: 0.82rem;
     cursor: pointer;
     transition: all var(--transition);
     color: var(--text-secondary);
     text-decoration: none;
   }
   
   .action-btn:hover { color: var(--accent); background: var(--accent-light); border-color: #c7d1fc; }
   .action-btn.edit:hover { color: var(--warning); background: var(--warning-light); border-color: #fde68a; }
   .action-btn.delete:hover { color: var(--danger); background: var(--danger-light); border-color: #fca5a5; }
   
   /* ── Badge ──────────────────────────────────────────────────── */
   .badge {
     font-size: 0.72rem;
     font-weight: 600;
     padding: 3px 9px;
     border-radius: 20px;
     font-family: 'DM Sans', sans-serif;
   }
   
   .badge-success { background: var(--success-light); color: #15803d; }
   .badge-danger  { background: var(--danger-light);  color: #b91c1c; }
   .badge-info    { background: var(--info-light);    color: #0e7490; }
   
   /* ── Forms / Inputs ─────────────────────────────────────────── */
   .form-label {
     font-size: 0.82rem;
     font-weight: 600;
     color: var(--text-secondary);
     margin-bottom: 6px;
   }
   
   .form-control, .form-select {
     font-family: 'DM Sans', sans-serif;
     font-size: 0.875rem;
     border: 1px solid var(--border);
     border-radius: var(--radius-sm);
     padding: 9px 13px;
     color: var(--text-primary);
     background: var(--surface);
     transition: border-color var(--transition), box-shadow var(--transition);
   }
   
   .form-control:focus, .form-select:focus {
     border-color: var(--border-focus);
     box-shadow: 0 0 0 3px rgba(79,110,247,0.12);
     outline: none;
   }
   
   /* ── Modals ─────────────────────────────────────────────────── */
   .modal-content {
     border: none;
     border-radius: var(--radius-lg);
     box-shadow: var(--shadow-lg);
     overflow: hidden;
   }
   
   .modal-header {
     background: var(--surface);
     border-bottom: 1px solid var(--border);
     padding: 18px 24px;
   }
   
   .modal-title {
     font-family: 'Syne', sans-serif;
     font-weight: 700;
     font-size: 1rem;
   }
   
   .modal-body  { padding: 24px; }
   .modal-footer { background: #f8f9fc; border-top: 1px solid var(--border); padding: 16px 24px; }
   
   /* ── DataTables overrides ───────────────────────────────────── */
   div.dataTables_wrapper div.dataTables_length,
   div.dataTables_wrapper div.dataTables_filter,
   div.dataTables_wrapper div.dataTables_info,
   div.dataTables_wrapper div.dataTables_paginate {
     font-size: 0.82rem;
     color: var(--text-secondary);
     padding: 14px 16px;
   }
   
   div.dataTables_wrapper div.dataTables_filter input {
     border: 1px solid var(--border);
     border-radius: var(--radius-sm);
     padding: 6px 11px;
     font-size: 0.82rem;
     color: var(--text-primary);
   }
   
   div.dataTables_wrapper div.dataTables_filter input:focus {
     border-color: var(--border-focus);
     box-shadow: 0 0 0 3px rgba(79,110,247,0.1);
     outline: none;
   }
   
   .dataTables_paginate .paginate_button {
     border-radius: var(--radius-sm) !important;
     font-size: 0.8rem !important;
     padding: 4px 10px !important;
   }
   
   .dataTables_paginate .paginate_button.current,
   .dataTables_paginate .paginate_button.current:hover {
     background: var(--accent) !important;
     border-color: var(--accent) !important;
     color: #fff !important;
   }
   
   /* ── Chart container ────────────────────────────────────────── */
   .chart-container {
     position: relative;
     padding: 8px;
   }
   
   /* ── Login Page ─────────────────────────────────────────────── */
   body.login-page {
     background: linear-gradient(135deg, #0f1117 0%, #1a1f35 100%);
     display: flex;
     align-items: center;
     justify-content: center;
     min-height: 100vh;
   }
   
   .login-card {
     width: 100%;
     max-width: 400px;
     background: var(--surface);
     border-radius: var(--radius-xl);
     box-shadow: var(--shadow-lg);
     overflow: hidden;
   }
   
   .login-header {
     padding: 32px 32px 0;
     text-align: center;
   }
   
   .login-logo {
     width: 52px; height: 52px;
     background: var(--accent);
     border-radius: var(--radius);
     display: flex; align-items: center; justify-content: center;
     font-size: 1.6rem;
     margin: 0 auto 16px;
     box-shadow: 0 0 24px rgba(79,110,247,0.4);
   }
   
   .login-title {
     font-family: 'Syne', sans-serif;
     font-size: 1.4rem;
     font-weight: 800;
   }
   
   .login-sub {
     color: var(--text-secondary);
     font-size: 0.85rem;
     margin-top: 4px;
   }
   
   .login-body { padding: 28px 32px 32px; }
   
   /* ── Upload zone ────────────────────────────────────────────── */
   .upload-zone {
     border: 2px dashed var(--border);
     border-radius: var(--radius-lg);
     padding: 40px;
     text-align: center;
     transition: all var(--transition);
     cursor: pointer;
     background: #fafbff;
   }
   
   .upload-zone:hover {
     border-color: var(--accent);
     background: var(--accent-light);
   }
   
   .upload-zone i {
     font-size: 2.5rem;
     color: var(--accent);
     margin-bottom: 12px;
     display: block;
   }
   
   .upload-zone p { color: var(--text-secondary); font-size: 0.875rem; margin: 0; }
   .upload-zone .upload-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }
   
   /* ── Breadcrumb ─────────────────────────────────────────────── */
   .breadcrumb {
     font-size: 0.78rem;
     color: var(--text-muted);
     margin: 0;
     display: flex;
     align-items: center;
     gap: 6px;
   }
   .breadcrumb-item + .breadcrumb-item::before { content: '/'; color: var(--border); }
   .breadcrumb-item.active { color: var(--text-secondary); }
   
   /* ── Search Logs Table extras ───────────────────────────────── */
   .log-query {
     font-family: 'Courier New', monospace;
     font-size: 0.82rem;
     background: var(--surface-2);
     padding: 3px 8px;
     border-radius: 4px;
     color: var(--accent);
   }
   
   /* ── Alert ──────────────────────────────────────────────────── */
   .alert {
     border-radius: var(--radius);
     border: none;
     font-size: 0.875rem;
     padding: 12px 16px;
   }
   
   .alert-danger {
     background: var(--danger-light);
     color: #b91c1c;
   }
   
   /* ── Scrollbar ──────────────────────────────────────────────── */
   #sidebar::-webkit-scrollbar { width: 4px; }
   #sidebar::-webkit-scrollbar-track { background: transparent; }
   #sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }
   
   /* ── Responsive ─────────────────────────────────────────────── */
   @media (max-width: 768px) {
     #sidebar { transform: translateX(-100%); }
     #sidebar.show { transform: translateX(0); }
     #topbar { left: 0; }
     #main-content { margin-left: 0; }
   }