/**
 * AFASASLAK?! (أَفَصَّصْلَك?!) - Main Application Styles
 * Layout, Dual-Logo CSS Switching, Glassmorphism, Bilingual RTL/LTR
 */

@import './tokens.css';
@import './animations.css';

/* Import High-Grade Web Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Tajawal:wght@400;500;700;800&family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,600&family=JetBrains+Mono:wght@400;500;600&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  scroll-behavior: smooth;
  font-size: 15px;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

html[dir="rtl"],
html[lang="ar"] {
  font-family: 'Cairo', 'Tajawal', sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: clip;
  position: relative;
}

/* ==========================================================================
   DUAL-LOGO ZERO-FLICKER SWITCHING SYSTEM
   Zero background/borders, zero box-shadow or clipping artifacts
   ========================================================================== */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  outline: none;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0;
  margin: 0;
}

.brand-logo-wrapper {
  display: inline-flex;
  align-items: center;
  position: relative;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.brand-logo .logo-img {
  height: 38px;
  width: auto;
  max-width: 165px;
  object-fit: contain;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
  user-select: none;
  flex-shrink: 0;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  border-radius: 0 !important;
  filter: none !important;
  clip-path: none !important;
}

.brand-logo:hover .logo-img {
  transform: none;
}

/* Exact Light vs Dark Display Rules */
html[data-theme="light"] .logo-light {
  display: block !important;
  visibility: visible !important;
  mix-blend-mode: multiply !important;
}
html[data-theme="light"] .logo-dark {
  display: none !important;
  visibility: hidden !important;
}

html[data-theme="dark"] .logo-light {
  display: none !important;
  visibility: hidden !important;
}
html[data-theme="dark"] .logo-dark {
  display: block !important;
  visibility: visible !important;
  mix-blend-mode: lighten !important;
}

/* ==========================================================================
   PUBLICATION-GRADE MATHEMATICAL TYPOGRAPHY (Zero-FOUC Math Rendering)
   ========================================================================== */
.math-fraction {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  margin: 0 4px;
}
.math-fraction .math-num {
  border-bottom: 1.5px solid currentColor;
  padding: 0 4px 2px 4px;
  line-height: 1.15;
  display: block;
}
.math-fraction .math-den {
  padding: 2px 4px 0 4px;
  line-height: 1.15;
  display: block;
}
.math-sqrt-bar {
  border-top: 1.2px solid currentColor;
  padding-top: 1px;
  margin-left: 1px;
  display: inline-block;
}

/* ==========================================================================
   APP SHELL & LAYOUT ARCHITECTURE
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* Sidebar Navigation */
.app-sidebar {
  width: 260px;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-glass);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  border-right: 1px solid var(--surface-card-border);
  padding: 24px 18px;
  z-index: 90;
  flex-shrink: 0;
  transition: width var(--transition-smooth), transform var(--transition-smooth), background var(--transition-normal);
}

html[dir="rtl"] .app-sidebar {
  border-right: none;
  border-left: 1px solid var(--surface-card-border);
}

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

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

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

.nav-link svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  flex-shrink: 0;
}

.nav-link:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  transform: none;
}

html[dir="rtl"] .nav-link:hover {
  transform: none;
}

.nav-link.active {
  background: var(--surface-card);
  color: var(--emerald-mortarboard);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--surface-card-border);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--emerald-mortarboard);
}

html[dir="rtl"] .nav-link.active::before {
  left: auto;
  right: 0;
  border-radius: 4px 0 0 4px;
}

/* User Card in Sidebar Bottom */
.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--surface-card-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-card-border);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--emerald-mortarboard), var(--gold-accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.user-role-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Main Viewport Container */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-primary);
  position: relative;
}

/* ==========================================================================
   SEAMLESS FLOATING GLASS HUD TOPBAR & UNIFIED CONTROL PILL
   ========================================================================== */
/* STRICT LOCKED TOPBAR (NEVER DETACHES OR FLOATS MID-SCREEN) */
.gateway-header {
  height: 60px;
  position: fixed !important;
  top: 0 !important;
  bottom: auto !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100vw !important;
  margin: 0 !important;
  padding: 12px 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px;
  box-sizing: border-box !important;
  overflow: visible !important;
  background: rgba(11, 21, 34, 0.96) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(16, 185, 129, 0.16);
  z-index: 9995 !important;
}

.app-topbar {
  height: 60px;
  position: fixed !important;
  top: 0 !important;
  bottom: auto !important;
  left: 260px !important;
  right: 0 !important;
  width: calc(100% - 260px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 20px;
  gap: 12px;
  box-sizing: border-box !important;
  overflow: visible !important;
  background: rgba(11, 21, 34, 0.96) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(16, 185, 129, 0.16);
  z-index: 9995 !important;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

html[dir="rtl"] .app-topbar {
  left: 0 !important;
  right: 260px !important;
}

@media (max-width: 1024px) {
  .app-topbar {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 56px !important;
  }
  .gateway-header {
    height: 56px !important;
  }
}

@media (max-width: 640px) {
  .app-topbar,
  .gateway-header {
    height: 52px !important;
  }
}

[data-theme="light"] .app-topbar,
[data-theme="light"] .gateway-header {
  background: rgba(248, 250, 252, 0.95) !important;
  border-bottom: 1px solid rgba(16, 185, 129, 0.16);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-inline-start: auto;
  flex-wrap: nowrap;
  overflow: visible !important;
  position: relative;
  z-index: 9991 !important;
}

/* Unified Glass Utility Pill (Language, Theme, Social) */
.hud-control-pill,
.hud-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  overflow: visible !important;
  position: relative;
  z-index: 9992 !important;
}

.hud-control-pill .hud-divider {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 1px;
  flex-shrink: 0;
}

[data-theme="light"] .hud-control-pill .hud-divider {
  background: rgba(15, 23, 42, 0.14);
}

[data-theme="light"] .hud-control-pill,
[data-theme="light"] .hud-pill {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

/* Language Capsule Inside Unified Pill */
.hud-control-pill .lang-dropdown-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  overflow: visible !important;
  z-index: 9999 !important;
}

.hud-control-pill .lang-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 8px;
  background: transparent;
  border: none;
  border-radius: 999px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  box-shadow: none;
  transition: all var(--transition-fast);
  user-select: none;
}

