/* ==========================================================================
   CAMSCHOOL TEACHER PORTAL - COMPLETE RESPONSIVE DESIGN SYSTEM
   Graphic Chart: Obsidian Slate Navy (Dark) & Clean White (Light) + Emerald Accents
   Compatible with all Screens (Desktop, Tablet, Mobile) & CamSchool Admin Console
   ========================================================================== */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap');

/* ==========================================================================
   1. THEME VARIABLES (LIGHT & DARK MODES)
   ========================================================================== */
:root {
  /* Brand Emerald Primary Colors */
  --brand-primary: #10b981;
  --brand-primary-hover: #059669;
  --brand-primary-dark: #047857;
  --brand-primary-light: #34d399;
  --brand-primary-subtle: #d1fae5;
  --brand-emerald-glow: rgba(16, 185, 129, 0.25);
  --brand-emerald-subtle: rgba(16, 185, 129, 0.12);
  --brand-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --brand-gradient-glow: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(5, 150, 105, 0.12));

  /* Light Theme (White Mode) */
  --bg-page: #f8fafc;
  --bg-body-gradient: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  --bg-surface: #ffffff;
  --bg-surface-glass: rgba(255, 255, 255, 0.92);
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-card-inner: #f1f5f9;
  --bg-input: #ffffff;

  --border-color: #e2e8f0;
  --border-card: #e2e8f0;
  --border-input: #cbd5e1;
  --border-focus: #10b981;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
  --shadow-card-hover: 0 20px 30px -10px rgba(0, 0, 0, 0.08);
  --shadow-modal: 0 25px 60px -12px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.2);

  --modal-backdrop: rgba(15, 23, 42, 0.7);
  --modal-bg: #ffffff;
  --modal-border: #e2e8f0;

  /* Status Tokens */
  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-success-text: #059669;
  --status-success-border: rgba(16, 185, 129, 0.3);

  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-warning-text: #d97706;
  --status-warning-border: rgba(245, 158, 11, 0.3);

  --status-danger-bg: rgba(239, 68, 68, 0.12);
  --status-danger-text: #dc2626;
  --status-danger-border: rgba(239, 68, 68, 0.3);

  --status-info-bg: rgba(37, 99, 235, 0.12);
  --status-info-text: #2563eb;
  --status-info-border: rgba(37, 99, 235, 0.3);

  --status-purple-bg: rgba(139, 92, 246, 0.12);
  --status-purple-text: #7c3aed;
  --status-purple-border: rgba(139, 92, 246, 0.3);

  /* Legacy Compatibility Mappings */
  --page-bg: var(--bg-page);
  --surface: var(--bg-surface);
  --card: var(--bg-card);
  --card-border: var(--border-card);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --control-bg: var(--bg-input);
  --control-border: var(--border-input);
  --accent: var(--brand-primary);
  --accent-blue: #2563eb;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-orange: #f59e0b;
  --accent-purple: #8b5cf6;
  --accent-glow: var(--brand-emerald-glow);
  --shadow: var(--shadow-card);
  --hover-bg: rgba(16, 185, 129, 0.08);
  --hover-border: rgba(16, 185, 129, 0.3);
}

