/* ==========================================================================
   Anti-zoom, Mobile Touch & Native App UX Rules
   ========================================================================== */
html, body {
  touch-action: pan-x pan-y !important;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
  -webkit-tap-highlight-color: transparent !important;
  overscroll-behavior-y: contain !important;
  user-select: none;
  -webkit-user-select: none;
}

input, select, textarea {
  user-select: text !important;
  -webkit-user-select: text !important;
  font-size: 16px !important; /* Prevents auto-zoom on input focus */
}

/* ==========================================================================
   LearnHub Design System & Custom Styles
   ========================================================================== */

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-urdu: 'Noto Sans Arabic', 'Amiri', 'Noto Nastaliq Urdu', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-arabic: 'Amiri', 'Noto Sans Arabic', 'Scheherazade New', serif;
  --font-hindi: 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Master Design System Palette - LearnHub Teal & Royal Gold */
  --primary-50: #f0fdfa;
  --primary-100: #ccfbf1;
  --primary-200: #99f6e4;
  --primary-300: #5eead4;
  --primary-400: #2dd4bf;
  --primary-500: #14b8a6; /* Primary Light */
  --primary-600: #0d9488;
  --primary-700: #0f766e; /* Primary Brand */
  --primary-800: #115e59; /* Primary Dark */
  --primary-900: #134e4a;
  --primary-950: #042f2e;

  --gold-300: #fde047;
  --gold-400: #facc15;
  --gold-500: #d4a72c; /* Premium Accent */
  --gold-600: #b88d22;
  --gold-700: #946d16;
  --gold-glow: rgba(212, 167, 44, 0.25);

  --accent-500: #14b8a6;
  --accent-600: #0f766e;

  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --color-info: #2563eb;

  --bg-main: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #f1f5f9;
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --sidebar-width: 260px;
  --header-height: 70px;
  --shadow-subtle: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
  --shadow-card: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 20px 25px -5px rgba(15, 118, 110, 0.12), 0 8px 10px -6px rgba(15, 118, 110, 0.08);
  --shadow-premium: 0 25px 50px -12px rgba(15, 118, 110, 0.25);
  --shadow-gold: 0 10px 30px -5px rgba(212, 167, 44, 0.3);
}

.dark {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --shadow-subtle: 0 1px 3px 0 rgb(0 0 0 / 0.5);
  --shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.45);
  --shadow-card-hover: 0 20px 30px -8px rgba(0, 0, 0, 0.6);
  --shadow-premium: 0 25px 50px -12px rgba(20, 184, 166, 0.25);
  --shadow-gold: 0 10px 30px -5px rgba(212, 167, 44, 0.25);
}

