/* ===================================================
   EduMaster Pro - Design System
   Philosophy: 90% Modern Minimal + 10% Glassmorphism
   =================================================== */

/* --- CSS Custom Properties (Light Mode Default) --- */
:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;
  --secondary: #0F172A;
  --success: #16A34A;
  --success-light: #F0FDF4;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --danger: #DC2626;
  --danger-light: #FEF2F2;
  --info: #0891B2;
  --info-light: #ECFEFF;

  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --text: #0F172A;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --border-focus: #93C5FD;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --sidebar-width: 260px;
  --navbar-height: 62px;
  --font: 'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
  --transition: all .18s ease;
}

/* --- Dark Mode Tokens --- */
[data-theme="dark"] {
  --bg: #0F172A;
  --surface: #1E293B;
  --surface-2: #334155;
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --border: #334155;
  --border-focus: #3B82F6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.25);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.3);
  --primary-light: rgba(37,99,235,.15);
  --success-light: rgba(22,163,74,.15);
  --warning-light: rgba(245,158,11,.15);
  --danger-light: rgba(220,38,38,.15);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }

p { color: var(--text-muted); line-height: 1.7; }

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.card-body { padding: 1.25rem; }

/* --- Stat Cards --- */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.cyan { background: var(--info-light); color: var(--info); }

.stat-value {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: .8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15803D; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #B91C1C; color: #fff; }

.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #D97706; color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { padding: .3125rem .75rem; font-size: .8125rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-icon { padding: .5rem; border-radius: var(--radius-sm); }

/* --- Forms --- */
.form-control, .form-select {
  display: block;
  width: 100%;
  padding: .5625rem .875rem;
  font-size: .875rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  line-height: 1.5;
  outline: none;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-control::placeholder { color: var(--text-muted); opacity: .7; }

.form-label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: .375rem;
}

.form-text {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

.invalid-feedback { font-size: .75rem; color: var(--danger); margin-top: .25rem; }
.is-invalid { border-color: var(--danger) !important; }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-secondary { background: var(--surface-2); color: var(--text-muted); }

/* Status badges */
.badge-draft { background: #F1F5F9; color: #64748B; }
.badge-pending { background: #FFFBEB; color: #92400E; }
.badge-approved { background: #F0FDF4; color: #15803D; }
.badge-published { background: #EFF6FF; color: #1D4ED8; }
.badge-rejected { background: #FEF2F2; color: #B91C1C; }

/* --- Tables --- */
.table-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

table.dataTable {
  width: 100% !important;
  border-collapse: collapse;
}

table.dataTable thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}

table.dataTable tbody td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  color: var(--text);
  vertical-align: middle;
}

table.dataTable tbody tr:last-child td { border-bottom: none; }
table.dataTable tbody tr:hover { background: var(--bg); }

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .375rem .75rem;
  font-size: .875rem;
  background: var(--surface);
  color: var(--text);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  padding: .375rem .75rem !important;
  margin: 0 2px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* --- Alerts --- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 1rem;
}

.alert-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(22,163,74,.2); }
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(220,38,38,.2); }
.alert-warning { background: var(--warning-light); color: #92400E; border: 1px solid rgba(245,158,11,.2); }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid rgba(8,145,178,.2); }

/* --- Admin Layout --- */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  transition: transform .25s ease, width .25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  min-height: var(--navbar-height);
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.sidebar-logo-sub {
  font-size: .6875rem;
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: .5rem 0;
  overflow-y: auto;
}

.sidebar-section {
  padding: .75rem 1rem .25rem;
  font-size: .625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5625rem 1.25rem;
  font-size: .875rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 0;
  margin: 1px .5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
}

.sidebar-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-item i {
  width: 20px;
  text-align: center;
  font-size: .9375rem;
  flex-shrink: 0;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  border-radius: 20px;
  font-size: .625rem;
  font-weight: 700;
  padding: .1rem .4rem;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Navbar */
.admin-navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 900;
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: .375rem;
  border-radius: var(--radius-sm);
}

.navbar-toggle:hover { background: var(--surface-2); }

.navbar-search {
  flex: 1;
  max-width: 380px;
  position: relative;
}

.navbar-search input {
  width: 100%;
  padding: .4375rem .875rem .4375rem 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  background: var(--bg);
  color: var(--text);
  transition: var(--transition);
}

.navbar-search input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.navbar-search-icon {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .875rem;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
}

.navbar-icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.navbar-icon-btn:hover { background: var(--surface-2); color: var(--text); }

.notif-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.navbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid var(--border);
}

/* Page Content */
.page-content {
  padding: 1.5rem;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .8125rem;
  color: var(--text-muted);
  margin-top: .25rem;
  list-style: none;
  padding: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  color: var(--border);
}

.breadcrumb-item.active { color: var(--text-muted); }
.breadcrumb-item a { color: var(--primary); }

/* Grid */
.row { display: flex; flex-wrap: wrap; margin: -.75rem; }
.col { flex: 1; padding: .75rem; min-width: 0; }

/* Responsive grid cols */
.col-12 { width: 100%; padding: .75rem; }
.col-6 { width: 50%; padding: .75rem; }
.col-4 { width: 33.333%; padding: .75rem; }
.col-3 { width: 25%; padding: .75rem; }

/* --- Glassmorphism (Login only) --- */
.glass-card {
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,.12), 0 8px 25px rgba(37,99,235,.08);
}

[data-theme="dark"] .glass-card {
  background: rgba(30,41,59,.88);
  border-color: rgba(255,255,255,.12);
}

/* --- Login Page --- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #EFF6FF 0%, #F8FAFC 40%, #E0F2FE 100%);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .login-page {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0C1A2E 100%);
}

.login-page::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(37,99,235,.08) 0%, transparent 70%);
  border-radius: 50%;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo-icon {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: .875rem;
  box-shadow: 0 4px 14px rgba(37,99,235,.3);
}

.login-title { font-size: 1.5rem; font-weight: 700; color: var(--text); margin-bottom: .25rem; }
.login-subtitle { font-size: .875rem; color: var(--text-muted); }

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform .2s;
}

.modal-overlay.active .modal-box { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1.0625rem; font-weight: 600; color: var(--text); margin: 0; }

.modal-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.125rem;
  transition: var(--transition);
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}

/* --- Mobile Bottom Navigation --- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 1000;
  padding: .25rem 0 max(.25rem, env(safe-area-inset-bottom));
}

.bottom-nav-items {
  display: flex;
  align-items: stretch;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: .5rem .25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .625rem;
  font-weight: 500;
  transition: var(--transition);
  border: none;
  background: none;
  cursor: pointer;
}

.bottom-nav-item i { font-size: 1.25rem; }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item:hover { color: var(--primary); }

/* --- Content Area (Student Reading) --- */
.reading-area {
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--text);
  max-width: 860px;
}

