/* ==========================================================================
   GURUJI / NEXTEDU — UNIFIED THEME SYSTEM v1.0
   Light: purple-white | Dark: green-black
   No glassmorphism, no orbs, no cyber fonts, no heavy gradients.
   ========================================================================== */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ══════════════════════════════════════════════════════════════
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
══════════════════════════════════════════════════════════════ */

:root,
[data-theme="light"] {
  /* Surfaces */
  --bg:             #f8f5ff;
  --surface:        #ffffff;
  --surface-soft:   #fbf9ff;
  --surface-hover:  #f3eeff;

  /* Text */
  --text:           #171321;
  --text-muted:     #625b71;
  --text-dim:       #9d8fb0;

  /* Border */
  --border:         #e7ddff;
  --border-strong:  #c4b5fd;

  /* Brand / Primary */
  --primary:        #6d28d9;
  --primary-hover:  #5b21b6;
  --primary-active: #4c1d95;
  --primary-soft:   #ede9fe;
  --accent:         #8b5cf6;

  /* Status */
  --success:        #16a34a;
  --success-soft:   #dcfce7;
  --warning:        #d97706;
  --warning-soft:   #fef3c7;
  --danger:         #dc2626;
  --danger-soft:    #fee2e2;
  --info:           #0369a1;
  --info-soft:      #e0f2fe;

  /* Shadows */
  --shadow-sm:      0 1px 3px rgba(47, 24, 90, 0.06);
  --shadow:         0 4px 12px rgba(47, 24, 90, 0.08);
  --shadow-md:      0 8px 24px rgba(47, 24, 90, 0.10);
  --shadow-lg:      0 16px 40px rgba(47, 24, 90, 0.12);

  /* Radii */
  --radius-sm:      6px;
  --radius:         10px;
  --radius-md:      12px;
  --radius-lg:      16px;
  --radius-pill:    9999px;

  /* Transitions */
  --transition:     0.18s ease;
  --transition-md:  0.25s ease;

  /* Sidebar */
  --sidebar-width:  240px;
  --sidebar-rail:   64px;
  --topbar-height:  56px;

  /* Z-index scale */
  --z-sidebar:      100;
  --z-topbar:       110;
  --z-dropdown:     200;
  --z-modal:        300;
  --z-toast:        400;

  /* Theme-color meta */
  --meta-theme-color: #6d28d9;
}

[data-theme="dark"] {
  /* Surfaces */
  --bg:             #050807;
  --surface:        #0c1210;
  --surface-soft:   #111a16;
  --surface-hover:  #162019;

  /* Text */
  --text:           #edfdf4;
  --text-muted:     #9ab0a4;
  --text-dim:       #5e7a6e;

  /* Border */
  --border:         #1d2b25;
  --border-strong:  #2d4238;

  /* Brand / Primary */
  --primary:        #22c55e;
  --primary-hover:  #16a34a;
  --primary-active: #15803d;
  --primary-soft:   rgba(34, 197, 94, 0.12);
  --accent:         #86efac;

  /* Status */
  --success:        #22c55e;
  --success-soft:   rgba(34, 197, 94, 0.12);
  --warning:        #f59e0b;
  --warning-soft:   rgba(245, 158, 11, 0.12);
  --danger:         #f87171;
  --danger-soft:    rgba(248, 113, 113, 0.12);
  --info:           #38bdf8;
  --info-soft:      rgba(56, 189, 248, 0.12);

  /* Shadows */
  --shadow-sm:      0 1px 3px rgba(0, 0, 0, 0.20);
  --shadow:         0 4px 12px rgba(0, 0, 0, 0.24);
  --shadow-md:      0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-lg:      0 16px 40px rgba(0, 0, 0, 0.35);

  /* Theme-color meta */
  --meta-theme-color: #22c55e;
}

/* Admin pages inherit same tokens, but with dark default */
[data-theme="dark"].admin-body,
.admin-body[data-theme="dark"] {
  --primary: #22c55e;
}

/* ══════════════════════════════════════════════════════════════
   2. RESET & BASE
══════════════════════════════════════════════════════════════ */

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

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

body {
  font-family: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-md), color var(--transition-md);
  overflow-x: hidden;
}

/* Remove orbs/pseudo backgrounds from old custom.css */
body::before,
body::after {
  display: none !important;
}

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

img, svg { max-width: 100%; vertical-align: middle; }

button { cursor: pointer; font-family: inherit; }

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