html {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s ease, color 0.2s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Universal Overflow & Word Wrapping Protection (Preserves Arabic cursive joins) */
h1, h2, h3, h4, h5, h6, p, span, a, button, input, select, textarea, div {
  overflow-wrap: break-word;
  word-break: normal;
}

/* Touch targets optimization */
button, a, input, select, textarea {
  touch-action: manipulation;
}

/* Media Elements 100% Mobile Safe */
img, video, iframe, canvas, svg {
  max-width: 100%;
  height: auto;
}

/* Responsive Table Wrapper */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

[dir="rtl"] {
  direction: rtl;
  text-align: right;
  letter-spacing: normal !important;
}

/* ==========================================================================
   Urdu & Arabic Typography System (Continuous Unbroken Ligatures & High Clarity)
   ========================================================================== */
.font-urdu, [dir="rtl"] {
  font-family: 'Noto Sans Arabic', 'Amiri', 'Segoe UI', system-ui, -apple-system, sans-serif !important;
  line-height: 1.65 !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  word-break: normal !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.font-urdu-nastaliq {
  font-family: 'Noto Nastaliq Urdu', 'Amiri', 'Noto Sans Arabic', serif !important;
  line-height: 1.95 !important;
  font-size: 0.95em !important;
}

.font-arabic,
.quran-arabic-text {
  font-family: 'Amiri', 'Scheherazade New', 'Noto Sans Arabic', serif !important;
  letter-spacing: normal !important;
  word-break: normal !important;
  line-height: 2.2 !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

[lang="ur"],
[lang="ur"] * {
  font-family: var(--font-urdu), var(--font-sans);
}

[lang="ar"] * {
  font-family: var(--font-arabic), var(--font-sans);
}

[lang="hi"] *, .font-hindi {
  font-family: var(--font-hindi), var(--font-sans);
}

/* Nastaliq Baseline & Element Alignment Adjustments */
h1.font-urdu, h2.font-urdu, h3.font-urdu, h4.font-urdu, h5.font-urdu, h6.font-urdu {
  line-height: 1.5;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

p.font-urdu {
  line-height: 1.8;
}

button.font-urdu,
.btn-primary.font-urdu,
.btn-secondary.font-urdu,
.btn-outline.font-urdu,
.btn-gold.font-urdu,
a.font-urdu {
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
}

.badge.font-urdu {
  line-height: 1.3;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

input.font-urdu,
select.font-urdu,
textarea.font-urdu {
  line-height: 1.5;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Scrollbar None Utility for Horizontal Smooth Scrolling Tabs */
.scrollbar-none::-webkit-scrollbar {
  display: none;
}
.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Glassmorphism Classes */
.glass {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.dark .glass {
  background: rgba(19, 27, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(30, 41, 59, 0.8);
}

.glass-nav {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
}
.dark .glass-nav {
  background: rgba(11, 15, 25, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
}

/* Gradient Texts & Accents - Master Design System */
.gradient-text {
  background: linear-gradient(135deg, #0F766E 0%, #14B8A6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.gradient-text-alt {
  background: linear-gradient(135deg, #D4A72C 0%, #B88D22 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gradient-bg-primary {
  background: linear-gradient(135deg, #0F766E 0%, #115E59 100%);
}
.gradient-bg-hero {
  background: radial-gradient(circle at 50% 20%, rgba(15, 118, 110, 0.08) 0%, transparent 60%);
}
.dark .gradient-bg-hero {
  background: radial-gradient(circle at 50% 20%, rgba(20, 184, 166, 0.12) 0%, transparent 60%);
}

/* Animations */
@keyframes pulseSlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.03); }
}
.animate-pulse-slow {
  animation: pulseSlow 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}
.animate-float {
  animation: float 3s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.shimmer {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.dark .shimmer {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Button & Component Utilities */
.btn-primary {
  background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
  color: #ffffff;
  font-weight: 700;
  padding: 0.65rem 1.35rem;
  border-radius: 0.85rem;
  box-shadow: 0 4px 16px 0 rgba(15, 118, 110, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 8px 25px 0 rgba(15, 118, 110, 0.45);
  background: linear-gradient(135deg, #14b8a6 0%, #0f766e 100%);
  color: #ffffff;
}
.btn-primary:active {
  transform: scale(0.97);
}

.btn-gold {
  background: linear-gradient(135deg, #d4a72c 0%, #b88d22 100%);
  color: #0f172a;
  font-weight: 800;
  padding: 0.65rem 1.35rem;
  border-radius: 0.85rem;
  box-shadow: 0 4px 16px 0 rgba(212, 167, 44, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.btn-gold:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 8px 25px 0 rgba(212, 167, 44, 0.5);
  background: linear-gradient(135deg, #facc15 0%, #d4a72c 100%);
}
.btn-gold:active {
  transform: scale(0.97);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: 0.85rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-subtle);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: #14b8a6;
}

.btn-outline {
  background: transparent;
  color: var(--primary-600);
  border: 1.5px solid var(--primary-500);
  font-weight: 600;
  padding: 0.55rem 1.2rem;
  border-radius: 0.85rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-outline:hover {
  background: var(--primary-50);
  color: var(--primary-700);
}
.dark .btn-outline {
  color: var(--primary-400);
  border-color: var(--primary-400);
}
.dark .btn-outline:hover {
  background: rgba(16, 185, 129, 0.15);
  color: #a7f3d0;
}

/* Card Styling */
.lh-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1.15rem;
  padding: 1.15rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
@media (min-width: 640px) {
  .lh-card {
    border-radius: 1.5rem;
    padding: 1.5rem;
  }
}
.lh-card-hover {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.lh-card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: #14b8a6;
}
.dark .lh-card-hover:hover {
  border-color: #0f766e;
  box-shadow: 0 12px 30px -8px rgba(15, 118, 110, 0.25);
}

/* Luxury Islamic Glow & Gold Borders */
.gold-border {
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 20px -5px rgba(245, 158, 11, 0.2);
}
.emerald-border {
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 20px -5px rgba(16, 185, 129, 0.2);
}

/* Badge Styling */
.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.badge-primary {
  background-color: #ecfdf5;
  color: #059669;
}
.dark .badge-primary {
  background-color: rgba(5, 150, 105, 0.2);
  color: #34d399;
}
.badge-gold {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.dark .badge-gold {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-success {
  background-color: #ecfdf5;
  color: #059669;
}
.dark .badge-success {
  background-color: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}
.badge-warning {
  background-color: #fffbeb;
  color: #d97706;
}
.dark .badge-warning {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}
.badge-danger {
  background-color: #fef2f2;
  color: #dc2626;
}
.dark .badge-danger {
  background-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
.badge-neutral {
  background-color: #f1f5f9;
  color: #475569;
}
.dark .badge-neutral {
  background-color: #1e293b;
  color: #94a3b8;
}

/* Learning Streak Activity Calendar */
.streak-grid {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 6px;
}
.streak-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background-color: #e2e8f0;
  transition: all 0.15s ease;
}
.dark .streak-cell {
  background-color: #1e293b;
}
.streak-cell.active-1 { background-color: #c7d2fe; }
.streak-cell.active-2 { background-color: #818cf8; }
.streak-cell.active-3 { background-color: #4f46e5; }
.streak-cell.active-4 { background-color: #312e81; }

/* Certificate Frame Preview */
.certificate-frame {
  position: relative;
  background: #ffffff;
  border: 10px solid #312e81;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

/* Modals & Dialogs */
.modal-backdrop {
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
}

/* Form Controls */
.form-input {
  width: 100%;
  padding: 0.65rem 0.95rem;
  border-radius: 0.625rem;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  font-size: 0.925rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

/* Drag-and-Drop / Reordering UI */
.drag-handle {
  cursor: grab;
}
.drag-handle:active {
  cursor: grabbing;
}
.dragging {
  opacity: 0.5;
  border: 2px dashed #6366f1;
}

/* Interactive Accordion */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
}
.accordion-content.open {
  max-height: 2000px;
  transition: max-height 0.35s ease-in-out;
}

/* Safe Area insets for modern edge-to-edge iOS and Android displays */
@supports (padding: max(0px)) {
  #app-bottom-nav {
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    padding-left: max(0.5rem, env(safe-area-inset-left));
    padding-right: max(0.5rem, env(safe-area-inset-right));
  }
  #public-navbar {
    padding-left: max(0rem, env(safe-area-inset-left));
    padding-right: max(0rem, env(safe-area-inset-right));
  }
}

/* ==========================================================================
   Three Distinct Device Tier Responsive System:
   1. Mobile Tier (< 640px): Native App Mobile Feel (320px - 430px optimized)
   2. Tablet Tier (640px - 1024px): Touch-Optimized Hybrid Tablet Layout
   3. Laptop / Desktop Tier (> 1024px): Enterprise Wide Luxury Desktop Workspace
   ========================================================================== */

/* --------------------------------------------------------------------------
   TIER 1: Mobile (< 640px) — Native Mobile App Experience
   -------------------------------------------------------------------------- */
@media (max-width: 639.98px) {
  /* Mobile Typography Scaling with Smooth Nastaliq Line Heights */
  h1, .text-4xl, .text-5xl, .text-6xl {
    font-size: 1.55rem !important;
    line-height: 1.75 !important;
  }
  h2, .text-3xl {
    font-size: 1.3rem !important;
    line-height: 1.65 !important;
  }
  h3, .text-2xl {
    font-size: 1.12rem !important;
    line-height: 1.55 !important;
  }

  /* Smooth RTL Nastaliq line heights on Mobile (Zero Clipping) */
  .font-urdu,
  p.font-urdu,
  .font-urdu p {
    line-height: 2.2 !important;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  h1.font-urdu, h2.font-urdu, h3.font-urdu, h4.font-urdu, h5.font-urdu, h6.font-urdu {
    line-height: 2.0 !important;
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
  }

  /* Compact Mobile Card System with Zero Horizontal Overflow */
  .lh-card {
    padding: 0.875rem !important;
    border-radius: 1rem !important;
    margin-bottom: 0.75rem;
    max-width: 100% !important;
  }

  /* Mobile App Touch Targets (Apple HIG 44px standard) */
  .btn-primary, .btn-secondary, .btn-outline {
    min-height: 42px;
    padding: 0.5rem 0.875rem;
    font-size: 0.825rem;
    border-radius: 0.75rem;
  }

  /* Streak Grid: 7-day mobile calendar week */
  .streak-grid {
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 4px !important;
  }

  /* Modal container padding adjustments */
  #global-modal > div {
    padding: 1.15rem !important;
    margin: 0.5rem;
    border-radius: 1.25rem !important;
    max-height: 88vh;
    overflow-y: auto;
  }

  /* Toast notification above bottom 5-tab bar */
  #toast-container {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 5.25rem;
    max-width: calc(100vw - 1.5rem);
  }

  /* Admin Drawer overlay transition */
  #admin-sidebar {
    width: 82vw !important;
    max-width: 320px !important;
  }

  /* Mobile Menu Drawer Zero Overflow */
  #mobile-menu-drawer {
    max-width: 100vw;
    overflow-x: hidden;
  }
}

/* --------------------------------------------------------------------------
   TIER 2: Tablet (640px - 1024px) — Touch-Optimized Hybrid Layout
   -------------------------------------------------------------------------- */
@media (min-width: 640px) and (max-width: 1023.98px) {
  /* Tablet Card System */
  .lh-card {
    padding: 1.25rem !important;
    border-radius: 1.25rem !important;
  }

  /* Smooth RTL Nastaliq Typography */
  .font-urdu,
  p.font-urdu,
  .font-urdu p {
    line-height: 2.2 !important;
  }

  h1.font-urdu, h2.font-urdu, h3.font-urdu, h4.font-urdu {
    line-height: 2.0 !important;
  }

  /* Streak Grid: 14-day 2-week view on tablet */
  .streak-grid {
    grid-template-columns: repeat(14, 1fr) !important;
    gap: 5px !important;
  }

  /* Tablet Toast notification above bottom nav */
  #toast-container {
    right: 1.5rem;
    bottom: 5.5rem;
    max-width: 380px;
  }

  /* Tablet Admin Drawer */
  #admin-sidebar {
    width: 300px !important;
  }
}

/* --------------------------------------------------------------------------
   TIER 3: Laptop & Desktop (> 1024px) — Luxury Desktop Workspace
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  /* Ensure Fixed Bottom Nav Hides Cleanly on Desktop */
  #app-bottom-nav {
    display: none !important;
  }

  .lh-card {
    padding: 1.5rem;
    border-radius: 1.5rem;
  }

  /* Micro-interactions & hover lift on desktop devices */
  .lh-card-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
  }

  /* Streak Grid: Full 28-day 4-week activity on desktop */
  .streak-grid {
    grid-template-columns: repeat(28, 1fr);
    gap: 6px;
  }

  /* Desktop Toast Notification */
  #toast-container {
    right: 1.5rem;
    bottom: 1.5rem;
    max-width: 400px;
  }
}

/* ==========================================================================
   ULTRA-LUXURY ROYAL CERTIFICATE & FLAWLESS A4 LANDSCAPE PRINT ENGINE
   ========================================================================== */
@page {
  size: A4 landscape;
  margin: 0;
}

@media print {
  html, body {
    width: 297mm !important;
    height: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
    overflow: hidden !important;
  }

  /* Hide all UI elements except certificate */
  header, footer, nav, #public-navbar, #app-bottom-nav, #floating-whatsapp-widget, 
  #toast-container, .modal-backdrop, .btn-primary, .btn-secondary, button,
  #modal-title, .modal-close-btn, .no-print, [onclick] {
    display: none !important;
    visibility: hidden !important;
  }

  #global-modal {
    position: static !important;
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    max-height: none !important;
    overflow: visible !important;
    width: 100% !important;
    height: 100% !important;
  }

  #global-modal > div {
    max-width: 100% !important;
    width: 297mm !important;
    height: 210mm !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: none !important;
    overflow: visible !important;
    border-radius: 0 !important;
  }

  #cert-modal {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: visible !important;
  }

  #printable-certificate {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 297mm !important;
    height: 210mm !important;
    min-height: 210mm !important;
    max-height: 210mm !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    page-break-after: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    visibility: visible !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }

  #printable-certificate * {
    visibility: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* Certificate Visual Styling Tokens */
.cert-royal-bg {
  background: radial-gradient(circle at 50% 50%, #fffdf9 0%, #fbf5ea 70%, #f4ebd6 100%);
}

.cert-gold-border {
  border: 4px solid #b38728;
  outline: 2px solid #d4af37;
  outline-offset: 4px;
}

.cert-inner-frame {
  border: 1px solid rgba(179, 135, 40, 0.4);
}

.cert-seal-hologram {
  background: radial-gradient(circle at 30% 30%, #ffe082, #d4af37 40%, #8c6b1b 90%);
  box-shadow: 0 4px 15px rgba(179, 135, 40, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.6);
}

/* ==========================================================================
   LearnHub Design System Utility Components (Phase 1)
   ========================================================================== */

/* 1. Accessible Focus States (WCAG 2.1 AA) */
:focus-visible {
  outline: 2px solid #10b981 !important;
  outline-offset: 2px !important;
}

.lh-focus-ring:focus-visible {
  outline: 2px solid #eab308 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.25) !important;
}

/* 2. Skeleton Shimmer Loading States */
.lh-skeleton {
  background: linear-gradient(90deg, rgba(226, 232, 240, 0.6) 25%, rgba(241, 245, 249, 0.9) 37%, rgba(226, 232, 240, 0.6) 63%);
  background-size: 400% 100%;
  animation: lhSkeletonLoading 1.4s ease infinite;
  border-radius: 0.75rem;
}

.dark .lh-skeleton {
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.7) 25%, rgba(51, 65, 85, 0.9) 37%, rgba(30, 41, 59, 0.7) 63%);
  background-size: 400% 100%;
}

@keyframes lhSkeletonLoading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* 3. Standardized Form Controls & Inputs */
.lh-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.lh-input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* 4. Unified Button Styles */
.lh-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 1rem;
  font-weight: 800;
  font-size: 0.875rem;
  color: #ffffff;
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.lh-btn-primary:hover {
  background: linear-gradient(135deg, #10b981, #059669);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.45);
}

.lh-btn-primary:active {
  transform: translateY(0);
}

.lh-btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 1rem;
  font-weight: 900;
  font-size: 0.875rem;
  color: #0f172a;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.lh-btn-gold:hover {
  background: linear-gradient(135deg, #fde047, #fbbf24);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
}

/* 5. Standardized Empty States */
.lh-empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  border-radius: 1.5rem;
  border: 2px dashed var(--border-color);
  background-color: rgba(248, 250, 252, 0.5);
}

.dark .lh-empty-state {
  background-color: rgba(17, 24, 39, 0.5);
}

/* 3D Flashcard Perspectives & Flip Animations */
.perspective-1000 {
  perspective: 1000px;
}
.transform-style-3d {
  transform-style: preserve-3d;
}
.backface-hidden {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.rotate-y-180 {
  transform: rotateY(180deg);
}
#flashcard-element.flipped {
  transform: rotateY(180deg);
}

/* ==========================================================================
   ROYAL ISLAMIC QURAN MAJEED TYPOGRAPHY & MUSHAF STYLING
   ========================================================================== */
.quran-mushaf-card {
  background: #fffefb;
  border: 3px solid rgba(217, 119, 6, 0.4);
  box-shadow: 0 10px 30px -5px rgba(217, 119, 6, 0.15), 0 0 0 1px rgba(245, 158, 11, 0.2);
}

.dark .quran-mushaf-card {
  background: #090e17;
  border-color: rgba(217, 119, 6, 0.3);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(217, 119, 6, 0.2);
}

.quran-surah-title-plate {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.12), rgba(217, 119, 6, 0.12));
  border: 2px solid rgba(217, 119, 6, 0.35);
  box-shadow: inset 0 0 15px rgba(217, 119, 6, 0.1);
}

.dark .quran-surah-title-plate {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.4), rgba(120, 53, 15, 0.4));
  border-color: rgba(217, 119, 6, 0.3);
}

.quran-ayah-ornament {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-arabic);
  font-weight: 900;
  color: #b45309;
  border: 1.5px solid rgba(217, 119, 6, 0.5);
  background: rgba(254, 243, 199, 0.7);
  border-radius: 9999px;
  vertical-align: middle;
  transition: transform 0.2s ease;
}

.dark .quran-ayah-ornament {
  color: #fde68a;
  background: rgba(120, 53, 15, 0.4);
  border-color: rgba(217, 119, 6, 0.4);
}

.quran-ayah-ornament:hover {
  transform: scale(1.15);
}

.quran-arabic-text {
  font-family: var(--font-arabic);
  line-height: 2.8 !important;
  letter-spacing: 0.02em;
  word-spacing: 0.08em;
  text-align: justify;
  text-align-last: right;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   MAGIC NAVIGATION MENU 2 (Animated Curved Notch & Floating Active Bubble)
   ========================================================================== */
.magic-nav-container {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 20px), 430px);
  height: 68px;
  background: rgba(9, 14, 23, 0.95);
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  border-radius: 26px;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.65), 0 0 25px -3px rgba(16, 185, 129, 0.25);
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 45;
  user-select: none;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.magic-nav-list {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.magic-nav-item {
  position: relative;
  list-style: none;
  flex: 1;
  height: 68px;
  z-index: 1;
}

.magic-nav-item a {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  width: 100%;
  height: 100%;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.magic-nav-item a .magic-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 68px;
  text-align: center;
  transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  color: #94a3b8;
}

.magic-nav-item a .magic-icon i,
.magic-nav-item a .magic-icon svg {
  width: 21px;
  height: 21px;
  transition: transform 0.4s ease, color 0.4s ease;
}

/* Elevated Floating Icon when Active */
.magic-nav-item.active a .magic-icon {
  transform: translateY(-28px);
  color: #042f2e;
}

.magic-nav-item.active a .magic-icon i,
.magic-nav-item.active a .magic-icon svg {
  width: 24px;
  height: 24px;
  color: #022c22;
  filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.4));
}

.magic-nav-item a .magic-text {
  position: absolute;
  color: #10b981;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.01em;
  transition: 0.45s ease;
  opacity: 0;
  transform: translateY(22px);
  white-space: nowrap;
  pointer-events: none;
}

.magic-nav-item.active a .magic-text {
  opacity: 1;
  transform: translateY(14px);
  color: #34d399;
  text-shadow: 0 0 10px rgba(52, 211, 153, 0.4);
}

/* The Animated Sliding Floating Indicator Bubble */
.magic-indicator {
  position: absolute;
  top: -26px;
  width: 20%; /* Exactly 1/5 per tab */
  height: 54px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  z-index: 0;
}

.magic-indicator-bubble {
  position: relative;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #34d399 0%, #10b981 50%, #facc15 100%);
  border-radius: 50%;
  border: 4px solid #090e17;
  box-shadow: 0 8px 25px -2px rgba(16, 185, 129, 0.65), 0 0 15px rgba(250, 204, 21, 0.4);
}

/* Organic Curved Wings (Scoop Notch Cutout on left and right) */
.magic-indicator-bubble::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -19px;
  width: 17px;
  height: 17px;
  background: transparent;
  border-top-right-radius: 17px;
  box-shadow: 1px -8px 0 0 #090e17;
}

.magic-indicator-bubble::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -19px;
  width: 17px;
  height: 17px;
  background: transparent;
  border-top-left-radius: 17px;
  box-shadow: -1px -8px 0 0 #090e17;
}