.reading-area h1, .reading-area h2, .reading-area h3 {
  margin-top: 2rem;
  margin-bottom: .75rem;
}

.reading-area p { margin-bottom: 1rem; }
.reading-area ul, .reading-area ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.reading-area li { margin-bottom: .375rem; }

/* --- Tabs --- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  gap: 0;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-item {
  padding: .75rem 1.25rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .375rem;
  transition: var(--transition);
}

.tab-item:hover { color: var(--primary); }

.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- Utilities --- */
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.5rem; }
.mb-6 { margin-bottom: 2rem; }

.p-4 { padding: 1rem; }
.p-5 { padding: 1.5rem; }
.p-6 { padding: 2rem; }

.text-sm { font-size: .8125rem; }
.text-xs { font-size: .75rem; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Toasts --- */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 340px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .875rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .875rem;
  animation: toastIn .3s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast-success { background: rgba(240,253,244,.95); color: var(--success); border: 1px solid rgba(22,163,74,.2); }
.toast-error { background: rgba(254,242,242,.95); color: var(--danger); border: 1px solid rgba(220,38,38,.2); }
.toast-info { background: rgba(239,246,255,.95); color: var(--primary); border: 1px solid rgba(37,99,235,.2); }
.toast-warning { background: rgba(255,251,235,.95); color: #92400E; border: 1px solid rgba(245,158,11,.2); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* --- Spinner --- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

.spinner-primary {
  border-color: rgba(37,99,235,.2);
  border-top-color: var(--primary);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Dropdown --- */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 1500;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity .15s, transform .15s;
}

.dropdown-menu.show { opacity: 1; pointer-events: all; transform: translateY(0); }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem 1rem;
  font-size: .875rem;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-decoration: none;
}

.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: .25rem 0; }

/* --- Avatar --- */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-sm { width: 28px; height: 28px; }
.avatar-md { width: 36px; height: 36px; }
.avatar-lg { width: 48px; height: 48px; }
.avatar-xl { width: 72px; height: 72px; }

/* --- Progress --- */
.progress {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width .4s ease;
}

/* --- Sidebar collapsed state --- */
.sidebar.collapsed {
  width: 64px;
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-section,
.sidebar.collapsed .sidebar-item span,
.sidebar.collapsed .sidebar-badge {
  display: none;
}

.sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: .5625rem;
}

.sidebar.collapsed .sidebar-item i {
  margin: 0;
}

.sidebar.collapsed + .main-content {
  margin-left: 64px;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .navbar-toggle {
    display: flex;
  }

  .bottom-nav {
    display: block;
  }

  .page-content {
    padding-bottom: 5rem;
  }
}

@media (max-width: 768px) {
  .col-6, .col-4, .col-3 {
    width: 100%;
  }

  .page-header {
    flex-direction: column;
  }

  .admin-navbar {
    padding: 0 1rem;
  }

  .navbar-search {
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .page-content { padding: 1rem; }
  .login-card { padding: 1.75rem 1.25rem; }
}

/* --- CKEditor Dark Mode Fix --- */
[data-theme="dark"] .ck.ck-editor__main>.ck-editor__editable {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .ck.ck-toolbar {
  background: var(--surface);
  border-color: var(--border);
}

/* --- Scrollbar styling --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
