/* ==========================================================
   Face Recognition Attendance System - Multi-Theme Design Engine
   ========================================================== */

/* ----------------------------------------------------------
   THEME 1: Clean Minimalist Light (Default SaaS Lucid)
   ---------------------------------------------------------- */
:root, [data-theme="light"] {
  /* Surfaces & Backgrounds */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --topbar-bg: rgba(255, 255, 255, 0.85);
  
  /* Borders & Dividers */
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-focus: #6366f1;
  --border-hover: #cbd5e1;
  
  /* Typography */
  --text-heading: #0f172a;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  /* Accents & Gradients */
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --accent-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  --accent-cyan: #0284c7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  /* Badges & Status Pills */
  --badge-emerald-bg: #ecfdf5;
  --badge-emerald-text: #059669;
  --badge-emerald-border: #a7f3d0;
  
  --badge-sky-bg: #f0f9ff;
  --badge-sky-text: #0369a1;
  --badge-sky-border: #bae6fd;
  
  --badge-amber-bg: #fffbeb;
  --badge-amber-text: #b45309;
  --badge-amber-border: #fde68a;
  
  --badge-rose-bg: #fff1f2;
  --badge-rose-text: #be123c;
  --badge-rose-border: #fecdd3;
  
  --badge-indigo-bg: #eef2ff;
  --badge-indigo-text: #4338ca;
  --badge-indigo-border: #c7d2fe;

  --bg-mesh: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 45%),
             radial-gradient(at 100% 0%, rgba(14, 165, 233, 0.04) 0px, transparent 40%),
             radial-gradient(at 50% 100%, rgba(168, 85, 247, 0.03) 0px, transparent 50%);
}

/* ----------------------------------------------------------
   THEME 2: Executive Midnight Dark (High-Contrast Cyber Command)
   ---------------------------------------------------------- */
[data-theme="dark"] {
  /* Surfaces & Backgrounds */
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-subtle: #192338;
  --bg-card: #0f172a;
  --bg-card-hover: #162238;
  --topbar-bg: rgba(15, 23, 42, 0.88);
  
  /* Borders & Dividers */
  --border-color: #1e293b;
  --border-subtle: #162032;
  --border-focus: #38bdf8;
  --border-hover: #334155;
  
  /* Typography */
  --text-heading: #f8fafc;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  
  /* Accents & Gradients */
  --accent-primary: #38bdf8;
  --accent-primary-hover: #0284c7;
  --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
  --accent-gradient-hover: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
  --accent-cyan: #38bdf8;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
  --accent-rose: #fb7185;
  
  /* Badges & Status Pills */
  --badge-emerald-bg: #064e3b;
  --badge-emerald-text: #34d399;
  --badge-emerald-border: #047857;
  
  --badge-sky-bg: #0c4a6e;
  --badge-sky-text: #38bdf8;
  --badge-sky-border: #0284c7;
  
  --badge-amber-bg: #451a03;
  --badge-amber-text: #fbbf24;
  --badge-amber-border: #b45309;
  
  --badge-rose-bg: #4c0519;
  --badge-rose-text: #fb7185;
  --badge-rose-border: #9f1239;
  
  --badge-indigo-bg: #1e1b4b;
  --badge-indigo-text: #a5b4fc;
  --badge-indigo-border: #3730a3;

  --bg-mesh: radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.08) 0px, transparent 45%),
             radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 40%),
             radial-gradient(at 50% 100%, rgba(52, 211, 153, 0.05) 0px, transparent 50%);
}

/* ----------------------------------------------------------
   THEME 3: Warm (Scholarly Campus & Editorial Parchment)
   ---------------------------------------------------------- */