ul, ol { list-style: none; }

/* ══════════════════════════════════════════════════════════════
   3. TYPOGRAPHY
══════════════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(20px, 4vw, 28px); }
h2 { font-size: clamp(18px, 3vw, 24px); }
h3 { font-size: clamp(16px, 2.5vw, 20px); }
h4 { font-size: 17px; }
h5 { font-size: 15px; }
h6 { font-size: 13px; font-weight: 500; }

.text-muted   { color: var(--text-muted); }
.text-dim     { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

.text-sm  { font-size: 13px; }
.text-xs  { font-size: 12px; }
.text-lg  { font-size: 17px; }

/* ══════════════════════════════════════════════════════════════
   4. BUTTONS
══════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), box-shadow var(--transition),
              transform var(--transition);
  user-select: none;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:active { transform: translateY(1px); }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

/* Primary */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.25);
}
[data-theme="dark"] .btn-primary:hover {
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

/* Secondary / Ghost */
.btn-secondary {
  background: transparent;
  color: var(--primary);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--primary-soft);
  border-color: var(--accent);
}

/* Outline Danger */
.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger-soft);
}

/* Ghost (borderless) */
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Sizes */
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* Loading state */
.btn.loading {
  pointer-events: none;
  opacity: 0.8;
}
.btn.loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 6px;
}

/* ══════════════════════════════════════════════════════════════
   5. FORM ELEMENTS
══════════════════════════════════════════════════════════════ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}

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

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-control:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-control.is-invalid {
  border-color: var(--danger);
}
.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px var(--danger-soft);
}

/* Input with icon wrapper */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .form-control {
  padding-left: 40px;
}

.input-group .input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  font-size: 15px;
  pointer-events: none;
}

.input-group .input-action {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.input-group .input-action:hover { color: var(--text); }

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

.form-error {
  font-size: 12px;
  color: var(--danger);
}

/* Checkbox / Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════
   6. CARDS
══════════════════════════════════════════════════════════════ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

.card-sm { padding: 14px 16px; border-radius: var(--radius); }
.card-lg { padding: 28px 32px; border-radius: var(--radius-lg); }

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

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

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

/* Stat card variant */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
}

/* ══════════════════════════════════════════════════════════════
   7. TABLES
══════════════════════════════════════════════════════════════ */

.table-wrapper,
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.table tbody tr:hover > td {
  background: var(--surface-soft);
}

/* ══════════════════════════════════════════════════════════════
   8. BADGES / STATUS CHIPS
══════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-success  { background: var(--success-soft);  color: var(--success); }
.badge-danger   { background: var(--danger-soft);   color: var(--danger); }
.badge-warning  { background: var(--warning-soft);  color: var(--warning); }
.badge-info     { background: var(--info-soft);     color: var(--info); }
.badge-primary  { background: var(--primary-soft);  color: var(--primary); }
.badge-muted    { background: var(--surface-soft);  color: var(--text-muted);
                  border: 1px solid var(--border); }

/* ══════════════════════════════════════════════════════════════
   9. MODALS
══════════════════════════════════════════════════════════════ */

.modal-overlay,
.portal-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: var(--z-modal, 100000);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity var(--transition-md), visibility var(--transition-md);
}