.hud-control-pill .lang-dropdown-btn:hover {
  color: #10B981;
  background: rgba(16, 185, 129, 0.08);
  transform: none;
  box-shadow: none;
}

/* Clean Borderless 30px × 30px Utility Icons (Theme & Instagram) */
.hud-control-pill .hud-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: none;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.hud-control-pill .hud-icon-btn:hover {
  color: #10B981;
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
  transform: none;
}

/* Compact Low-Profile Emerald Glass "For Teachers" Pill */
.for-teachers-pill {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.28);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.for-teachers-pill:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34D399;
  transform: none;
}

/* Compact Sign In Pill on Landing Page */
.nav-signin-pill {
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .app-topbar,
  .gateway-header {
    height: 56px !important;
    padding: 0 14px !important;
    gap: 8px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .topbar-left {
    gap: 8px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .brand-logo .logo-img {
    height: 32px !important;
    max-width: 130px !important;
    flex-shrink: 0 !important;
  }

  .topbar-right {
    gap: 6px !important;
    flex-shrink: 0 !important;
    overflow: visible !important;
  }
}

@media (max-width: 640px) {
  .app-topbar,
  .gateway-header {
    height: 52px !important;
    padding: 8px 12px !important;
    gap: 6px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .topbar-left {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  /* Protect Brand Logo: Keep crisp on mobile */
  .brand-logo .logo-img {
    height: 26px !important;
    width: auto !important;
    max-width: 95px !important;
    flex-shrink: 0 !important;
  }

  .topbar-right {
    gap: 4px !important;
    flex-shrink: 0 !important;
    margin-inline-start: auto !important;
    display: flex !important;
    align-items: center !important;
    overflow: visible !important;
  }

  /* Ultra-compact HUD pill */
  .hud-control-pill,
  .hud-pill {
    padding: 2px 4px !important;
    gap: 2px !important;
    overflow: visible !important;
  }

  .hud-control-pill .lang-dropdown-btn {
    height: 25px !important;
    padding: 0 4px !important;
    font-size: 10.5px !important;
    gap: 2px !important;
  }

  .hud-control-pill .hud-icon-btn,
  .hud-control-pill .social-topbar-btn {
    width: 25px !important;
    height: 25px !important;
  }

  .hud-control-pill .hud-icon-btn svg,
  .hud-control-pill .social-topbar-btn svg {
    width: 13.5px !important;
    height: 13.5px !important;
  }

  .hud-control-pill .hud-divider {
    height: 12px !important;
    margin: 0 1px !important;
  }

  /* Compact "For Teachers" and "Sign In" pills */
  .for-teachers-pill,
  .header-teachers-btn {
    display: inline-flex !important;
    height: 26px !important;
    padding: 0 7px !important;
    font-size: 10px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .nav-signin-pill {
    height: 26px !important;
    padding: 0 8px !important;
    font-size: 10.5px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
}

@media (max-width: 380px) {
  .brand-logo .logo-img {
    height: 22px !important;
    max-width: 80px !important;
  }
  .hud-control-pill {
    padding: 2px 3px !important;
    gap: 1.5px !important;
  }
  .hud-control-pill .hud-icon-btn,
  .hud-control-pill .social-topbar-btn {
    width: 22px !important;
    height: 22px !important;
  }
  .hud-control-pill .hud-icon-btn svg,
  .hud-control-pill .social-topbar-btn svg {
    width: 12px !important;
    height: 12px !important;
  }
  .for-teachers-pill,
  .header-teachers-btn {
    padding: 0 5px !important;
    font-size: 9.5px !important;
  }
  .nav-signin-pill {
    padding: 0 6px !important;
    font-size: 9.5px !important;
  }
}

/* Content Body */
.app-content,
.main-content,
.dashboard-container {
  flex: 1;
  padding-top: 88px !important;
  padding-left: 32px !important;
  padding-right: 32px !important;
  padding-bottom: 32px !important;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box !important;
}

/* ==========================================================================
   INTERACTIVE CANVAS PARTICLES & CURSOR TRAIL
   ========================================================================== */
#interactive-particles {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 50;
}

/* ==========================================================================
   AUTHENTIC STUDENT HANDWRITING SIMULATION (Girl's Organic Ballpoint Ink)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;600;700&family=Kalam:wght@400;700&display=swap');

.student-handwriting {
  font-family: 'Caveat', 'Kalam', cursive, sans-serif;
  color: #1A2838; /* dark ballpoint blue-black */
  text-shadow: 0.15px 0.15px 0.4px rgba(26, 40, 56, 0.35);
  font-size: 1.65rem;
  line-height: 2.1;
  font-weight: 600;
  transform: rotate(-0.8deg);
  letter-spacing: 0.4px;
  user-select: none;
}

.student-handwriting .hw-line {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 3px;
}

.student-handwriting .hw-frac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  padding: 0 4px;
  line-height: 1.15;
}

.student-handwriting .hw-frac .num {
  border-bottom: 1.6px solid #1A2838;
  padding-bottom: 1px;
}

.student-handwriting .hw-frac .den {
  padding-top: 1px;
}

.student-handwriting .hw-tick {
  color: #009E60;
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 1.5rem;
  margin-left: 8px;
  transform: rotate(2deg);
  display: inline-block;
}

/* ==========================================================================
   AUTH TABS - ZERO-STUCK ACTIVE STATE WITH BRAND EMERALD INDICATOR
   ========================================================================== */
.auth-tab {
  flex: 1;
  padding: 12px 14px;
  background: transparent !important;
  border: none !important;
  border-bottom: 3px solid transparent !important;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-secondary) !important;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}

.auth-tab:hover {
  color: var(--text-primary) !important;
}

.auth-tab.active {
  color: var(--emerald-mortarboard) !important;
  border-bottom: 3px solid var(--emerald-mortarboard) !important;
}

/* Icon Buttons (Theme Toggle, Lang Toggle, Mobile Menu) */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-card-border);
  background: var(--surface-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--gold-accent);
  background: var(--bg-secondary);
  transform: translateY(-1px);
}