[data-theme="academic"],
[data-theme="warm"] {
  /* Surfaces & Backgrounds */
  --bg-primary: #faf7f2;
  --bg-secondary: #ffffff;
  --bg-subtle: #f3ede2;
  --bg-card: #ffffff;
  --bg-card-hover: #fffdf9;
  --topbar-bg: rgba(255, 253, 249, 0.88);
  
  /* Borders & Dividers */
  --border-color: #e7ded3;
  --border-subtle: #efe8dc;
  --border-focus: #c2410c;
  --border-hover: #d6c8b7;
  
  /* Typography */
  --text-heading: #292524;
  --text-primary: #44403c;
  --text-secondary: #57534e;
  --text-muted: #78716c;
  --text-light: #a8a29e;
  
  /* Accents & Gradients */
  --accent-primary: #c2410c;
  --accent-primary-hover: #9a3412;
  --accent-gradient: linear-gradient(135deg, #c2410c 0%, #ea580c 100%);
  --accent-gradient-hover: linear-gradient(135deg, #9a3412 0%, #c2410c 100%);
  --accent-cyan: #0369a1;
  --accent-emerald: #15803d;
  --accent-amber: #d97706;
  --accent-rose: #b91c1c;
  
  /* Badges & Status Pills */
  --badge-emerald-bg: #f0fdf4;
  --badge-emerald-text: #166534;
  --badge-emerald-border: #bbf7d0;
  
  --badge-sky-bg: #f0f9ff;
  --badge-sky-text: #075985;
  --badge-sky-border: #bae6fd;
  
  --badge-amber-bg: #fefce8;
  --badge-amber-text: #854d0e;
  --badge-amber-border: #fef08a;
  
  --badge-rose-bg: #fff1f2;
  --badge-rose-text: #9f1239;
  --badge-rose-border: #fecdd3;
  
  --badge-indigo-bg: #fff7ed;
  --badge-indigo-text: #9a3412;
  --badge-indigo-border: #fed7aa;

  --bg-mesh: radial-gradient(at 0% 0%, rgba(194, 65, 12, 0.05) 0px, transparent 45%),
             radial-gradient(at 100% 0%, rgba(217, 119, 6, 0.04) 0px, transparent 40%),
             radial-gradient(at 50% 100%, rgba(21, 128, 61, 0.03) 0px, transparent 50%);
}

/* Common System Dimensions & Transitions */
:root {
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-card: 0 4px 12px -2px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.02), 0 0 0 1px var(--border-color);
  --shadow-card-hover: 0 16px 32px -8px rgba(15, 23, 42, 0.08), 0 6px 12px -4px rgba(15, 23, 42, 0.03), 0 0 0 1px var(--border-hover);
  --shadow-primary: 0 8px 20px -4px rgba(99, 102, 241, 0.35);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  background-image: var(--bg-mesh);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ==========================================================
   Sidebar Navigation
   ========================================================== */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 24px 16px;
  box-shadow: 2px 0 12px rgba(15, 23, 42, 0.02);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 24px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #ffffff;
  box-shadow: var(--shadow-primary);
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.3px;
}

.brand-text span {
  font-size: 11px;
  color: var(--accent-primary);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-link i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--text-heading);
  transform: translateX(2px);
}

.nav-link:hover i {
  color: var(--accent-primary);
}

.nav-link.active {
  background: var(--badge-indigo-bg);
  color: var(--accent-primary);
  font-weight: 700;
  border: 1px solid var(--badge-indigo-border);
}

.nav-link.active i {
  color: var(--accent-primary);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ==========================================================
   Main Content Area & Sticky Top Bar
   ========================================================== */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 36px;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 20;
}

.page-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.3px;
}

.page-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-body {
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ==========================================================
   Stats Cards Grid
   ========================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-normal);
}

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

/* Hero Command Center Metrics Grid */
.dash-hero-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 20px;
  margin-bottom: 24px;
  align-items: stretch;
}

.hero-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 16px;
  height: 100%;
}

.hero-stat-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.hero-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background var(--transition-fast);
}

.hero-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-hover);
}

.hero-stat-card:hover::before {
  background: var(--accent-gradient);
}

@media (max-width: 1024px) {
  .dash-hero-grid {
    grid-template-columns: 1fr;
  }
  .hero-metrics-grid {
    min-height: 280px;
  }
}

@media (max-width: 640px) {
  .hero-metrics-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
}

.stat-info span {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.stat-info h3 {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
  color: var(--text-heading);
  letter-spacing: -0.5px;
}

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

.stat-icon.purple { background: var(--badge-indigo-bg); color: var(--accent-primary); border: 1px solid var(--badge-indigo-border); }
.stat-icon.emerald { background: var(--badge-emerald-bg); color: var(--accent-emerald); border: 1px solid var(--badge-emerald-border); }
.stat-icon.cyan { background: var(--badge-sky-bg); color: var(--accent-cyan); border: 1px solid var(--badge-sky-border); }
.stat-icon.amber { background: var(--badge-amber-bg); color: var(--accent-amber); border: 1px solid var(--badge-amber-border); }

/* ==========================================================
   Cards & Layout Wrappers
   ========================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
}

.card-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-body {
  padding: 24px;
}

/* ==========================================================
   Buttons
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -4px rgba(99, 102, 241, 0.45);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
  color: var(--text-heading);
  border-color: var(--border-hover);
}

.btn-danger {
  background: var(--badge-rose-bg);
  color: var(--badge-rose-text);
  border: 1px solid var(--badge-rose-border);
}

.btn-danger:hover:not(:disabled) {
  background: #ffe4e6;
  color: #9f1239;
}

/* ==========================================================
   Tables & Data Grids
   ========================================================== */
.table-container,
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  position: relative;
}

.custom-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