.modal-overlay[style*="display: none"],
.modal-overlay[style*="display:none"],
.portal-modal-overlay[style*="display: none"],
.portal-modal-overlay[style*="display:none"] {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.modal-overlay.open,
.modal-overlay.active,
.modal-overlay.show,
.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display:flex"],
.modal-overlay[style*="display: block"],
.modal-overlay[style*="display:block"],
.portal-modal-overlay.open,
.portal-modal-overlay.active,
.portal-modal-overlay.show,
.portal-modal-overlay[style*="display: flex"],
.portal-modal-overlay[style*="display:flex"],
.portal-modal-overlay[style*="display: block"],
.portal-modal-overlay[style*="display:block"] {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

.modal,
.modal-content,
.modal-card,
.glass-modal,
.confirm-modal-content,
.support-modal,
.ai-chat-modal,
.exam-hub-modal-card,
.my-courses-modal-content,
.play-quiz-modal-content,
.nexus-ai-modal-content,
.refer-bonus-modal-content,
.mock-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  padding: 24px;
  transform: translateY(12px);
  transition: transform var(--transition-md), opacity var(--transition-md);
  box-sizing: border-box;
}

.modal::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.modal-card::-webkit-scrollbar,
.glass-modal::-webkit-scrollbar,
.confirm-modal-content::-webkit-scrollbar,
.support-modal::-webkit-scrollbar,
.ai-chat-modal::-webkit-scrollbar,
.exam-hub-modal-card::-webkit-scrollbar,
.my-courses-modal-content::-webkit-scrollbar,
.play-quiz-modal-content::-webkit-scrollbar,
.nexus-ai-modal-content::-webkit-scrollbar,
.refer-bonus-modal-content::-webkit-scrollbar,
.mock-modal-box::-webkit-scrollbar {
  width: 6px;
}

.modal::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track,
.modal-card::-webkit-scrollbar-track,
.glass-modal::-webkit-scrollbar-track,
.confirm-modal-content::-webkit-scrollbar-track,
.support-modal::-webkit-scrollbar-track,
.ai-chat-modal::-webkit-scrollbar-track,
.exam-hub-modal-card::-webkit-scrollbar-track,
.my-courses-modal-content::-webkit-scrollbar-track,
.play-quiz-modal-content::-webkit-scrollbar-track,
.nexus-ai-modal-content::-webkit-scrollbar-track,
.refer-bonus-modal-content::-webkit-scrollbar-track,
.mock-modal-box::-webkit-scrollbar-track {
  background: transparent;
}

.modal::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb,
.glass-modal::-webkit-scrollbar-thumb,
.confirm-modal-content::-webkit-scrollbar-thumb,
.support-modal::-webkit-scrollbar-thumb,
.ai-chat-modal::-webkit-scrollbar-thumb,
.exam-hub-modal-card::-webkit-scrollbar-thumb,
.my-courses-modal-content::-webkit-scrollbar-thumb,
.play-quiz-modal-content::-webkit-scrollbar-thumb,
.nexus-ai-modal-content::-webkit-scrollbar-thumb,
.refer-bonus-modal-content::-webkit-scrollbar-thumb,
.mock-modal-box::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

.modal-overlay.open .modal,
.modal-overlay.active .modal,
.modal-overlay[style*="display: flex"] .modal,
.modal-overlay[style*="display:flex"] .modal,
.modal-overlay.open .modal-content,
.modal-overlay.active .modal-content,
.modal-overlay[style*="display: flex"] .modal-content,
.modal-overlay[style*="display:flex"] .modal-content,
.modal-overlay.open .modal-card,
.modal-overlay.active .modal-card,
.modal-overlay[style*="display: flex"] .modal-card,
.modal-overlay[style*="display:flex"] .modal-card,
.modal-overlay.open .glass-modal,
.modal-overlay.active .glass-modal,
.modal-overlay[style*="display: flex"] .glass-modal,
.modal-overlay[style*="display:flex"] .glass-modal,
.portal-modal-overlay.open .modal-card,
.portal-modal-overlay.active .modal-card,
.portal-modal-overlay[style*="display: flex"] .modal-card,
.portal-modal-overlay[style*="display:flex"] .modal-card,
.portal-modal-overlay.open .confirm-modal-content,
.portal-modal-overlay.active .confirm-modal-content,
.portal-modal-overlay[style*="display: flex"] .confirm-modal-content,
.portal-modal-overlay[style*="display:flex"] .confirm-modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.modal-title { font-size: 17px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  padding: 2px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  justify-content: flex-end;
}

/* ══════════════════════════════════════════════════════════════
   10. TOASTS / ALERTS
══════════════════════════════════════════════════════════════ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  border-left: 3px solid;
}

.alert-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success);
}
.alert-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}
.alert-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning);
}
.alert-info {
  background: var(--info-soft);
  color: var(--info);
  border-color: var(--info);
}

/* Toast container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  animation: toastIn 0.2s ease;
}

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

/* ══════════════════════════════════════════════════════════════
   11. APP SHELL — SIDEBAR + TOPBAR
══════════════════════════════════════════════════════════════ */

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

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.topbar-brand img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.topbar-spacer { flex: 1; }

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

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

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  min-height: var(--topbar-height);
}

.sidebar-brand img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.nav-item i,
.nav-item .ri {
  width: 18px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

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

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

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding: 14px 12px 4px;
}

/* Main content area with sidebar */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  flex-shrink: 0;
  width: var(--sidebar-width);
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-content {
  flex: 1;
  padding: clamp(16px, 2.5vw, 28px);
  max-width: 1400px;
}