/* Tab Horizontal Positions (LTR Default) */
.magic-nav-container[data-active-index="0"] .magic-indicator { left: 0%; right: auto; }
.magic-nav-container[data-active-index="1"] .magic-indicator { left: 20%; right: auto; }
.magic-nav-container[data-active-index="2"] .magic-indicator { left: 40%; right: auto; }
.magic-nav-container[data-active-index="3"] .magic-indicator { left: 60%; right: auto; }
.magic-nav-container[data-active-index="4"] .magic-indicator { left: 80%; right: auto; }

/* Tab Horizontal Positions (RTL for Urdu and Arabic) */
[dir="rtl"] .magic-nav-container[data-active-index="0"] .magic-indicator { left: auto; right: 0%; }
[dir="rtl"] .magic-nav-container[data-active-index="1"] .magic-indicator { left: auto; right: 20%; }
[dir="rtl"] .magic-nav-container[data-active-index="2"] .magic-indicator { left: auto; right: 40%; }
[dir="rtl"] .magic-nav-container[data-active-index="3"] .magic-indicator { left: auto; right: 60%; }
[dir="rtl"] .magic-nav-container[data-active-index="4"] .magic-indicator { left: auto; right: 80%; }


/* ==========================================================================
   NATIVE ANDROID BOTTOM NAVIGATION BAR & DRAWER SYSTEM
   ========================================================================== */