.custom-table th,
.data-table th {
  padding: 13px 18px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

.custom-table td,
.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  background: var(--bg-card);
  transition: background-color var(--transition-fast);
}

.custom-table tr:last-child td,
.data-table tr:last-child td {
  border-bottom: none;
}

.custom-table tr:hover td,
.data-table tr:hover td {
  background: var(--bg-subtle);
}

/* ==========================================================
   Badges & Pills
   ========================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 20px;
}

.badge-present {
  background: var(--badge-emerald-bg);
  color: var(--badge-emerald-text);
  border: 1px solid var(--badge-emerald-border);
}

.badge-unknown {
  background: var(--badge-rose-bg);
  color: var(--badge-rose-text);
  border: 1px solid var(--badge-rose-border);
}

.badge-node {
  background: var(--badge-indigo-bg);
  color: var(--badge-indigo-text);
  border: 1px solid var(--badge-indigo-border);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--bg-subtle);
  color: var(--accent-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid var(--border-subtle);
}

/* ==========================================================
   Live Feed List
   ========================================================== */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
}

.feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  animation: slideDown 0.25s ease-out;
  transition: all var(--transition-fast);
  gap: 12px;
}

.feed-item-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.feed-details h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.feed-item-right {
  text-align: right;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.feed-timestamp {
  font-size: 11px;
  color: var(--text-light);
}

.feed-item:hover {
  background: var(--bg-card-hover, #eef2f6);
  border-color: var(--border-hover);
}

.feed-item.highlight {
  border-color: var(--badge-emerald-border);
  background: #f0fdf4;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.feed-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--badge-indigo-bg);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 1px solid var(--badge-indigo-border);
  overflow: hidden;
  flex-shrink: 0;
}

.feed-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================
   Forms, Inputs & Labels
   ========================================================== */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 7px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-heading);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-control::placeholder {
  color: var(--text-light);
}

/* ==========================================================
   Camera Preview Box
   ========================================================== */
.camera-box {
  position: relative;
  background: #0f172a;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4/3;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
}

.camera-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-box canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ==========================================================
   Enrollment Dual-Mode Tabs
   ========================================================== */
.enroll-tabs {
  display: flex;
  gap: 8px;
  background: #ffffff;
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.enroll-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.enroll-tab-btn:hover {
  color: var(--text-heading);
  background: var(--bg-subtle);
}

.enroll-tab-btn.active {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-primary);
}

/* ==========================================================
   Batch Upload Dropzone & Previews
   ========================================================== */
.upload-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--accent-primary);
  background: var(--badge-indigo-bg);
  transform: scale(1.005);
}

.upload-dropzone i {
  font-size: 38px;
  color: var(--accent-primary);
  margin-bottom: 12px;
}

.photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.photo-preview-card {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.photo-preview-img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  background: #f1f5f9;
}

.photo-preview-label {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 700;
  text-align: center;
  width: 100%;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================
   Enrolled Photos Thumbnail Strip in Table
   ========================================================== */
.photo-thumb-strip {
  display: flex;
  align-items: center;
  gap: 6px;
}

.photo-thumb-item {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border-color);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-subtle);
  position: relative;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.photo-thumb-item:hover {
  transform: scale(1.15);
  border-color: var(--accent-primary);
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
  z-index: 5;
}

.photo-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-light);
}

/* ==========================================================
   Modals (Light, Lucid SaaS Dialogs)
   ========================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.96) translateY(8px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--accent-rose);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-subtle);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

/* ==========================================================
   Lightbox Photo Viewer
   ========================================================== */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  padding: 24px;
}

.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-img-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  max-width: 420px;
  width: 100%;
  border: 1px solid var(--border-color);
  animation: scaleUp 0.25s ease-out;
}

@keyframes scaleUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  display: block;
}

.lightbox-footer {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================
   Mobile-First Responsive Layout & Hamburger Navigation
   ========================================================== */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

/* ==========================================================
   Mobile-First Navigation Drawer & Off-Canvas Backdrops
   ========================================================== */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.btn-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  color: var(--text-heading);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-hamburger:hover {
  background: var(--bg-subtle);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-close-btn:hover {
  background: var(--badge-rose-bg);
  color: var(--accent-rose);
  border-color: var(--badge-rose-border);
}

/* ==========================================================
   Responsive Breakpoints (< 1024px, < 768px, < 480px)
   ========================================================== */

/* 1. Tablet & Large Phone Drawer Layout (< 1024px) */
@media (max-width: 1023px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 285px;
    max-width: 85vw;
    height: 100vh;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    overflow-y: auto;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.35);
  }

  .sidebar-close-btn {
    display: inline-flex;
  }

  .btn-hamburger {
    display: inline-flex;
  }

  .main-wrapper {
    width: 100%;
    margin-left: 0;
    height: 100vh;
    overflow-x: hidden;
  }

  .top-bar {
    padding: 14px 20px;
  }

  .content-body {
    padding: 20px 18px;
    gap: 20px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 14px !important;
  }
}