/* ==================== DARK THEME (OBSIDIAN / SLATE NAVY) ==================== */
:root[data-theme="dark"],
:root.dark,
html[data-theme="dark"],
html.dark,
body.dark {
  --bg-page: #0b111e;
  --bg-body-gradient: radial-gradient(circle at 10% 20%, #111e38 0%, #0b111e 60%, #070b14 100%);
  --bg-surface: #0d1527;
  --bg-surface-glass: rgba(13, 21, 39, 0.92);
  --bg-card: #111c30;
  --bg-card-hover: #16243d;
  --bg-card-inner: #090f1d;
  --bg-input: #080d19;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.09);
  --border-input: #1e293b;
  --border-focus: #10b981;

  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(255, 255, 255, 0.05);
  --shadow-card-hover: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 15px rgba(16, 185, 129, 0.1);
  --shadow-modal: 0 30px 70px rgba(0, 0, 0, 0.85), 0 0 35px rgba(16, 185, 129, 0.15);
  --shadow-glow: 0 0 30px rgba(16, 185, 129, 0.25);

  --modal-backdrop: rgba(3, 8, 20, 0.85);
  --modal-bg: #0d1527;
  --modal-border: rgba(255, 255, 255, 0.12);

  /* Status Tokens Dark */
  --status-success-bg: rgba(16, 185, 129, 0.15);
  --status-success-text: #34d399;
  --status-success-border: rgba(16, 185, 129, 0.35);

  --status-warning-bg: rgba(245, 158, 11, 0.15);
  --status-warning-text: #fbbf24;
  --status-warning-border: rgba(245, 158, 11, 0.35);

  --status-danger-bg: rgba(239, 68, 68, 0.15);
  --status-danger-text: #f87171;
  --status-danger-border: rgba(239, 68, 68, 0.35);

  --status-info-bg: rgba(37, 99, 235, 0.15);
  --status-info-text: #60a5fa;
  --status-info-border: rgba(37, 99, 235, 0.35);

  --status-purple-bg: rgba(139, 92, 246, 0.15);
  --status-purple-text: #a78bfa;
  --status-purple-border: rgba(139, 92, 246, 0.35);

  --hover-bg: rgba(255, 255, 255, 0.05);
  --hover-border: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   2. BASE & RESET
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  font-family: 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-primary);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg-body-gradient);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Dashboard Lock Mode (Desktop fixed viewport) */
@media (min-width: 1024px) {
  html.dashboard-mode,
  html.dashboard-mode body,
  body.dashboard-mode {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
  }
}

body.auth-mode {
  overflow-y: auto !important;
  position: static !important;
  min-height: 100vh;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-surface);
}
::-webkit-scrollbar-thumb {
  background: var(--border-input);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--brand-primary);
}

/* ==========================================================================
   3. TOPBAR HEADER
   ========================================================================== */
.topbar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1000 !important;
  height: 72px;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-surface-glass);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all 0.25s ease;
}

body.auth-mode .topbar {
  display: none !important;
}

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

.mobile-menu-btn {
  display: none;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 18px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-icon-box img,
.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand-primary);
  letter-spacing: 0.02em;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--border-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb .sep {
  color: var(--text-muted);
  opacity: 0.5;
  font-size: 11px;
}

.breadcrumb .crumb {
  color: var(--text-primary);
  font-weight: 600;
}

.breadcrumb .crumb.link {
  color: var(--brand-primary);
  cursor: pointer;
}

.breadcrumb .crumb.link:hover {
  text-decoration: underline;
}

/* Controls & Status Pills */
.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--status-success-bg);
  border: 1px solid var(--status-success-border);
  color: var(--status-success-text);
  font-size: 12px;
  font-weight: 700;
}

.pulse-dot-green,
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  display: inline-block;
  animation: pulseGreen 2s infinite;
}

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

.theme-switch-btn,
#themeToggle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}

.theme-switch-btn:hover,
#themeToggle:hover {
  border-color: var(--brand-primary);
  transform: translateY(-1px);
}

.utility-select,
#langToggle {
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

/* ==========================================================================
   4. DASHBOARD CONTAINER & SIDEBAR (DESKTOP)
   ========================================================================== */
.app-container {
  min-height: 100vh;
  width: 100%;
}

#app.dashboard-full,
.dashboard {
  display: flex;
  width: 100%;
  min-height: 100vh;
  padding-top: 72px;
  background: var(--bg-page);
}

.sidebar {
  width: 280px;
  min-width: 280px;
  height: calc(100vh - 72px);
  position: sticky;
  top: 72px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 40;
  padding: 16px 12px;
  transition: all 0.3s ease;
}

.sidebar-section-title {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 14px 12px 6px 12px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.nav-btn .nav-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-btn:hover .nav-icon {
  color: var(--brand-primary);
}

/* Active Nav Button with Emerald Pill */
.nav-btn.active {
  background: var(--brand-gradient-glow) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  border-left: 4px solid var(--brand-primary) !important;
  color: var(--brand-primary-light) !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.nav-btn.active .nav-icon {
  color: var(--brand-primary) !important;
}

/* Sidebar User Footer */
.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: 8px;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
}

.user-box .avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--status-success-bg);
  border: 2px solid var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: var(--brand-primary);
  flex-shrink: 0;
  overflow: hidden;
}

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