/* ══════════════════════════════════════════════════════════════
   12. AUTH SHELL
══════════════════════════════════════════════════════════════ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 5vw, 36px);
  box-shadow: var(--shadow-md);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  text-decoration: none;
}

.auth-logo img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.auth-logo span {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.auth-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.auth-subheading {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 12px;
  margin: 4px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--primary);
  font-weight: 500;
}

/* OTP Input Group */
.otp-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.otp-input {
  width: 48px;
  height: 52px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.otp-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ══════════════════════════════════════════════════════════════
   13. THEME TOGGLE BUTTON
══════════════════════════════════════════════════════════════ */

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition);
  font-size: 15px;
}

.theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

/* Hide/show sun or moon based on theme */
.icon-sun  { display: none; }
.icon-moon { display: block; }

[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ══════════════════════════════════════════════════════════════
   14. AVATAR
══════════════════════════════════════════════════════════════ */

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

.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 40px; height: 40px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 80px; height: 80px; }

.avatar-placeholder {
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   15. TABS
══════════════════════════════════════════════════════════════ */

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

.tab-btn {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ══════════════════════════════════════════════════════════════
   16. EMPTY / LOADING STATES
══════════════════════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state i,
.empty-state .ri {
  font-size: 40px;
  opacity: 0.4;
  margin-bottom: 12px;
  display: block;
}

.empty-state h4 { font-size: 16px; margin-bottom: 6px; color: var(--text); }
.empty-state p  { font-size: 14px; }

/* Skeleton / shimmer */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-soft) 25%,
    var(--border) 50%,
    var(--surface-soft) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ══════════════════════════════════════════════════════════════
   17. MOBILE DRAWER / BOTTOM NAV
══════════════════════════════════════════════════════════════ */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: calc(var(--z-sidebar) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-md);
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Mobile bottom navigation */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: var(--z-topbar);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-inner {
  display: flex;
  height: 60px;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  transition: color var(--transition);
}

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

/* ══════════════════════════════════════════════════════════════
   18. GRID / LAYOUT UTILITIES
══════════════════════════════════════════════════════════════ */

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.flex       { display: flex; }
.flex-col   { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2      { gap: 8px; }
.gap-3      { gap: 12px; }
.gap-4      { gap: 16px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Progress bar */
.progress-bar-track {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

/* ══════════════════════════════════════════════════════════════
   19. ANIMATIONS
══════════════════════════════════════════════════════════════ */

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.25s ease; }

/* ══════════════════════════════════════════════════════════════
   20. RESPONSIVE BREAKPOINTS
══════════════════════════════════════════════════════════════ */

/* Tablet: <= 1024px — sidebar collapses */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .app-sidebar {
    width: 0;
    position: fixed;
  }

  .app-content {
    padding: clamp(14px, 3vw, 20px);
  }

  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile: <= 768px */
@media (max-width: 768px) {
  .bottom-nav { display: block; }

  .app-content {
    padding: 14px 14px calc(60px + 14px);
  }

  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal { padding: 20px; }

  .topbar-actions .btn-secondary { display: none; }

  .card-lg { padding: 18px; }
  .card    { padding: 14px 16px; }
}

/* Small mobile: <= 480px */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .otp-inputs { gap: 6px; }
  .otp-input  { width: 42px; height: 46px; font-size: 18px; }
  .auth-card  { padding: 20px; }
}

/* ══════════════════════════════════════════════════════════════
   21. OVERRIDE OLD NEXUS/CYBER/ORB STYLES
   Neutralize conflicting legacy rules from custom.css / nexus_auth.css
══════════════════════════════════════════════════════════════ */

/* Kill decorative orb pseudo-elements */
body.nexus-auth-body::before,
body.nexus-auth-body::after,
body.dashboard-body::before,
body.dashboard-body::after,
body.admin-body::before,
body.admin-body::after {
  display: none !important;
}

/* Kill old Orbitron font imports usage */
.orbitron, [class*="orbitron"] {
  font-family: 'Inter', sans-serif !important;
}

/* Kill heavy card nesting / glassmorphism */
.glass-card, .glass, [class*="glass"] {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Remove excessive gradient backgrounds inline */
[style*="radial-gradient(circle"] {
  background: var(--bg) !important;
}

/* Normalize old color variables to new system */
:root {
  /* backward compat aliases */
  --bg-color:    var(--bg);
  --text-main:   var(--text);
  --card-bg:     var(--surface);
  --card-border: var(--border);
  --error:       var(--danger);
}