/* 2. Mobile Tablets & Phones (< 768px) */
@media (max-width: 768px) {
  .top-bar {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
  }

  .content-body {
    padding: 14px 12px;
    gap: 14px;
  }

  .page-title h2 {
    font-size: 17px;
  }

  .page-title p {
    font-size: 11.5px;
  }

  .dashboard-grid,
  .teacher-container,
  .super-admin-container {
    gap: 14px !important;
  }

  /* Universal grid override for inline grid containers on mobile */
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1.2fr"],
  div[style*="grid-template-columns: 1fr 1.5fr"],
  div[style*="grid-template-columns: 1fr 1.8fr"],
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 2fr 1.2fr"],
  div[style*="grid-template-columns: 1.2fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-info span {
    font-size: 10.5px;
  }

  .stat-info h3 {
    font-size: 20px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .card-header {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .card-body {
    padding: 16px 14px;
  }

  /* Accessible Touch Targets */
  .form-control,
  input[type="text"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  select,
  textarea {
    min-height: 44px;
    font-size: 14px;
    padding: 10px 12px;
  }

  .btn {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 13.5px;
  }

  .nav-link {
    min-height: 46px;
    font-size: 14px;
  }

  /* Touch-Scrollable Table Containers */
  .table-container {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    border-radius: var(--radius-sm);
  }

  .custom-table th,
  .custom-table td {
    padding: 11px 13px;
    font-size: 12px;
  }

  /* Responsive Modals */
  .modal-overlay {
    padding: 10px;
    align-items: flex-end; /* Bottom sheet feel on mobile */
  }

  .modal-content {
    width: 100%;
    max-width: 100% !important;
    max-height: 90vh;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    margin: 0;
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 16px 14px;
  }

  .modal-footer {
    padding: 12px 14px;
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-footer .btn {
    width: 100%;
  }

  .feed-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .feed-item-right {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-subtle);
    padding-top: 8px;
  }

  .photo-preview-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .enroll-tabs {
    flex-direction: column;
    gap: 6px;
  }

  .enroll-tab-btn {
    min-height: 44px;
  }
}

/* 3. Ultra-Small Smartphone Breakpoint (< 480px) */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .top-bar .page-title p {
    display: none;
  }

  .tenant-switcher-box {
    width: 100%;
    justify-content: space-between;
  }

  .tenant-switcher-box select {
    max-width: 100% !important;
    flex: 1;
  }
}

/* ==========================================================
   Multi-Theme Switcher & Settings Page Styles
   ========================================================== */
.theme-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-heading);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-quick-btn:hover {
  background: var(--border-color);
  color: var(--accent-primary);
}

.theme-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}

.theme-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.theme-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover);
}

.theme-card.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2), var(--shadow-card-hover);
}

.theme-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.theme-card-header h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-card-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  transition: all var(--transition-fast);
}

.theme-card.active .theme-card-check {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.theme-preview-box {
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-preview-box.light-preview {
  background: #f8fafc;
}

.theme-preview-box.dark-preview {
  background: #090d16;
  border-color: #1e293b;
}

.theme-preview-box.academic-preview {
  background: #faf7f2;
  border-color: #e7ded3;
}

.theme-preview-nav {
  height: 14px;
  border-radius: 4px;
  width: 100%;
}

.theme-preview-body {
  display: flex;
  gap: 8px;
}

.theme-preview-sidebar {
  width: 30%;
  height: 48px;
  border-radius: 4px;
}

.theme-preview-content {
  flex: 1;
  height: 48px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
}

.theme-swatches-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.theme-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ==========================================================
   Universal Mobile-First Touch & Layout Enhancements
   ========================================================== */

/* Smooth Scrollable Horizontal Tabs on Mobile */
.tabs-header,
.tab-navigation,
.academic-tabs-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  padding-bottom: 4px;
}

.tabs-header::-webkit-scrollbar,
.tab-navigation::-webkit-scrollbar,
.academic-tabs-bar::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* Responsive Map Containers */
.leaflet-container {
  width: 100% !important;
  max-width: 100% !important;
  border-radius: var(--radius-sm);
  z-index: 10;
}

/* Video & Camera HUD Fluidity */
video,
.camera-viewfinder,
.webcam-feed {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

/* Accessible Hitboxes for Action Buttons & Icon Links */
.action-btn-sm,
.btn-icon {
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .action-btn-sm,
  .btn-icon {
    min-width: 44px;
    min-height: 44px;
  }
}