/* 6-Language Dropdown Capsule & Popover Menu */
.lang-dropdown-wrapper {
  position: relative;
  display: inline-block;
  overflow: visible !important;
  z-index: 9999 !important;
}

.lang-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 13px;
  background: var(--surface-card);
  border: 1px solid var(--surface-card-border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  user-select: none;
}

.lang-dropdown-btn:hover {
  border-color: var(--emerald-mortarboard);
  background: var(--bg-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.lang-dropdown-menu,
.lang-menu,
.lang-dropdown-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  min-width: 150px;
  max-width: calc(100vw - 24px);
  background: #0f172a;
  color: #F8FAFC;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  padding: 6px;
  z-index: 99999 !important;
  display: none;
  flex-direction: column;
  gap: 3px;
  animation: dropdownFadeIn 0.16s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-theme="light"] .lang-dropdown-menu,
[data-theme="light"] .lang-menu,
[data-theme="light"] .lang-dropdown-list {
  background: #ffffff;
  color: #0B1522;
}

[data-theme="dark"] .lang-dropdown-menu,
[data-theme="dark"] .lang-menu,
[data-theme="dark"] .lang-dropdown-list {
  background: #0f172a;
  color: #F8FAFC;
}

html[dir="rtl"] .lang-dropdown-menu,
html[dir="rtl"] .lang-menu,
html[dir="rtl"] .lang-dropdown-list {
  right: auto;
  left: 0;
}

.lang-dropdown-menu.show,
.lang-menu.show,
.lang-dropdown-list.show {
  display: flex !important;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.lang-option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
}

html[dir="rtl"] .lang-option-btn {
  text-align: right;
}

.lang-option-btn:hover {
  background: rgba(16, 185, 129, 0.14);
  color: #10B981;
}

.lang-option-btn.active {
  background: var(--emerald-mortarboard);
  color: #FFFFFF;
}

@media (max-width: 960px) {
  .upload-main-layout {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   PHONE CAMERA QR HANDOFF (UPLOAD.HTML)
   ========================================================================== */
.split-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 22px;
  align-items: stretch;
}

.qr-handoff-card {
  background: var(--bg-secondary);
  border: 1px solid var(--surface-card-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.qr-handoff-card:hover {
  border-color: var(--emerald-mortarboard);
  box-shadow: var(--shadow-sm);
}

.qr-code-wrapper {
  position: relative;
  width: 176px;
  height: 176px;
  margin: 12px auto;
  background: #FFFFFF;
  padding: 10px;
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code-wrapper svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
  border-radius: 4px;
}

.qr-viewfinder-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--emerald-mortarboard);
  border-style: solid;
  pointer-events: none;
}
.qr-tl { top: -4px; left: -4px; border-width: 3px 0 0 3px; border-top-left-radius: 6px; }
.qr-tr { top: -4px; right: -4px; border-width: 3px 3px 0 0; border-top-right-radius: 6px; }
.qr-bl { bottom: -4px; left: -4px; border-width: 0 0 3px 3px; border-bottom-left-radius: 6px; }
.qr-br { bottom: -4px; right: -4px; border-width: 0 3px 3px 0; border-bottom-right-radius: 6px; }

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #F59E0B;
  display: inline-block;
  animation: none !important;
}

@keyframes pulseBeacon {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.paper-received-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface-card);
  border: 1.5px solid var(--emerald-mortarboard);
  border-radius: var(--radius-md);
  margin-top: 14px;
  box-shadow: 0 4px 16px var(--emerald-correct-bg);
  animation: slideDownFade 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* ==========================================================================
   CARDS, BUTTONS & FORM CONTROLS
   ========================================================================== */
.card {
  background: var(--surface-card);
  border: 1px solid var(--surface-card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

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

.card-perspective {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.15s ease-out;
}

.card-perspective::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle 250px at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.15), transparent 80%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.card-perspective:hover::after {
  opacity: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald-mortarboard), #008751);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(0, 158, 96, 0.3);
}

.btn-primary:hover {
  transform: none;
  box-shadow: 0 6px 20px rgba(0, 158, 96, 0.45);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-accent), #9E7B24);
  color: #FFFFFF;
  box-shadow: 0 4px 14px var(--gold-glow);
}

.btn-gold:hover {
  transform: none;
  box-shadow: 0 6px 20px var(--gold-glow);
}

.btn-secondary {
  background: var(--surface-card);
  color: var(--text-primary);
  border: 1px solid var(--surface-card-border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--text-secondary);
  transform: none;
}

.btn-danger {
  background: var(--coral-error);
  color: #FFFFFF;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

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

.badge-coral {
  background: var(--coral-error-bg);
  color: var(--coral-error);
  border: 1px solid var(--coral-error-border);
}

.badge-amber {
  background: var(--amber-method-bg);
  color: var(--amber-method);
  border: 1px solid var(--amber-method-border);
}

.badge-gold {
  background: rgba(184, 146, 47, 0.12);
  color: var(--gold-accent);
  border: 1px solid rgba(184, 146, 47, 0.3);
}

/* Form Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-card-border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--emerald-mortarboard);
  box-shadow: 0 0 0 3px var(--emerald-correct-bg);
  background: var(--surface-card);
}

/* ==========================================================================
   MOBILE RESPONSIVENESS OVERHAUL (<900px, <768px, <480px)
   ========================================================================== */

/* Mobile Backdrop for Sidebar Drawer */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 180;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

/* Mobile Hamburger Button in Topbar */
.mobile-menu-btn {
  display: none;
}

/* Mobile Fixed Bottom Quick Bar for Students */
.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: 58px;
  height: auto;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--surface-card-border);
  z-index: 150;
  align-items: center;
  justify-content: space-around;
  padding: 2px 4px;
  padding-bottom: env(safe-area-inset-bottom, 10px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.mobile-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10.5px;
  font-weight: 700;
  transition: all var(--transition-fast);
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 6px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
}

.mobile-bar-item svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.mobile-bar-item span {
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}

.mobile-bar-item.active {
  color: var(--emerald-mortarboard);
}

.mobile-bar-item:hover {
  color: var(--text-primary);
}