#app-bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100vw !important;
  margin: 0 !important;
  transform: translateY(0) !important;
  height: calc(58px + env(safe-area-inset-bottom, 0px)) !important;
  padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  background-color: #ffffff !important;
  border-top: 1px solid #f1f5f9 !important;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04) !important;
  z-index: 50 !important;
  user-select: none !important;
  box-sizing: border-box !important;
}

.dark #app-bottom-nav {
  background-color: #0f172a !important;
  border-top-color: #1e293b !important;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3) !important;
}

.bottom-nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 58px;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, transform 0.1s ease;
  color: #94a3b8;
}

.bottom-nav-item:active {
  transform: scale(0.94);
}

.bottom-nav-item.active {
  color: #0f766e !important;
}

.dark .bottom-nav-item.active {
  color: #14b8a6 !important;
}

.bottom-nav-item i,
.bottom-nav-item svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav-item.active i,
.bottom-nav-item.active svg {
  transform: translateY(-1px);
}

.bottom-nav-item span {
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
}

/* Native Android Mobile Navigation Drawer Animations */
#mobile-menu-drawer {
  animation: fadeInBackdrop 0.2s ease-out forwards;
}

#mobile-menu-drawer > div:last-child {
  animation: slideInDrawerLTR 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[dir="rtl"] #mobile-menu-drawer > div:last-child {
  animation: slideInDrawerRTL 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInDrawerLTR {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes slideInDrawerRTL {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* ==========================================================================
   Mobile Ergonomics & Responsive English/Urdu Typography Harmonization
   ========================================================================== */
@media (max-width: 640px) {
  .font-sans h1 { font-size: 1.25rem !important; line-height: 1.35 !important; }
  .font-sans h2 { font-size: 1.1rem !important; line-height: 1.35 !important; }
  .font-sans h3 { font-size: 0.95rem !important; line-height: 1.35 !important; }
  .font-sans p { font-size: 0.8125rem !important; line-height: 1.5 !important; }
  
  /* Prevent horizontal card squishing on mobile */
  .grid-cols-2 {
    gap: 0.75rem !important;
  }
}

/* ==========================================================================
   Master Professional EdTech Design System (LearnHub Production)
   ========================================================================== */
.card-premium {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.02);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card-premium:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 10px 20px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
}

.dark .card-premium {
  background-color: #0f172a;
  border-color: #334155;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

.dark .card-premium:hover {
  border-color: #475569;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Skeleton Loading Utilities */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s infinite ease-in-out;
  border-radius: 0.5rem;
}

.dark .skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s infinite ease-in-out;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Accessible Focus Ring */
:focus-visible {
  outline: 2px solid #0f766e !important;
  outline-offset: 2px !important;
}

.arabic-ayah-text {
  font-family: 'Amiri', 'Scheherazade New', 'Noto Sans Arabic', serif;
  line-height: 2.4 !important;
  letter-spacing: 0.02em;
}

.urdu-nastaliq-text {
  font-family: 'Noto Nastaliq Urdu', 'Amiri', 'Noto Sans Arabic', sans-serif;
  line-height: 2.2 !important;
}

.touch-press {
  transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.12s ease;
}

.touch-press:active {
  transform: scale(0.98);
}

/* ==========================================================================
   Authentic Seamless Islamic Geometric Arabian Wallpaper (20-25% Balanced Opacity)
   ========================================================================== */
body.bg-islamic-pattern,
.bg-islamic-pattern {
  background-color: #f8fafc;
  background-image: 
    linear-gradient(rgba(248, 250, 252, 0.78), rgba(248, 250, 252, 0.78)),
    url('../icons/islamic-pattern.jpg');
  background-repeat: repeat;
  background-size: 360px auto;
  background-attachment: scroll;
}

.dark body.bg-islamic-pattern,
.dark .bg-islamic-pattern,
[data-theme="dark"] body.bg-islamic-pattern,
[data-theme="dark"] .bg-islamic-pattern {
  background-color: #020617;
  background-image: 
    linear-gradient(rgba(2, 6, 23, 0.80), rgba(2, 6, 23, 0.80)),
    url('../icons/islamic-pattern.jpg');
  background-repeat: repeat;
  background-size: 360px auto;
  background-attachment: scroll;
}

.bg-islamic-pattern-card {
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.88)),
    url('../icons/islamic-pattern.jpg');
  background-repeat: repeat;
  background-size: 280px auto;
}

.dark .bg-islamic-pattern-card,
[data-theme="dark"] .bg-islamic-pattern-card {
  background-image: 
    linear-gradient(rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.88)),
    url('../icons/islamic-pattern.jpg');
  background-repeat: repeat;
  background-size: 280px auto;
}

.islamic-card-shadow {
  box-shadow: 0 4px 20px -2px rgba(15, 118, 110, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
}

.dark .islamic-card-shadow,
[data-theme="dark"] .islamic-card-shadow {
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4), 0 2px 6px -1px rgba(0, 0, 0, 0.3);
}