.user-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-meta #userName,
.user-meta #mobileUserName {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta #userRole,
.user-meta #mobileUserRole {
  font-size: 11.5px;
  color: var(--brand-primary);
  font-weight: 600;
}

/* ==========================================================================
   5. CONTENT WRAPPER & MAIN CONTAINER
   ========================================================================== */
.content {
  flex: 1;
  min-width: 0;
  height: calc(100vh - 72px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 36px 60px 36px;
  background: var(--bg-page);
  position: relative;
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

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

/* ==========================================================================
   6. BANNERS & NOTIFICATIONS
   ========================================================================== */
.impact-banner,
.welcome-banner,
.info-banner {
  padding: 18px 24px;
  border-radius: 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  transition: all 0.2s ease;
}

.impact-banner.highlight,
.welcome-banner.emerald {
  background: var(--bg-card);
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.08);
}

.impact-banner.highlight strong,
.welcome-banner strong {
  color: var(--brand-primary);
  font-size: 15px;
  display: block;
  margin-bottom: 2px;
}

.impact-banner.highlight span,
.welcome-banner span {
  font-size: 13px;
  color: var(--text-secondary);
}

.info-banner.brand {
  background: var(--bg-card);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.info-banner.warning {
  background: var(--status-warning-bg);
  border: 1px solid var(--status-warning-border);
  color: var(--status-warning-text);
}

/* ==========================================================================
   7. STATS & KPI CARDS GRID (MATCHING SCREENSHOT)
   ========================================================================== */
.insight-row,
.kpi-grid,
.stat-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.insight-card,
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.insight-card:hover,
.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: var(--shadow-card-hover);
}

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

.insight-label,
.stat-card-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.insight-icon,
.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* 4 Thematic Badges */
.icon-badge-emerald, .insight-icon {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
}

.icon-badge-blue {
  background: var(--status-info-bg);
  color: var(--status-info-text);
  border: 1px solid var(--status-info-border);
}

.icon-badge-amber {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border: 1px solid var(--status-warning-border);
}

.icon-badge-purple {
  background: var(--status-purple-bg);
  color: var(--status-purple-text);
  border: 1px solid var(--status-purple-border);
}

.stat-card-value,
.insight-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 10px;
}

.stat-card-sub,
.insight-caption {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

/* ==========================================================================
   8. GENERAL CARDS, GRIDS & LAYOUT
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  transition: all 0.2s ease;
}

.card:hover {
  border-color: rgba(16, 185, 129, 0.3);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

/* Validated Chapter Card Styling (Grayed-out state) */
.chapter-card-validated {
  background: var(--bg-card-inner) !important;
  border-color: rgba(148, 163, 184, 0.35) !important;
  opacity: 0.82;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chapter-card-validated:hover {
  opacity: 1;
  border-color: var(--brand-primary) !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .chapter-card-validated {
  background: rgba(15, 23, 42, 0.45) !important;
  border-color: rgba(71, 85, 105, 0.35) !important;
}

.badge-valid-video {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #059669 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  font-weight: 700;
  border-radius: 8px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

[data-theme="dark"] .badge-valid-video {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

/* ==========================================================================
   9. BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--border-color);
  background: var(--bg-card-inner);
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--brand-gradient) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn.primary:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
  transform: translateY(-2px);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn.ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn.small {
  padding: 7px 14px;
  font-size: 12.5px;
  border-radius: 10px;
}

.btn.danger {
  background: var(--status-danger-bg);
  border-color: var(--status-danger-border);
  color: var(--status-danger-text);
}

.btn.disabled,
.btn:disabled,
.btn-disabled-grey {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

/* ==========================================================================
   10. FORMS & INPUT CONTROLS (UNIVERSAL DESIGN SYSTEM)
   ========================================================================== */
label {
  display: block;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 7px;
}

/* Universal Text/Number/Email/Password/Tel/Select/Textarea Styling */
input:not([type="radio"]):not([type="checkbox"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="reset"]):not([type="button"]),
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="search"],
input[type="url"],
select,
textarea,
.form-input,
.form-control {
  display: block;
  width: 100%;
  box-sizing: border-box !important;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Radio & Checkbox Explicit Styling */
input[type="radio"],
input[type="checkbox"] {
  display: inline-block !important;
  -webkit-appearance: radio !important;
  -moz-appearance: radio !important;
  appearance: radio !important;
  cursor: pointer !important;
  accent-color: var(--brand-primary, #10b981) !important;
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  margin: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
  vertical-align: middle !important;
  opacity: 1 !important;
  visibility: visible !important;
}

input[type="checkbox"] {
  -webkit-appearance: checkbox !important;
  -moz-appearance: checkbox !important;
  appearance: checkbox !important;
}

/* Custom Select Dropdown with Clean SVG Chevron */
select,
select.form-input,
select.form-control {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 15px;
  padding-right: 42px !important;
  cursor: pointer;
}

[data-theme="dark"] select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2334d399' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

/* Placeholder Styling */
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
}

/* Hover States */
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]):not([type="range"]):not([type="color"]):hover,
select:hover,
textarea:hover,
.form-input:hover,
.form-control:hover {
  border-color: var(--brand-primary-light);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
}

/* Focus States (Emerald Glow) */
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]):not([type="range"]):not([type="color"]):focus,
select:focus,
textarea:focus,
.form-input:focus,
.form-control:focus {
  border-color: var(--brand-primary) !important;
  background: var(--bg-surface) !important;
  box-shadow: 0 0 0 4px var(--brand-emerald-glow) !important;
  outline: none !important;
}

/* Disabled State */
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.65 !important;
  cursor: not-allowed !important;
  background-color: var(--bg-card-inner) !important;
  border-color: var(--border-color) !important;
}