/* Sticky Mobile Exam Toggle Pill (results.html) */
.mobile-exam-toggle-container {
  display: none;
  position: sticky;
  top: 76px;
  z-index: 75;
  background: var(--surface-card);
  padding: 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--surface-card-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  margin-bottom: 16px;
  justify-content: center;
  gap: 6px;
}

.mobile-exam-toggle-btn {
  flex: 1;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mobile-exam-toggle-btn.active {
  background: var(--emerald-mortarboard);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 158, 96, 0.3);
}

/* Responsive Table Wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   STUDENT ULTRA-SIMPLE UX & UNIVERSAL RESPONSIVENESS
   ========================================================================== */
.student-cta-btn {
  min-height: 50px !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  border-radius: 14px !important;
  padding: 12px 20px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.quick-steps-banner {
  background: linear-gradient(135deg, rgba(0, 158, 96, 0.1) 0%, rgba(184, 146, 47, 0.1) 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.28);
  border-radius: 16px;
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  text-align: center;
  font-weight: 800;
  font-size: 0.96rem;
  line-height: 1.5;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

#student-kpi-stats-grid,
.stats-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
  visibility: visible !important;
  opacity: 1 !important;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 28px;
}

.results-split-grid {
  display: grid;
  grid-template-columns: minmax(360px, 440px) 1fr;
  gap: 28px;
  align-items: start;
}

.upload-main-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

.materials-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 24px;
}

.video-player-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

/* iPad Landscape & Medium Desktops (1025px - 1180px) */
@media (min-width: 1025px) and (max-width: 1180px) {
  .app-sidebar {
    width: 235px;
    padding: 20px 14px;
  }

  .app-content,
  .main-content,
  .dashboard-container {
    padding-top: 88px !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    padding-bottom: 24px !important;
  }

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

/* Tablets & iPad Portrait / Slide-Over Drawer Breakpoint (< 1024px) */
@media (max-width: 1024px) {
  .mobile-menu-btn {
    display: inline-flex !important;
    flex-shrink: 0 !important;
  }

  .app-sidebar {
    position: fixed !important;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px !important;
    max-width: 85vw !important;
    height: 100vh;
    height: 100dvh !important;
    max-height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 20px 14px !important;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 16px)) !important;
    box-sizing: border-box !important;
    z-index: 10050 !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.45) !important;
  }

  .sidebar-footer {
    margin-top: auto !important;
    padding-top: 14px !important;
    flex-shrink: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .sidebar-social-btn {
    flex-shrink: 0 !important;
  }

  html[dir="rtl"] .app-sidebar {
    left: auto;
    right: 0;
    transform: translateX(100%);
  }

  .app-sidebar.open {
    transform: translateX(0) !important;
  }

  .sidebar-backdrop {
    z-index: 10040 !important;
  }
}

/* Staff-Only Video Uploader Visibility Enforcement (0ms pre-paint protection) */
html[data-role="student"] .staff-only-uploader,
html:not([data-role="teacher"]):not([data-role="assistant"]):not([data-role="admin"]) .staff-only-uploader {
  display: none !important;
}

/* My Analysis Section Layout & Fluid SVG Radar */
#my-analysis {
  scroll-margin-top: 84px;
  transition: box-shadow 0.3s ease, transform 0.15s ease-out;
}

.my-analysis-card {
  grid-column: 1 / -1;
}

.my-analysis-body {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 28px;
  align-items: center;
}

.my-analysis-radar-svg {
  width: 100%;
  max-width: 320px;
  height: auto;
  margin: 0 auto;
  display: block;
  overflow: visible;
  direction: ltr;
}

/* Laptops & Desktops (> 1024px): Multi-Column Grids & Balanced Button Padding */
@media (min-width: 1025px) {
  .upload-primary-btn,
  .hero-cta-btn,
  .student-cta-btn {
    padding: 14px 24px !important;
    font-size: 1rem !important;
    line-height: 1.4 !important;
    white-space: normal !important;
    text-align: center !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
  }
}

/* Tablets & iPads (641px - 1024px — Portrait & Landscape): Balanced 2-Column Grids & Proportioned CTA Buttons */
@media (min-width: 641px) and (max-width: 1024px) {
  .stats-grid,
  .dashboard-grid,
  .materials-grid,
  .teacher-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }

  .my-analysis-card {
    grid-column: 1 / -1 !important;
  }

  .app-content,
  .main-content,
  .dashboard-container {
    padding-top: 84px !important;
    padding-left: 18px !important;
    padding-right: 18px !important;
    padding-bottom: 28px !important;
  }

  /* Centered and properly proportioned CTA button inside its card */
  .upload-primary-btn,
  .hero-cta-btn,
  .student-cta-btn,
  #start-dissection-btn {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 12px 18px !important;
    font-size: 0.95rem !important;
    line-height: 1.35 !important;
    white-space: normal !important;
    min-height: 48px !important;
  }
}

/* iPad Portrait & Smaller Split-Screen Panes (<= 960px) */
@media (max-width: 960px) {
  .upload-main-layout,
  .split-upload-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .mobile-exam-toggle-container {
    display: none !important;
  }

  .app-content .btn,
  .app-content .form-input,
  .app-content .form-select {
    min-height: 48px;
  }
}

/* Mobile Smartphones (< 768px) */
@media (max-width: 767px) {
  html, body, .app-layout, .app-main, .app-content {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  .my-analysis-body {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .topbar-left h2 {
    font-size: 1.05rem !important;
  }

  .mobile-bottom-bar {
    display: flex !important;
  }

  .app-content,
  .main-content,
  .dashboard-container {
    padding-top: 80px !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 12px)) !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  .card {
    padding: 16px 14px !important;
    border-radius: var(--radius-md) !important;
  }

  /* Exam Canvas Container on Mobile */
  #script-canvas-sheet {
    transform-origin: top left;
  }
}

/* Small & Standard Mobile Phones (< 640px): Strict 1-Column Cards, Zero Horizontal Scroll, Fluid Wrapped CTA Button */
@media (max-width: 640px) {
  html, body, .app-layout, .app-main, .app-content {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  .stats-grid,
  .dashboard-grid,
  .materials-grid,
  .upload-grid,
  .teacher-grid,
  .split-grid,
  .metrics-grid,
  .my-analysis-body,
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .my-analysis-radar-svg {
    width: 100% !important;
    max-width: 300px !important;
    height: auto !important;
    margin: 0 auto !important;
    display: block !important;
    overflow: visible !important;
  }

  /* Primary CTA Buttons on Small & Standard Mobile Phones (< 640px) */
  .upload-primary-btn,
  .hero-cta-btn,
  .student-cta-btn,
  #start-dissection-btn,
  .btn-primary.btn-lg,
  a[href="#auth-section"].upload-primary-btn {
    width: 100% !important;
    max-width: 100% !important;
    white-space: normal !important;
    text-align: center !important;
    line-height: 1.35 !important;
    padding: 12px 16px !important;
    font-size: 0.95rem !important;
    height: auto !important;
    min-height: 48px !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
}

/* ==========================================================================
   OFFICIAL SOCIAL MEDIA LINKS (INSTAGRAM, FACEBOOK, TIKTOK)
   ========================================================================== */
.social-topbar-btn {
  color: var(--text-secondary);
  transition: transform var(--transition-fast), color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.hud-control-pill .social-topbar-btn {
  color: var(--text-secondary) !important;
  background: transparent !important;
  box-shadow: none !important;
}

.hud-control-pill .social-topbar-btn:hover {
  color: #10B981 !important;
  background: rgba(16, 185, 129, 0.08) !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25) !important;
  transform: translateY(-1px) !important;
}

/* Footer Social Buttons */
.footer-social-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.social-footer-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
  text-decoration: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.social-footer-btn:hover {
  transform: translateY(-2px);
  color: #10B981;
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.social-footer-btn.social-footer-ig:hover {
  color: #E1306C;
  border-color: rgba(225, 48, 108, 0.4);
  box-shadow: 0 4px 14px rgba(225, 48, 108, 0.25);
}

.social-footer-btn.social-footer-fb:hover {
  color: #1877F2;
  border-color: rgba(24, 119, 242, 0.4);
  box-shadow: 0 4px 14px rgba(24, 119, 242, 0.25);
}

.social-footer-btn.social-footer-tt:hover {
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 14px rgba(0, 242, 234, 0.3), 0 4px 14px rgba(254, 44, 85, 0.3);
}

/* Sidebar Community Social Buttons */
.sidebar-social-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all var(--transition-fast);
  text-decoration: none;
}

[data-theme="light"] .sidebar-social-btn {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.sidebar-social-btn:hover {
  transform: translateY(-1px);
  color: #10B981;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   PAPER QUALITY PREVIEW & ROTATE CONTROLS
   ========================================================================== */
.paper-quality-card {
  margin-top: 18px;
  padding: 16px 18px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--surface-card-border);
  animation: fadeIn 0.3s ease-out;
}

.paper-preview-canvas-wrapper {
  width: 100%;
  max-height: 290px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-card);
  border: 1px dashed var(--surface-card-border);
  padding: 12px;
  position: relative;
}

/* ==========================================================================
   MULTI-PAGE THUMBNAIL STRIP & MOBILE SCANNER
   ========================================================================== */
.multi-page-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  width: 100%;
  margin-top: 14px;
}

.multi-page-card {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--surface-card-border);
  border-radius: var(--radius-md);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.multi-page-card:hover {
  border-color: var(--emerald-mortarboard);
  box-shadow: var(--shadow-md);
}

.multi-page-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.multi-page-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(0, 158, 96, 0.12);
  color: var(--emerald-mortarboard);
  border: 1px solid rgba(0, 158, 96, 0.25);
  white-space: nowrap;
}

.multi-page-delete-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 6px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  line-height: 1;
}

.multi-page-delete-btn:hover {
  background: #EF4444;
  color: #FFFFFF;
  transform: scale(1.08);
}

.multi-page-img-frame {
  position: relative;
  width: 100%;
  height: 130px;
  background: #0B1522;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.multi-page-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.multi-page-rotate-btn {
  width: 100%;
  padding: 5px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--surface-card-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.multi-page-rotate-btn:hover {
  background: var(--surface-card);
  border-color: var(--emerald-mortarboard);
  color: var(--emerald-mortarboard);
}

.multi-page-add-card {
  min-height: 170px;
  border: 2px dashed var(--emerald-mortarboard);
  border-radius: var(--radius-md);
  background: rgba(0, 158, 96, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.multi-page-add-card:hover {
  background: rgba(0, 158, 96, 0.08);
  transform: translateY(-2px);
}

.multi-page-add-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--surface-card);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--emerald-mortarboard);
}

.multi-page-add-text {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--emerald-mortarboard);
}

/* Mobile Fullscreen Scanner Shell */
.mobile-scanner-view {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 14px 40px;
  min-height: 100vh;
  box-sizing: border-box;
}

.mobile-scanner-card {
  padding: 22px 18px;
  border-radius: var(--radius-xl);
  background: var(--surface-card);
  border: 1px solid var(--surface-card-border);
  box-shadow: var(--shadow-lg);
  margin-bottom: 18px;
  text-align: center;
}

.mobile-scanner-shutter {
  width: 100%;
  padding: 16px;
  font-size: 1.05rem;
  font-weight: 800;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(0, 158, 96, 0.25);
  margin-top: 14px;
}

/* ==========================================================================
   TEACHER ONBOARDING MODAL & CARD
   ========================================================================== */
.teacher-join-cta-card {
  background: linear-gradient(135deg, rgba(0, 158, 96, 0.08) 0%, rgba(217, 119, 6, 0.08) 100%);
  border: 1px solid rgba(0, 158, 96, 0.25);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
}