/* Textarea Customization */
textarea {
  min-height: 90px;
  resize: vertical;
}

/* File Input Customization (Clean & Premium) */
input[type="file"],
input[type="file"].form-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  background: var(--bg-card-inner);
  border: 1.5px dashed var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--brand-gradient);
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  margin-right: 14px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

input[type="file"]:hover {
  border-color: var(--brand-primary);
  background: var(--bg-card-hover);
}

input[type="file"]:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px var(--brand-emerald-glow);
}

/* Radio & Checkbox Specific Override (Keep Small Inline Box) */
input[type="radio"],
input[type="checkbox"] {
  display: inline-block !important;
  width: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  height: 18px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 4px !important;
  accent-color: var(--brand-primary) !important;
  cursor: pointer !important;
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
  vertical-align: middle;
}

input[type="radio"] {
  border-radius: 50% !important;
}

/* Cascaded Select Loading State */
.select-loading {
  background-color: var(--bg-card-inner) !important;
  opacity: 0.8 !important;
  cursor: wait !important;
  border-color: var(--brand-primary) !important;
  animation: selectPulse 1.4s infinite ease-in-out;
}

@keyframes selectPulse {
  0% { border-color: rgba(16, 185, 129, 0.3); box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2); }
  50% { border-color: rgba(16, 185, 129, 0.85); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15); }
  100% { border-color: rgba(16, 185, 129, 0.3); box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2); }
}

/* Question Builder & Option Styling */
.question-builder-item {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 16px !important;
  padding: 18px !important;
  margin-bottom: 14px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.2s ease;
}

.question-builder-item:hover {
  border-color: rgba(16, 185, 129, 0.35) !important;
}

[data-theme="dark"] .question-builder-item {
  background: rgba(30, 41, 59, 0.5) !important;
  border-color: rgba(71, 85, 105, 0.4) !important;
}



/* Form Upload Area Container */
.upload-area {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 24px;
  margin-top: 24px;
  box-shadow: var(--shadow-sm);
}

.upload-area h4 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.upload-area .upload-tip {
  font-size: 13px;
  margin-bottom: 18px;
}

.upload-area form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row {
  display: flex;
  gap: 14px;
  margin-top: 14px;
}

/* ==========================================================================
   PROFILE VIEW STYLES
   ========================================================================== */
.profile-page-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.profile-hero-main {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.profile-avatar-wrapper {
  position: relative;
  width: 96px;
  height: 96px;
  min-width: 96px;
  min-height: 96px;
  border-radius: 50%;
  padding: 3px;
  background: var(--brand-gradient);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.25);
}

.profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-card-inner);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 36px;
  color: var(--brand-primary);
}

.profile-avatar img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  display: block !important;
}

.profile-avatar-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
}

.profile-hero-details {
  flex: 1;
  min-width: 240px;
}

.profile-hero-name-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-hero-quick-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.btn-copy-code {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.btn-copy-code:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.profile-data-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.profile-field-tile {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-field-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.profile-field-value {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-word;
}

/* ==========================================================================
   QUIZ QUESTION BUILDER STYLES
   ========================================================================== */
.question-builder-item {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.question-builder-item:hover {
  border-color: rgba(16, 185, 129, 0.4);
}

.question-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.question-builder-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.answer-option-row {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  background: var(--bg-card, #ffffff) !important;
  border: 1px solid var(--border-color, #e2e8f0) !important;
  border-radius: 12px !important;
  padding: 8px 14px !important;
  margin-bottom: 10px !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  cursor: pointer;
  position: relative !important;
}

.answer-option-row:hover {
  border-color: rgba(16, 185, 129, 0.45) !important;
  background: rgba(16, 185, 129, 0.03) !important;
}

.answer-option-row:has(input[type="radio"]:checked),
.answer-option-row.is-correct-option {
  border-color: var(--brand-primary, #10b981) !important;
  background: rgba(16, 185, 129, 0.09) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}

.answer-radio-label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  margin: 0 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  user-select: none !important;
  flex-shrink: 0 !important;
}

.option-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 8px !important;
  font-weight: 800 !important;
  font-size: 13px !important;
  background: var(--border-input, #e2e8f0) !important;
  color: var(--text-primary, #1e293b) !important;
  transition: all 0.2s ease !important;
}

.answer-option-row:has(input[type="radio"]:checked) .option-badge,
.answer-option-row.is-correct-option .option-badge {
  background: var(--brand-primary, #10b981) !important;
  color: #ffffff !important;
}

.answer-option-input {
  flex: 1 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 6px 0 !important;
  font-size: 14px !important;
  font-family: inherit !important;
  color: var(--text-primary, #0f172a) !important;
  outline: none !important;
  resize: vertical !important;
  min-height: 44px !important;
  line-height: 1.45 !important;
}

.answer-option-input:focus {
  box-shadow: none !important;
  outline: none !important;
}

.correct-badge-pill {
  display: none !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  color: #059669 !important;
  background: rgba(16, 185, 129, 0.9) !important;
  color: #fff !important;
  border: 1px solid rgba(16, 185, 129, 1) !important;
  padding: 2px 8px !important;
  border-radius: 8px !important;
  white-space: nowrap !important;
  position: absolute !important;
  right: 14px !important;
  bottom: -10px !important;
  z-index: 10 !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.answer-option-row:has(input[type="radio"]:checked) .correct-badge-pill,
.answer-option-row.is-correct-option .correct-badge-pill {
  display: inline-flex !important;
}

/* Question and Justification textareas */
textarea.q-input-text,
textarea.eq-input-text {
  min-height: 72px !important;
  resize: vertical !important;
  line-height: 1.5 !important;
  font-family: inherit !important;
}

textarea.q-justif-input,
textarea.eq-justif-input {
  min-height: 54px !important;
  resize: vertical !important;
  line-height: 1.45 !important;
  font-family: inherit !important;
}

/* ==========================================================================
   11. CLASSES & PEDAGOGICAL FILTER PANEL & CARDS
   ========================================================================== */
.classes-filter-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 22px;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}

.filter-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 260px;
  display: flex;
  align-items: center;
}

.search-icon-symbol {
  position: absolute;
  left: 14px;
  font-size: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.class-search-input {
  padding-left: 42px !important;
  padding-right: 36px !important;
  height: 44px;
  border-radius: 14px !important;
  font-size: 14px !important;
}

.btn-clear-search {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.classes-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.filter-controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.filter-row-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  min-width: 100px;
}

.filter-pill-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--brand-primary);
}

.filter-pill-btn.active {
  background: var(--status-success-bg);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  font-weight: 800;
}

.pill-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.1);
  font-size: 11px;
  font-weight: 800;
}

/* Class Card */
.class-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 20px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.class-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-card-hover);
}

.class-card-top-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 14px;
}

.badge-section,
.badge-type {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.badge-section.fr {
  background: rgba(37, 99, 235, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.badge-section.en {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-type.badge-general {
  background: var(--status-info-bg);
  color: var(--status-info-text);
}

.badge-type.badge-technique {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

.badge-type.badge-concours {
  background: var(--status-success-bg);
  color: var(--status-success-text);
}

.badge-type.badge-superieur {
  background: var(--status-purple-bg);
  color: var(--status-purple-text);
}

.class-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.class-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--brand-emerald-subtle);
  border: 1px solid var(--status-success-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.class-title-wrap {
  display: flex;
  flex-direction: column;
}

.class-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
}

.class-code-tag {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.class-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
}

.class-category-name {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.class-arrow-btn {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand-primary);
}

/* Course & Chapter Cards */
.course-card,
.chapter-card {
  border-radius: 20px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.course-card:hover,
.chapter-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-card-hover);
}

/* ==========================================================================
   12. QUIZZES & QUESTION BUILDER
   ========================================================================== */
.quizzes-view,
.epreuves-view,
.wallet-view,
.students-view,
.forum-view,
.live-validations-view {
  width: 100%;
}

/* Forum Subject Filter Toolbar & Pills System */
.forum-filter-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.forum-subject-pills-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.forum-subject-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--bg-card-inner);
  color: var(--text-secondary);
  border: 1.5px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  white-space: nowrap;
}

.forum-subject-pill:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--brand-emerald-subtle);
  transform: translateY(-1px);
}