/* Modal Backdrop & Container */
.app-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 21, 34, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.app-modal-dialog {
  background: var(--surface-card);
  border: 1px solid var(--surface-card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 28px 24px;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   PRINT STYLES (Clean Exam Sheet Formatting)
   ========================================================================== */
@media print {
  .no-print,
  .app-sidebar,
  .app-topbar,
  #interactive-particles,
  .mobile-bottom-bar,
  .mobile-exam-toggle-container {
    display: none !important;
  }
}

/* ==========================================================================
   PRIMARY UPLOAD BUTTONS RESPONSIVE FIT
   ========================================================================== */
.upload-primary-btn {
  white-space: normal;
  text-align: center;
  word-break: break-word;
}

@media (max-width: 640px) {
  .upload-primary-btn,
  #start-dissection-btn.upload-primary-btn {
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 16px !important;
    font-size: 0.92rem !important;
    line-height: 1.35 !important;
    white-space: normal !important;
    text-align: center !important;
    display: inline-flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    box-sizing: border-box !important;
  }
}

/* ==========================================================================
   MOBILE TOPBAR CLIPPING PROTECTION (NEVER CLIP DROPDOWN OR HUD)
   ========================================================================== */
.title-mobile {
  display: none;
}

@media (max-width: 640px) {
  .app-topbar,
  .gateway-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    max-width: 100vw !important;
    padding: 8px 12px !important;
    gap: 6px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    z-index: 9990 !important;
  }

  .topbar-left {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .topbar-title,
  .topbar-left h2 {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    line-height: 1.2 !important;
  }

  .topbar-right {
    flex-shrink: 0 !important;
    margin-inline-start: auto !important;
    display: flex !important;
    align-items: center !important;
    overflow: visible !important;
    z-index: 9991 !important;
  }

  .hud-control-pill,
  .hud-pill {
    flex-shrink: 0 !important;
    overflow: visible !important;
    z-index: 9992 !important;
  }
}

/* Small Phones (< 480px) */
@media (max-width: 480px) {
  .title-desktop {
    display: none !important;
  }
  .title-mobile {
    display: inline !important;
  }

  .app-topbar,
  .gateway-header {
    padding: 10px 12px !important;
  }

  .app-content {
    padding-bottom: 85px !important;
  }

  .btn {
    font-size: 0.85rem;
    padding: 8px 14px;
  }

  /* On screens < 480px, show ONLY [🌐 EN ▾ | ☀️/🌙] in topbar pill (social icons live in sidebar & footer) */
  .hud-control-pill .social-topbar-btn,
  .hud-control-pill .hud-social-divider {
    display: none !important;
  }
}

/* ==========================================================================
   STATIC ICONS & ZERO-MOVEMENT GUARANTEE
   All dashboard, sidebar, card, badge, and button icons stay 100% stationary.
   ========================================================================== */
.animate-float,
.animate-pulse-glow,
.pulse-dot,
.badge,
.icon-btn,
.icon-btn svg,
.hud-icon-btn,
.hud-icon-btn svg,
.sidebar-social-btn,
.sidebar-social-btn svg,
.social-footer-btn,
.social-footer-btn svg,
.nav-link svg,
.mobile-bar-item svg,
.btn svg,
.card svg,
.card-icon {
  animation: none !important;
}

/* Static, non-moving button icons across all buttons in LTR and RTL (Arabic) modes */
.btn svg,
.btn span,
.btn img,
.btn:hover svg,
.btn:hover span,
.btn:hover img,
html[dir="rtl"] .btn svg,
html[dir="rtl"] .btn span,
html[dir="rtl"] .btn img,
html[dir="rtl"] .btn:hover svg,
html[dir="rtl"] .btn:hover span,
html[dir="rtl"] .btn:hover img {
  transform: none !important;
  transition: none !important;
  animation: none !important;
}

.nav-link:hover,
.mobile-bar-item:hover,
.icon-btn:hover,
.hud-icon-btn:hover,
.lang-dropdown-btn:hover,
.for-teachers-pill:hover,
.social-topbar-btn:hover,
.social-footer-btn:hover,
.sidebar-social-btn:hover,
.btn:hover,
.btn-primary:hover,
.btn-gold:hover,
.btn-secondary:hover,
.card-perspective,
.card-perspective:hover {
  transform: none !important;
}



.script-q-block {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
  position: relative;
  z-index: 2;
}

.script-margin-col {
  padding-top: 4px;
}

.script-margin-pill {
  background: #0F172A;
  border-radius: 5px;
  padding: 4px 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
  white-space: nowrap;
}

.script-margin-pill .pill-bar {
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: #009E60;
  flex-shrink: 0;
}

.script-margin-pill.partial .pill-bar {
  background: #F59E0B;
}

.script-margin-pill .pill-q {
  color: #FFFFFF;
  font-weight: 800;
  font-size: 10.5px;
  font-family: var(--font-mono);
}

.script-margin-pill .pill-score {
  color: #34D399;
  font-weight: 800;
  font-size: 10.5px;
  font-family: var(--font-mono);
}

.script-margin-pill.partial .pill-score {
  color: #FBBF24;
}

.script-print-q {
  font-size: 0.94rem;
  font-weight: 700;
  color: #0B1522;
  line-height: 1.45;
  margin-bottom: 6px;
}

.script-marks-tag {
  float: right;
  font-weight: 700;
  color: #0B1522;
  font-size: 0.9rem;
  margin-left: 10px;
}

.script-hw-work {
  font-family: 'Caveat', 'Kalam', cursive, sans-serif;
  color: #1A2838;
  font-size: 1.45rem;
  line-height: 1.55;
  font-weight: 700;
  padding-left: 12px;
}

.script-hw-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 2px;
}

.hw-cross {
  color: #EF4444;
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 1.3rem;
}

.hw-ft-tick {
  color: #0284C7;
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 1.15rem;
  background: rgba(2, 132, 199, 0.1);
  border: 1px solid rgba(2, 132, 199, 0.3);
  border-radius: 5px;
  padding: 0 6px;
  line-height: 1.3;
}



@media (max-width: 520px) {
  .script-q-block {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  .script-hw-work {
    font-size: 1.28rem !important;
    padding-left: 4px !important;
  }

  .script-print-q {
    font-size: 0.88rem !important;
  }
}

/* ==========================================================================
   GHALTATY (MISTAKE NOTEBOOK) GRID & RESPONSIVE LAYOUT
   ========================================================================== */
.ghaltaty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
}

.ghaltaty-card {
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  height: 100% !important;
  box-sizing: border-box !important;
  border-left: 4px solid var(--amber-method) !important;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

@media (max-width: 1024px) {
  .ghaltaty-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }
}

@media (max-width: 640px) {
  .ghaltaty-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
}

/* ==========================================================================
   SMART PARTICLES VISIBILITY & FIXED HEADER GUARANTEE
   Active on Tablet, iPad, Laptop, PC (>= 640px) on Landing & Student pages
   Strictly hidden on Mobile Phones (< 640px) and on Teacher / TA / Admin views
   ========================================================================== */
@media (max-width: 639px) {
  #interactive-particles {
    display: none !important;
  }
}

body.page-teacher #interactive-particles,
body.page-admin #interactive-particles,
[data-role="teacher"] #interactive-particles,
[data-role="teacher_assistant"] #interactive-particles,
[data-role="assistant"] #interactive-particles,
[data-role="admin"] #interactive-particles,
[data-role="master_admin"] #interactive-particles,
[data-role="platform_assistant"] #interactive-particles {
  display: none !important;
}

/* ==========================================================================
   LANDING PAGE GRADED SCRIPT SHOWCASE (QUESTION 1 a-d)
   UNIFIED SINGLE-PAGE SIDE-BY-SIDE VIEW ACROSS ALL DEVICES (DESKTOP, IPAD, PHONE)
   ========================================================================== */
.showcase-split-grid {
  display: grid !important;
  grid-template-columns: 56% 44% !important;
  width: 100% !important;
  background: #FFFFFF;
  direction: ltr !important;
  text-align: left !important;
  align-items: stretch;
  overflow: hidden;
  box-sizing: border-box;
}

.showcase-script-pane {
  padding: 8px !important;
  position: relative;
  background: #FFFFFF;
  border-right: 1px solid #CBD5E1 !important;
  border-bottom: none !important;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  max-height: 75vh;
  width: 100%;
}

.showcase-script-pane img {
  width: 100%;
  height: 100%;
  max-height: 75vh;
  object-fit: contain;
  display: block;
}

.showcase-core-pane {
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 75vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-left: none !important;
  box-sizing: border-box;
}

/* Tablets & iPads (641px - 1024px): Side-by-Side Proportional Fit */
@media (min-width: 641px) and (max-width: 1024px) {
  .showcase-split-grid {
    grid-template-columns: 56% 44% !important;
    max-height: 75vh !important;
  }
  .showcase-script-pane {
    max-height: 75vh !important;
    border-right: 1px solid #CBD5E1 !important;
    border-bottom: none !important;
  }
  .showcase-core-pane {
    max-height: 75vh !important;
    overflow-y: auto !important;
  }
}

/* Small & Standard Mobile Phones (< 640px): Unified Side-by-Side Single-Screen Board */
@media (max-width: 640px) {
  #showcase-stage {
    padding: 12px 8px 40px 8px !important;
  }

  .showcase-main-card {
    border-radius: var(--radius-md) !important;
  }

  /* Compact Single-Row Header Bar on Mobile */
  .showcase-header-bar {
    padding: 8px 10px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
  }

  .showcase-header-bar .badge,
  .showcase-header-bar span {
    font-size: 10px !important;
    padding: 2px 6px !important;
    white-space: nowrap !important;
  }

  /* Force 2-Column Side-by-Side on Mobile (NEVER STACK INTO 2 SCREENS) */
  .showcase-split-grid {
    display: grid !important;
    grid-template-columns: 56% 44% !important;
    width: 100% !important;
    max-height: 75vh !important;
    height: 75vh !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .showcase-script-pane {
    max-height: 75vh !important;
    height: 100% !important;
    padding: 4px !important;
    border-right: 1px solid #CBD5E1 !important;
    border-bottom: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  .showcase-script-pane img {
    max-height: 75vh !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  .showcase-core-pane {
    max-height: 75vh !important;
    height: 100% !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    font-size: 9.5px !important;
    line-height: 1.25 !important;
    border-left: none !important;
  }

  /* Scaled Examiner Core on Mobile (< 640px) */
  .showcase-core-navy-bar {
    padding: 6px 8px !important;
  }
  .showcase-core-navy-bar img {
    height: 16px !important;
  }
  .showcase-core-navy-bar span {
    font-size: 8px !important;
    padding: 2px 5px !important;
  }

  .showcase-core-sub-bar {
    padding: 4px 8px 6px 8px !important;
  }
  .showcase-core-sub-bar span {
    font-size: 8.5px !important;
  }

  .showcase-cards-stack {
    padding: 6px 6px 14px 6px !important;
    gap: 4px !important;
  }

  .showcase-q-card {
    border-radius: 5px !important;
    margin-bottom: 2px !important;
  }
  .showcase-q-card > div:nth-child(2) {
    padding: 5px 6px !important;
  }

  .showcase-q-title {
    font-size: 9.5px !important;
    font-weight: 900 !important;
  }

  .showcase-q-badge {
    font-size: 8px !important;
    padding: 1px 4px !important;
  }

  .showcase-solution-box {
    padding: 4px 6px !important;
    font-size: 7.5px !important;
    line-height: 1.25 !important;
    margin-top: 4px !important;
  }
  .showcase-solution-box div {
    font-size: 7.5px !important;
  }
}

/* ==========================================================================
   RESULTS PAGE: SINGLE-SCREEN SIDE-BY-SIDE FIT (PAPER + MARKS)
   ========================================================================== */
.results-split-grid {
  display: grid !important;
  grid-template-columns: minmax(340px, 420px) 1fr !important;
  gap: 24px !important;
  align-items: stretch !important;
  width: 100% !important;
}

@media (max-width: 960px) {
  .results-split-grid {
    display: grid !important;
    grid-template-columns: 54% 46% !important;
    gap: 10px !important;
    align-items: stretch !important;
    max-height: 80vh !important;
    height: 80vh !important;
    overflow: hidden !important;
    width: 100% !important;
  }

  #results-paper-column {
    order: 1 !important;
    max-height: 80vh !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    min-width: 0 !important;
  }

  #results-paper-column .exam-paper-canvas-viewport {
    height: calc(80vh - 44px) !important;
    min-height: auto !important;
    padding: 6px 4px !important;
    overflow: auto !important;
  }

  #results-marks-column {
    order: 2 !important;
    max-height: 80vh !important;
    height: 100% !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-right: 2px !important;
    min-width: 0 !important;
  }

  .mobile-exam-toggle-container {
    display: none !important;
  }

  /* Compact Score Hero Card on Mobile Results (< 960px) */
  .results-score-card {
    padding: 8px 10px !important;
    margin-bottom: 8px !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 6px !important;
  }

  .score-ring-wrapper,
  .score-ring-svg {
    width: 64px !important;
    height: 64px !important;
  }

  #score-number {
    font-size: 1rem !important;
  }

  #score-percentage {
    font-size: 0.72rem !important;
  }

  .results-score-details h4,
  .results-score-details div:nth-child(2) {
    font-size: 0.95rem !important;
    margin-bottom: 4px !important;
  }

  .results-score-details .badge {
    font-size: 0.7rem !important;
    padding: 2px 4px !important;
  }

  .results-score-details p {
    display: none !important;
  }

  #dissection-questions-list h3 {
    font-size: 0.9rem !important;
    margin-bottom: 6px !important;
  }
}