.forum-subject-pill.active {
  background: var(--brand-gradient) !important;
  color: #ffffff !important;
  border-color: var(--brand-primary) !important;
  box-shadow: 0 4px 12px var(--brand-emerald-glow) !important;
  transform: translateY(-1px);
}

.forum-subject-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
}

.forum-subject-pill.active .forum-subject-pill-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.forum-post-card {
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  background: var(--bg-card);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.forum-post-card:hover {
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: var(--shadow-card-hover);
}

.forum-subject-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent-blue, #2563eb);
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.question-block {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  position: relative;
}

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

.question-number-badge {
  font-size: 12.5px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border: 1px solid var(--status-warning-border);
}

.answer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.answer-item input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

/* ==========================================================================
   13. TABLES & RESPONSIVE CONTAINERS
   ========================================================================== */
.table-wrapper,
.pricing-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 600px;
}

thead {
  background: var(--bg-card-inner);
  border-bottom: 1px solid var(--border-color);
}

th {
  padding: 14px 18px;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

td {
  padding: 14px 18px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

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

tr:hover td {
  background: var(--bg-card-hover);
}

/* Badges & Status Pills */
.badge-pill,
.badge-op,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-credit,
.status-done,
.badge-pill.success,
.text-success {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
}

.status-pending,
.badge-pill.warning {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border: 1px solid var(--status-warning-border);
}

.badge-debit,
.status-rejected,
.badge-pill.danger {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border: 1px solid var(--status-danger-border);
}

/* ==========================================================================
   14. ALL POPUPS & MODALS (DARK & LIGHT THEMES)
   ========================================================================== */
.modal-overlay,
.privacy-modal,
.teacher-earnings-welcome-overlay,
.express-action-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--modal-backdrop);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open,
.modal-overlay.active,
.modal-overlay[style*="display: flex"],
.privacy-modal.open,
.privacy-modal[style*="display: flex"],
.teacher-earnings-welcome-overlay.open,
.teacher-earnings-welcome-overlay[style*="display: flex"],
.express-action-modal-overlay.open,
.express-action-modal-overlay[style*="display: flex"] {
  display: flex !important;
  opacity: 1;
}

.modal-container,
.privacy-modal-container,
.teacher-earnings-welcome-card,
.express-action-modal-card {
  position: relative;
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  background: var(--modal-bg);
  border: 1px solid var(--modal-border);
  border-radius: 24px;
  box-shadow: var(--shadow-modal);
  padding: 28px 32px;
  overflow-y: auto;
  color: var(--text-primary);
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from { transform: scale(0.95) translateY(14px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header,
.privacy-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  gap: 16px;
}

.modal-title-group,
.privacy-modal-title-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-icon-badge,
.privacy-modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--brand-emerald-subtle);
  border: 1px solid var(--status-success-border);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.modal-title,
.privacy-modal-title-box h2,
.tew-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.modal-subtitle,
.privacy-modal-subtitle,
.tew-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-close-modal,
.privacy-close-btn,
.btn-close-privacy {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-close-modal:hover,
.privacy-close-btn:hover,
.btn-close-privacy:hover {
  color: var(--text-primary);
  border-color: var(--brand-primary);
}

/* Legal Modal Tabs & Articles */
.legal-modal-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.legal-tab-btn {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.legal-tab-btn.active {
  background: var(--status-success-bg);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.privacy-modal-search-bar {
  margin-bottom: 16px;
}

.privacy-quick-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.privacy-tag-btn {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
}

.privacy-tag-btn.active {
  background: var(--brand-emerald-subtle);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  font-weight: 700;
}

.privacy-article {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 14px;
}

.privacy-article.highlight-article {
  border-color: rgba(16, 185, 129, 0.4);
  background: var(--brand-emerald-subtle);
}

.privacy-article.highlight-bottom-clause {
  border: 2px solid var(--brand-primary);
  background: rgba(16, 185, 129, 0.1);
}

.special-clause-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-gradient);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 800;
  margin-bottom: 10px;
}

.privacy-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

/* Teacher Earnings Welcome Modal Grid */
.tew-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.tew-rate-card {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tew-rate-card.video { border-color: rgba(16, 185, 129, 0.35); }
.tew-rate-card.quiz { border-color: rgba(245, 158, 11, 0.35); }
.tew-rate-card.epreuve { border-color: rgba(99, 102, 241, 0.35); }

.tew-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.tew-step-item {
  background: var(--bg-card-inner);
  padding: 14px;
  border-radius: 12px;
  font-size: 12.5px;
}

/* ==========================================================================
   15. SUPPORT & TICKETS CENTER
   ========================================================================== */
.support-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 22px;
  padding: 24px;
  margin-bottom: 24px;
}

.support-channels-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.support-channel-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.support-channel-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-primary);
}

.channel-icon {
  font-size: 26px;
}

.channel-meta strong {
  display: block;
  font-size: 14px;
}

.channel-meta span {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
}

.channel-action {
  color: var(--brand-primary) !important;
  font-weight: 700;
  margin-top: 2px;
}

.support-main-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.support-tab-btn {
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-card-inner);
  color: var(--text-secondary);
  font-weight: 700;
  cursor: pointer;
}

.support-tab-btn.active {
  background: var(--brand-gradient);
  color: #ffffff;
  border-color: transparent;
}

.support-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* ==========================================================================
   16. AUTH LAYOUT (LOGIN & REGISTER)
   ========================================================================== */
.auth-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 100vh;
  width: 100%;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 30px;
  background: var(--bg-page);
}

.auth-panel-inner {
  width: 100%;
  max-width: 480px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 26px;
  padding: 36px 32px;
  box-shadow: var(--shadow-card);
}

.auth-card h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.value-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.value-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
}

.auth-hero {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  position: relative;
  overflow: hidden;
}

.hero-content {
  max-width: 460px;
  text-align: center;
  position: relative;
  z-index: 2;
}

.hero-logo-ring {
  width: 86px;
  height: 86px;
  margin: 0 auto 24px auto;
  border-radius: 26px;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: #042f1a;
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.4);
}

.hero-pill {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--status-success-bg);
  border: 1px solid var(--status-success-border);
  color: var(--brand-primary);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 16px;
}

.hero-content h2 {
  font-size: 32px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.8px;
  margin-bottom: 12px;
}

.hero-content p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   17. MOBILE OFF-CANVAS DRAWER
   ========================================================================== */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(3, 8, 20, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu.show {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-inner {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
}

.mobile-menu.show .mobile-menu-inner {
  transform: translateX(0);
}

.mobile-close {
  align-self: flex-end;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 14px;
}

.mobile-nav .nav-btn {
  padding: 12px 14px;
  font-size: 14px;
}

.mobile-controls {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  margin-top: 16px;
}

/* ==========================================================================
   18. GLOBAL LOADER
   ========================================================================== */
.global-loader {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: var(--modal-backdrop);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.global-loader.is-active,
.global-loader.active {
  display: flex !important;
  opacity: 1;
}

.global-loader-panel {
  background: var(--modal-bg);
  border: 1px solid var(--modal-border);
  border-radius: 20px;
  padding: 28px 36px;
  text-align: center;
  box-shadow: var(--shadow-modal);
  max-width: 400px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3.5px solid var(--brand-emerald-subtle);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px auto;
}

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

.loader-main {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.loader-tip {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ==========================================================================
   19. RESPONSIVE BREAKPOINTS (DESKTOP, TABLETS, PHONES)
   ========================================================================== */

/* Tablet & Laptop Medium (<= 1199px) */
@media (max-width: 1199px) {
  .insight-row,
  .kpi-grid,
  .stat-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .tew-grid,
  .tew-guide-grid {
    grid-template-columns: 1fr;
  }
}

/* Tablet (<= 1023px) - Activate Hamburger & Slide Drawer */
@media (max-width: 1023px) {
  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar {
    display: none !important;
  }

  .content {
    padding: 20px 20px 60px 20px;
    height: auto;
    min-height: calc(100vh - 72px);
  }

  #app.dashboard-full,
  .dashboard {
    height: auto;
    overflow-y: auto;
  }

  .topbar {
    padding: 0 16px;
  }

  .breadcrumb {
    display: none;
  }

  .user-status-pill {
    max-width: 130px;
  }

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    display: none !important;
  }

  .support-channels-grid {
    grid-template-columns: 1fr;
  }

  .support-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile Devices (<= 767px) */
@media (max-width: 767px) {
  .topbar {
    height: 64px;
    min-height: 64px;
    padding: 0 12px;
  }

  #app.dashboard-full,
  .dashboard {
    padding-top: 64px;
  }

  .brand-title {
    font-size: 15px;
  }

  .brand-sub {
    font-size: 10px;
  }

  .api-status-pill {
    display: none;
  }

  .user-status-pill {
    display: none;
  }

  .content {
    padding: 16px 14px 50px 14px;
  }

  .page-title {
    font-size: 22px;
  }

  .insight-row,
  .kpi-grid,
  .stat-grid-4 {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .stat-card-value,
  .insight-value {
    font-size: 24px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .row {
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
  }

  .classes-filter-panel {
    padding: 16px;
  }

  .modal-container,
  .privacy-modal-container,
  .teacher-earnings-welcome-card,
  .express-action-modal-card {
    padding: 20px 16px;
    max-width: 95vw;
    border-radius: 20px;
  }

  .auth-panel {
    padding: 24px 16px;
  }

  .auth-card {
    padding: 24px 20px;
    border-radius: 20px;
  }
}

/* Small Phones (<= 480px) */
@media (max-width: 480px) {
  .btn {
    padding: 8px 14px;
    font-size: 12.5px;
  }

  .modal-header,
  .privacy-modal-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn-close-modal,
  .privacy-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
  }
}

/* ==========================================================================
   REJECTION ACTION CENTER & PDF VIEWER ENHANCEMENTS
   ========================================================================== */
.badge-tab-rejection,
.badge-rejection-pill {
  animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.btn-view-pdf-popup {
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.btn-view-pdf-popup:hover {
  transform: translateY(-1px);
}

/* ==========================================================================
   LIVE FEED CARDS (VALIDATIONS & GAINS)
   ========================================================================== */
.live-feed-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.live-feed-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  gap: 16px;
}

.live-feed-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
  border-color: var(--brand-primary-light);
}

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

.live-feed-avatar-wrap {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--accent-blue, #2563eb) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

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

.live-feed-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.live-feed-title {
  font-weight: 700;
  color: var(--text-color);
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-feed-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.live-feed-badge {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-epreuve {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.badge-quiz {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.badge-video {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

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

.live-feed-amount {
  font-weight: 800;
  color: var(--brand-primary);
  font-size: 15px;
  background: rgba(16, 185, 129, 0.08);
  padding: 4px 10px;
  border-radius: 8px;
}

.live-feed-time {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

@media (max-width: 500px) {
  .live-feed-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .live-feed-right {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
  }
}