/* Mobile Bottom Bar Un-truncated Fit */
.mobile-bar-item span {
  font-size: 10px !important;
  letter-spacing: -0.02em !important;
  line-height: 1.1 !important;
}

/* ==========================================================================
   4-TIER RBAC STRICT VISIBILITY RULES
   ========================================================================== */
/* Master Admin Only: Team management, quota increases, financial metrics */
[data-role="platform_assistant"] .master-admin-only,
[data-role="teacher"] .master-admin-only,
[data-role="teacher_assistant"] .master-admin-only,
[data-role="assistant"] .master-admin-only,
[data-role="student"] .master-admin-only {
  display: none !important;
}

/* Platform Assistant Support Console Only */
[data-role="teacher"] .platform-support-only,
[data-role="teacher_assistant"] .platform-support-only,
[data-role="assistant"] .platform-support-only,
[data-role="student"] .platform-support-only {
  display: none !important;
}

/* Teacher Owner Only: Hidden from Teacher Assistants */
[data-role="teacher_assistant"] .teacher-owner-only,
[data-role="assistant"] .teacher-owner-only {
  display: none !important;
}

/* Teacher Assistant Restricted View Pill Badge */
.ta-mode-badge {
  display: none !important;
}
[data-role="teacher_assistant"] .ta-mode-badge,
[data-role="assistant"] .ta-mode-badge {
  display: inline-flex !important;
}

/* ==========================================================================
   GLOBAL BULLETPROOF TOPBAR & CONTENT CLEARANCE ARCHITECTURE
   Guarantees zero overlap across Mobile (375px), Tablet (768px), & Desktop (1440px)
   ========================================================================== */
.app-topbar {
  position: fixed !important;
  top: 0 !important;
  bottom: auto !important;
  left: 260px !important;
  right: 0 !important;
  width: calc(100% - 260px) !important;
  height: 60px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 20px !important;
  box-sizing: border-box !important;
  background: rgba(11, 21, 34, 0.96) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(16, 185, 129, 0.16) !important;
  z-index: 9990 !important;
}

[data-theme="light"] .app-topbar {
  background: rgba(248, 250, 252, 0.95) !important;
}

html[dir="rtl"] .app-topbar {
  left: 0 !important;
  right: 260px !important;
}

@media (max-width: 1024px) {
  .app-topbar {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 56px !important;
    padding: 0 16px !important;
  }
  html[dir="rtl"] .app-topbar {
    left: 0 !important;
    right: 0 !important;
  }
}

@media (max-width: 640px) {
  .app-topbar {
    height: 52px !important;
    padding: 0 12px !important;
  }
}

/* ==========================================================================
   LANDING PAGE MOBILE HEADER (GATEWAY HEADER) FIX
   Logo on left, [🌐 Lang | 🌙 | Sign In] on right - never vanishes off-screen
   ========================================================================== */
@media (max-width: 768px) {
  .gateway-header {
    height: 54px !important;
    padding: 10px 16px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .gateway-header .topbar-left {
    display: flex !important;
    align-items: center !important;
    flex: 0 0 auto !important;
  }

  .gateway-header .brand-logo {
    display: inline-flex !important;
    align-items: center !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .gateway-header .brand-logo-wrapper {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .gateway-header .brand-logo .logo-img {
    height: 28px !important;
    width: auto !important;
    max-width: 105px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .gateway-header .topbar-right {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
    margin-inline-start: auto !important;
    overflow: visible !important;
  }

  /* Hide 'For Teachers' pill in mobile header (available in hero CTA) */
  .gateway-header .header-teachers-btn,
  .gateway-header .for-teachers-pill {
    display: none !important;
  }

  /* Hide social icons from the compact mobile header pill */
  .gateway-header .social-topbar-btn,
  .gateway-header .hud-social-divider {
    display: none !important;
  }

  .gateway-header .nav-signin-pill {
    padding: 6px 12px !important;
    font-size: 11.5px !important;
    white-space: nowrap !important;
    height: auto !important;
    min-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}

/* ==========================================================================
   GRADED MATH SCRIPT SHOWCASE & RESULTS CANVAS DIRECTION LOCK (LTR)
   Prevents English exam board math from reversing in RTL Arabic mode
   ========================================================================== */
#showcase-stage,
.showcase-main-card,
.showcase-unified-container,
.showcase-split-grid,
#script-canvas-sheet {
  direction: ltr !important;
  text-align: left !important;
}

.showcase-unified-container img {
  width: 100% !important;
  height: auto !important;
  max-height: 85vh !important;
  object-fit: contain !important;
  display: block !important;
  margin: 0 auto !important;
}

/* ==========================================================================
   RESPONSIVE DATA TABLE & MOBILE TOUCH-SCROLL
   Prevents any column text clipping (e.g. 'Curriculum' never cut off)
   ========================================================================== */
.table-responsive {
  width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  display: block !important;
}

.history-data-table {
  width: 100% !important;
  min-width: 760px !important;
  border-collapse: collapse !important;
}

.history-data-table th,
.history-data-table td {
  white-space: nowrap !important;
  padding: 14px 18px !important;
  box-sizing: border-box !important;
}

.history-data-table th:first-child,
.history-data-table td:first-child {
  white-space: normal !important;
  min-width: 240px !important;
}
