/* ============================================
   Malayalam Quiz App — Design System
   ============================================ */

/* Google Fonts loaded via <link> tags in index.html for non-blocking rendering */

/* ============================================
   CSS Variables / Design Tokens
   ============================================ */
:root {
  /* Colors — Modern Obsidian Midnight Palette (Matching UI Mockups) */
  --bg-primary: #0a0b16;
  --bg-secondary: #111224;
  --bg-tertiary: #16182e;
  --bg-surface: #111224;
  --bg-card: #16182e;
  --bg-card-hover: #1e203c;
  --bg-card-alt: #1c1e3a;
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-glass-hover: rgba(255, 255, 255, 0.08);
  --bg-sidebar: #101124;
  --bg-topbar: rgba(16, 17, 36, 0.88);

  /* Accent Colors — Warm Amber/Gold, Magenta/Rose, Cyan & Emerald */
  --accent-primary: #f5a623;
  --accent-primary-light: #fbbf24;
  --accent-primary-dark: #d97706;
  --accent-secondary: #ec4899;
  --accent-secondary-light: #f472b6;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-tertiary: #10b981;
  --accent-danger: #ef4444;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-info: #38bdf8;

  /* Text Colors */
  --text-primary: #f3f4f8;
  --text-secondary: #9ca3af;
  --text-tertiary: #6b7280;
  --text-accent: #f5a623;
  --text-on-accent: #070913;

  /* Dimensions */
  --sidebar-width: 250px;
  --topbar-height: 64px;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #fbbf24 0%, #f5a623 50%, #d97706 100%);
  --gradient-secondary: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
  --gradient-tertiary: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-dark: linear-gradient(180deg, #0a0b16 0%, #111224 50%, #16182e 100%);
  --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.01) 100%);
  --gradient-hero: radial-gradient(ellipse at 50% 10%, rgba(245, 166, 35, 0.16) 0%, transparent 60%),
                   radial-gradient(ellipse at 85% 30%, rgba(139, 92, 246, 0.12) 0%, transparent 55%),
                   radial-gradient(ellipse at 15% 70%, rgba(16, 185, 129, 0.08) 0%, transparent 50%);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.15);
  --border-accent: rgba(245, 166, 35, 0.35);
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 20px;
  --border-radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow-accent: 0 0 20px rgba(246, 166, 35, 0.3);
  --shadow-glow-secondary: 0 0 20px rgba(108, 99, 255, 0.3);

  /* Typography */
  --font-display: 'Inter', sans-serif;
  --font-body: 'Inter', 'Noto Sans Malayalam', sans-serif;
  --font-malayalam: 'Noto Sans Malayalam', sans-serif;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index layers */
  --z-base: 1;
  --z-dropdown: 100;
  --z-modal: 1000;
  --z-toast: 2000;
  --z-tooltip: 3000;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background ambient effect */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-hero);
  pointer-events: none;
  z-index: 0;
}

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

a:hover {
  color: var(--accent-primary-light);
}

img {
  max-width: 100%;
  display: block;
}

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

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-accent { color: var(--accent-primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--accent-success); }
.text-danger { color: var(--accent-danger); }

.ml-text {
  font-family: var(--font-malayalam);
  line-height: 1.8;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.w-full { width: 100%; }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

/* ============================================
   Layout
   ============================================ */
.app-container {
  position: relative;
  z-index: var(--z-base);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page {
  display: none;
  flex: 1;
  animation: pageIn 0.4s ease forwards;
  padding: var(--space-lg);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.page.active {
  display: flex;
  flex-direction: column;
}

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

/* Legacy Navbar - replaced by app-topbar & app-sidebar */
.navbar, #navbar {
  display: none !important;
}
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: rgba(5, 8, 22, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: var(--z-dropdown);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
}

.navbar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.navbar-user .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-full);
  background: var(--gradient-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: white;
}

/* Topic Navigation Buttons & Active States */
.nav-topic-btn {
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  border-radius: var(--border-radius-md);
  font-weight: 700;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.nav-topic-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-topic-btn.active,
.nav-topic-btn#nav-btn-lastoria.active {
  background: rgba(246, 166, 35, 0.16) !important;
  color: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 12px rgba(246, 166, 35, 0.3) !important;
}

.nav-topic-btn#nav-btn-saints.active {
  background: rgba(236, 72, 153, 0.18) !important;
  color: #f472b6 !important;
  border-color: #ec4899 !important;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.35) !important;
}

.nav-topic-btn#nav-btn-church-docs.active {
  background: rgba(168, 85, 247, 0.18) !important;
  color: #c084fc !important;
  border-color: #a855f7 !important;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.35) !important;
}

.nav-topic-btn#nav-btn-logos.active {
  background: rgba(59, 130, 246, 0.18) !important;
  color: #60a5fa !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.35) !important;
}

.nav-topic-btn#nav-btn-dashboard.active {
  background: rgba(0, 212, 170, 0.16) !important;
  color: var(--accent-success) !important;
  border-color: var(--accent-success) !important;
  box-shadow: 0 0 12px rgba(0, 212, 170, 0.3) !important;
}

@media (max-width: 900px) {
  .navbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }
  .navbar-actions {
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .navbar-actions::-webkit-scrollbar {
    display: none;
  }
  .nav-topic-btn {
    white-space: nowrap;
    font-size: 0.78rem;
    padding: 5px 8px;
  }
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 20px;
  border: none;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  word-break: break-word;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-sm), 0 0 15px rgba(246, 166, 35, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-glow-accent);
}

.btn-secondary {
  background: var(--gradient-secondary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-glow-secondary);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}

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

.btn-danger {
  background: linear-gradient(135deg, #ff4757 0%, #ff3838 100%);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 20px rgba(255, 71, 87, 0.3);
}

.btn-success {
  background: linear-gradient(135deg, #2ed573 0%, #17c553 100%);
  color: white;
}

.btn-success:hover {
  transform: translateY(-2px);
}

.btn-accent {
  background: linear-gradient(135deg, #70a1ff 0%, #7053ff 50%, #ff70a6 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(112, 83, 255, 0.35);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(112, 83, 255, 0.5);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: var(--border-radius-sm);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.1rem;
  border-radius: var(--border-radius-lg);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--border-radius-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-normal);
}

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

.card-glass {
  background: var(--gradient-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: var(--space-xl);
}

.card-elevated {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

/* ============================================
   Forms
   ============================================ */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.02em;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition-normal);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(246, 166, 35, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%23a0a0c0'%3E%3Cpath d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-error {
  color: var(--accent-danger);
  font-size: 0.8rem;
  margin-top: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.form-hint {
  color: var(--text-tertiary);
  font-size: 0.8rem;
  margin-top: var(--space-xs);
}

/* ============================================
   Landing Page
   ============================================ */
.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  text-align: center;
  gap: var(--space-xl);
  padding: var(--space-2xl) var(--space-lg);
}

.landing-icon {
  width: 104px;
  height: 104px;
  background: linear-gradient(135deg, rgba(229, 169, 59, 0.25) 0%, rgba(158, 27, 50, 0.35) 100%);
  border: 2px solid var(--accent-primary);
  border-radius: var(--border-radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 25px rgba(229, 169, 59, 0.35);
  animation: float 3s ease-in-out infinite;
  backdrop-filter: blur(12px);
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.landing-title {
  font-size: clamp(2.2rem, 5.5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.18;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.landing-title .highlight,
.highlight-lastoria {
  background: linear-gradient(135deg, #fff2b2 0%, #e5a93b 50%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 14px rgba(229, 169, 59, 0.4));
}

.landing-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 720px;
  font-family: var(--font-malayalam);
  line-height: 1.8;
}

.landing-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}

.landing-stats {
  display: flex;
  gap: var(--space-2xl);
  margin-top: var(--space-xl);
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================
   Auth Pages (Login / Register)
   ============================================ */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: var(--space-xl);
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-xl);
  padding: var(--space-2xl);
  animation: slideUp 0.5s ease forwards;
}

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

.auth-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.auth-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-lg);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

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

/* ============================================
   Dashboard
   ============================================ */
.dashboard-header {
  margin-bottom: var(--space-2xl);
}

.dashboard-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: var(--space-sm);
}

.dashboard-header p {
  color: var(--text-secondary);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  transition: all var(--transition-normal);
}

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

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-card .stat-icon.gold { background: rgba(246, 166, 35, 0.15); }
.stat-card .stat-icon.purple { background: rgba(108, 99, 255, 0.15); }
.stat-card .stat-icon.teal { background: rgba(0, 212, 170, 0.15); }
.stat-card .stat-icon.red { background: rgba(255, 71, 87, 0.15); }

.stat-card .stat-info h3 {
  font-size: 1.5rem;
  font-weight: 800;
}

.stat-card .stat-info p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ============================================
   Quiz Cards
   ============================================ */
.quiz-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

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

.quiz-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}

.quiz-card-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.quiz-card-portion {
  font-family: var(--font-malayalam);
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.quiz-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.quiz-card-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--border-radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.badge-live {
  background: rgba(46, 213, 115, 0.15);
  color: var(--accent-success);
  border: 1px solid rgba(46, 213, 115, 0.3);
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(46, 213, 115, 0); }
}

.badge-upcoming {
  background: rgba(30, 144, 255, 0.15);
  color: var(--accent-info);
  border: 1px solid rgba(30, 144, 255, 0.3);
}

.badge-closed {
  background: rgba(160, 160, 192, 0.1);
  color: var(--text-tertiary);
  border: 1px solid rgba(160, 160, 192, 0.2);
}

.badge-published {
  background: rgba(246, 166, 35, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(246, 166, 35, 0.3);
}

.badge-completed {
  background: rgba(108, 99, 255, 0.15);
  color: var(--accent-secondary);
  border: 1px solid rgba(108, 99, 255, 0.3);
}

/* ============================================
   Quiz Taking Page
   ============================================ */
.quiz-page-container {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* Timer */
.quiz-timer-bar {
  position: sticky;
  top: 65px;
  z-index: 10;
  background: rgba(5, 8, 22, 0.9);
  backdrop-filter: blur(10px);
  padding: var(--space-md) 0;
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.quiz-timer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.quiz-timer-display {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.quiz-timer-display.warning {
  color: var(--accent-warning);
  animation: blink 1s ease-in-out infinite;
}

.quiz-timer-display.danger {
  color: var(--accent-danger);
  animation: blink 0.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.quiz-progress {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-full);
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--border-radius-full);
  transition: width 1s linear;
}

.quiz-progress-fill.warning {
  background: linear-gradient(135deg, #ffa502, #ff6348);
}

.quiz-progress-fill.danger {
  background: linear-gradient(135deg, #ff4757, #ff3838);
}

/* Question Navigation Dots */
.quiz-nav-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: var(--space-xl);
}

.quiz-nav-dot {
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-light);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-nav-dot:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.quiz-nav-dot.active {
  background: var(--gradient-primary);
  color: var(--text-on-accent);
  border-color: transparent;
  transform: scale(1.1);
}

.quiz-nav-dot.answered {
  background: rgba(108, 99, 255, 0.2);
  border-color: var(--accent-secondary);
  color: var(--accent-secondary-light);
}

/* Question Card */
.question-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-xl);
  padding: var(--space-2xl);
  animation: fadeInQuestion 0.3s ease forwards;
}

@keyframes fadeInQuestion {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.question-number {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.question-text {
  font-family: var(--font-malayalam);
  font-size: 1.15rem;
  line-height: 2;
  color: var(--text-primary);
  margin-bottom: var(--space-xl);
  font-weight: 500;
}

/* Option Cards */
.options-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.option-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
}

.option-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-primary);
  transform: translateX(4px);
}

.option-card.selected {
  background: rgba(108, 99, 255, 0.1);
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.2);
}

.option-card input[type="radio"] {
  display: none;
}

.option-letter {
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-sm);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all var(--transition-normal);
  flex-shrink: 0;
}

.option-card.selected .option-letter {
  background: var(--gradient-secondary);
  color: white;
}

.option-text {
  font-family: var(--font-malayalam);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
}

/* Answer Key Styles */
.option-card.correct {
  background: rgba(46, 213, 115, 0.08);
  border-color: var(--accent-success);
}

.option-card.correct .option-letter {
  background: linear-gradient(135deg, #2ed573, #17c553);
  color: white;
}

.option-card.wrong {
  background: rgba(255, 71, 87, 0.08);
  border-color: var(--accent-danger);
}

.option-card.wrong .option-letter {
  background: linear-gradient(135deg, #ff4757, #ff3838);
  color: white;
}

/* Quiz Actions */
.quiz-actions {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-xl);
  gap: var(--space-md);
}

/* ============================================
   Results & Score Display
   ============================================ */
.score-reveal {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  animation: scoreIn 0.8s ease forwards;
}

@keyframes scoreIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.score-circle {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  margin: 0 auto var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.score-circle::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 4px;
  background: var(--gradient-primary);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.score-circle .score-value {
  font-size: 3.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.score-circle .score-total {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

.score-message {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.score-detail {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ============================================
   Leaderboard
   ============================================ */
.leaderboard-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 var(--space-sm);
}

.leaderboard-table th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  color: var(--text-tertiary);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.leaderboard-table td {
  padding: var(--space-md);
  background: var(--bg-card);
  font-size: 0.9rem;
}

.leaderboard-table tr td:first-child {
  border-radius: var(--border-radius-md) 0 0 var(--border-radius-md);
}

.leaderboard-table tr td:last-child {
  border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
}

.leaderboard-rank {
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.rank-1 {
  background: linear-gradient(135deg, #f6a623, #ff8c00);
  color: white;
}

.rank-2 {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
  color: white;
}

.rank-3 {
  background: linear-gradient(135deg, #cd7f32, #a0652f);
  color: white;
}

.rank-other {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.leaderboard-name {
  font-weight: 600;
}

.leaderboard-parish {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.leaderboard-score {
  font-weight: 700;
  font-size: 1.1rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   Admin Tabs
   ============================================ */
.tabs {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--border-radius-md);
  padding: 4px;
  margin-bottom: var(--space-xl);
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
  animation: tabIn 0.3s ease forwards;
}

.tab-content.active {
  display: block;
}

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

/* ============================================
   Admin Table (Quiz Management)
   ============================================ */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.data-table thead th {
  text-align: left;
  padding: var(--space-md);
  color: var(--text-tertiary);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

.data-table thead th.sortable:hover {
  color: var(--accent-primary);
}

.data-table thead th .sort-icon {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.4;
  font-size: 0.75rem;
  transition: all var(--transition-fast);
}

.data-table thead th.sortable:hover .sort-icon,
.data-table thead th.active-sort .sort-icon {
  opacity: 1;
  color: var(--accent-primary);
}

.data-table thead th.active-sort {
  color: var(--accent-primary);
}

.data-table tbody td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.data-table .actions-cell {
  display: flex;
  gap: var(--space-sm);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--border-radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: toastIn 0.3s ease forwards;
  min-width: 280px;
  max-width: 400px;
}

.toast.success { border-left: 3px solid var(--accent-success); }
.toast.error { border-left: 3px solid var(--accent-danger); }
.toast.info { border-left: 3px solid var(--accent-info); }
.toast.warning { border-left: 3px solid var(--accent-warning); }

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

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-xl);
  max-width: 500px;
  width: 100%;
  padding: var(--space-2xl);
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.3s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  word-break: break-word;
  overflow-wrap: break-word;
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 360px;
  margin: 0 auto;
}

/* ============================================
   JSON Preview
   ============================================ */
.json-preview {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: var(--space-lg);
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   Animations
   ============================================ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--border-radius-sm);
}

/* Confetti effect */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  z-index: var(--z-toast);
  pointer-events: none;
  animation: confettiFall 3s ease-in forwards;
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) rotate(720deg);
  }
}

/* ============================================
   Responsive
   ============================================ */
/* ============================================
   Mobile Responsive — 768px (Tablet)
   ============================================ */
@media (max-width: 768px) {
  .page {
    padding: var(--space-md);
  }

  /* ---- Navbar ---- */
  .navbar {
    padding: var(--space-sm) var(--space-md);
    flex-wrap: nowrap;
  }

  .navbar-brand > div > div:last-child {
    display: none; /* hide "Nedumangad Forane" subtitle */
  }

  .navbar-actions {
    gap: var(--space-sm);
  }

  .navbar-countdown {
    font-size: 0.7rem !important;
    padding: 3px 8px !important;
    gap: 2px !important;
  }

  /* Hide the user name text, keep avatar */
  #nav-user-name {
    display: none;
  }

  /* Hide "Dashboard" nav button text on narrow screens */
  #nav-btn-dashboard {
    font-size: 0;
    padding: 6px 10px;
  }
  #nav-btn-dashboard::before {
    content: '🏠';
    font-size: 1rem;
  }

  #nav-btn-logout {
    font-size: 0.75rem;
    padding: 6px 10px;
  }

  /* ---- Auth / Forms ---- */
  .auth-card {
    padding: var(--space-lg);
  }

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

  /* ---- Landing ---- */
  .landing-hero {
    padding: var(--space-xl) var(--space-md);
  }

  .landing-stats {
    gap: var(--space-md);
    flex-wrap: wrap;
  }

  .stat-value {
    font-size: 1.3rem;
  }

  /* ---- Dashboard ---- */
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  /* ---- Chapter detail page: collapse 2-col layout to single column ---- */
  .learn-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: unset !important;
    gap: var(--space-lg) !important;
  }

  .learn-sidebar {
    width: 100% !important;
  }

  .learn-main-panel {
    width: 100% !important;
  }

  /* ---- Tabs — wrapped and fully visible ---- */
  .tabs {
    gap: 6px !important;
    overflow-x: visible !important;
    flex-wrap: wrap !important;
    padding: 4px !important;
  }

  .tab-btn {
    padding: 8px 12px !important;
    font-size: 0.8rem !important;
    white-space: nowrap !important;
    flex-grow: 1 !important;
    text-align: center !important;
  }

  /* ---- Self Study split layout — stack vertically on mobile ---- */
  .learn-split-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: unset !important;
    gap: 0 !important;
    min-height: unset !important;
  }

  .books-list {
    border-right: none !important;
    border-bottom: 1px solid var(--border-subtle);
    padding-right: 0 !important;
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-md);
    width: 100% !important;
  }

  /* Mobile panel toggling */
  .learn-split-layout.chapters-shown .books-list {
    display: none !important;
  }

  .learn-split-layout.chapters-shown .chapters-view-container {
    display: block !important;
  }

  .chapters-view-container {
    width: 100% !important;
  }

  .mobile-back-btn {
    display: inline-flex !important;
  }

  /* ---- Quiz page ---- */
  .question-card {
    padding: var(--space-md);
  }

  .options-grid {
    grid-template-columns: 1fr !important;
  }

  .option-card {
    padding: var(--space-md) !important;
  }

  .quiz-actions {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .quiz-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .quiz-timer-inner {
    flex-wrap: wrap;
  }

  /* ---- Score / Result ---- */
  .score-circle {
    width: 140px;
    height: 140px;
  }

  .score-circle .score-value {
    font-size: 2.5rem;
  }

  /* ---- Tables ---- */
  .leaderboard-table,
  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ---- Toast ---- */
  .toast-container {
    right: var(--space-md);
    left: var(--space-md);
  }

  .toast {
    min-width: auto;
    max-width: none;
  }

  /* ---- Modal ---- */
  .modal {
    padding: var(--space-md);
    margin: var(--space-sm);
    max-height: 90vh;
    overflow-y: auto;
  }

  /* ---- Quiz Info / Countdown Page ---- */
  #page-quiz-info .card {
    padding: var(--space-lg) var(--space-md) !important;
  }

  #quiz-info-countdown {
    font-size: clamp(1.1rem, 5vw, 1.5rem) !important;
    word-break: break-word;
  }
}

/* ============================================
   Mobile Responsive — 480px (Phone)
   ============================================ */
@media (max-width: 480px) {
  /* ---- Navbar ---- */
  .navbar-countdown {
    display: none !important; /* Hide header countdown on narrow phones to avoid navbar overlap */
  }

  .navbar-brand .brand-icon {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }

  .navbar-brand > div > div:first-child {
    font-size: 0.85rem !important;
  }

  /* ---- Landing ---- */
  .landing-title {
    font-size: 1.75rem;
  }

  .landing-actions {
    flex-direction: column;
    width: 100%;
  }

  .landing-actions .btn {
    width: 100%;
  }

  /* Countdown timer boxes — fit in a row on tiny screens */
  #exam-countdown [style*="min-width: 80px"] {
    min-width: 60px !important;
    padding: 8px 4px !important;
  }

  #exam-countdown [style*="font-size: 2.25rem"] {
    font-size: 1.6rem !important;
  }

  /* ---- Quiz navigation dots ---- */
  .quiz-nav-dots {
    gap: 4px !important;
  }

  .quiz-nav-dot {
    width: 28px;
    height: 28px;
    font-size: 0.65rem;
  }

  /* ---- Chapter cards — full width on phones ---- */
  #chapters-view-container [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* ---- Section/age pill in dashboard header ---- */
  .user-section-pill {
    font-size: 0.7rem !important;
    padding: 3px 10px !important;
  }

  /* ---- Modal Footer Stacking on Phones ---- */
  .modal-footer {
    flex-direction: column-reverse;
    gap: var(--space-xs);
  }

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

/* ============================================
   Learn Bible Custom Styles
   ============================================ */

.book-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: var(--space-md) var(--space-lg);
  transition: all var(--transition-normal);
}

.book-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary-light);
  box-shadow: 0 4px 20px rgba(246, 166, 35, 0.15);
}

.book-card-container.active .book-card {
  border-color: var(--accent-primary);
  background: rgba(246, 166, 35, 0.03);
}

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

.chapters-drawer {
  transition: max-height 0.3s ease-out;
}

.difficulty-option-card:hover {
  transform: scale(1.02);
  border-color: var(--text-secondary) !important;
}

.difficulty-option-card.active {
  transform: scale(1.02);
}

.option-card.selected {
  border-color: var(--accent-secondary) !important;
  background: rgba(108, 99, 255, 0.08) !important;
}

.option-card.selected .option-letter {
  background: var(--accent-secondary) !important;
  color: #fff !important;
  border-color: var(--accent-secondary) !important;
}

.chapter-card {
  transition: all 0.2s ease !important;
}

.chapter-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-color: var(--accent-primary) !important;
  background: rgba(255,255,255,0.03) !important;
}

/* ============================================
   Help Onboarding Tour Styles
   ============================================ */
.tour-highlight {
  box-shadow: 0 0 15px var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  transition: all 0.3s ease !important;
}

#tour-backdrop {
  animation: fadeIn 0.3s forwards;
}

#tour-tooltip {
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ============================================
   La Storia Reading View — Animated Card Deck
   ============================================ */
.lastoria-card-stage {
  perspective: 1200px;
  position: relative;
  width: 100%;
  margin: var(--space-md) 0;
}

.lastoria-card {
  position: relative;
  background: linear-gradient(145deg, rgba(20, 27, 52, 0.95), rgba(13, 18, 36, 0.98));
  border: 1.5px solid rgba(229, 169, 59, 0.3);
  border-radius: var(--border-radius-lg);
  padding: var(--space-xl);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 24px rgba(229, 169, 59, 0.08);
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
  user-select: text;
  touch-action: pan-y;
}

/* Animations for Next/Prev transitions */
.lastoria-card.slide-next-out {
  animation: cardFlipNextOut 0.26s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.lastoria-card.slide-next-in {
  animation: cardFlipNextIn 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.lastoria-card.slide-prev-out {
  animation: cardFlipPrevOut 0.26s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.lastoria-card.slide-prev-in {
  animation: cardFlipPrevIn 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes cardFlipNextOut {
  0% {
    transform: translateX(0) rotateY(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateX(-40px) rotateY(-22deg) scale(0.94);
    opacity: 0;
  }
}

@keyframes cardFlipNextIn {
  0% {
    transform: translateX(40px) rotateY(22deg) scale(0.94);
    opacity: 0;
  }
  100% {
    transform: translateX(0) rotateY(0deg) scale(1);
    opacity: 1;
  }
}

@keyframes cardFlipPrevOut {
  0% {
    transform: translateX(0) rotateY(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateX(40px) rotateY(22deg) scale(0.94);
    opacity: 0;
  }
}

@keyframes cardFlipPrevIn {
  0% {
    transform: translateX(-40px) rotateY(-22deg) scale(0.94);
    opacity: 0;
  }
  100% {
    transform: translateX(0) rotateY(0deg) scale(1);
    opacity: 1;
  }
}

/* Heart / Like Button & Animation */
.lastoria-heart-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--border-radius-full);
  padding: 6px 14px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lastoria-heart-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  transform: translateY(-1px);
}

.lastoria-heart-btn.is-liked {
  background: rgba(239, 68, 68, 0.16);
  border-color: #ef4444;
  color: #ff6b6b;
}

.lastoria-heart-icon {
  font-size: 1.15rem;
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lastoria-heart-btn.pop .lastoria-heart-icon {
  animation: heartPopAnim 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes heartPopAnim {
  0% { transform: scale(1); }
  50% { transform: scale(1.6) rotate(-10deg); }
  75% { transform: scale(1.2) rotate(6deg); }
  100% { transform: scale(1); }
}

/* Reading Progress Bar & Pagination Dots */
.lastoria-progress-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--space-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 12px 16px;
}

.lastoria-progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.lastoria-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #e5a93b, #fcd34d, #10b981);
  border-radius: 9999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(229, 169, 59, 0.4);
}

.lastoria-dots-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: var(--space-sm) 0;
}

.lastoria-dot {
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-tertiary);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lastoria-dot:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.lastoria-dot.active {
  background: var(--accent-primary);
  color: #070913;
  border-color: var(--accent-primary-light);
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(229, 169, 59, 0.5);
}

.lastoria-dot.read {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #10b981;
}

.lastoria-dot.read.active {
  background: #10b981;
  color: #070913;
  border-color: #34d399;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

@media (max-width: 640px) {
  .lastoria-card {
    padding: var(--space-md) var(--space-lg);
  }
  .lastoria-dot {
    min-width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }
}

/* ==========================================================================
   MODERN REIMAGINED UI/UX DESIGN SYSTEM (Matching Uploaded Mockups)
   ========================================================================== */

/* ---- App Shell Master Grid Layout ---- */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
  background: var(--bg-primary);
}

/* ---- Left Fixed Sidebar ---- */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 14px;
  overflow-y: auto;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 6px 18px 6px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.sidebar-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1;
  padding: 0;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--text-primary);
  transform: scale(1.06);
}

.sidebar-close-btn:active {
  transform: scale(0.94);
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 140;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

body.sidebar-open {
  overflow: hidden;
}

.sidebar-logo-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.sidebar-subtitle {
  font-size: 0.68rem;
  color: var(--accent-primary-light);
  font-weight: 600;
  line-height: 1.3;
}

/* Nav Menu */
.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.sidebar-link-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-link .nav-icon {
  font-size: 1.15rem;
  line-height: 1;
  width: 22px;
  display: inline-flex;
  justify-content: center;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  transform: translateX(2px);
}

.sidebar-link.active {
  background: rgba(245, 166, 35, 0.14);
  color: var(--accent-primary);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--accent-primary);
}

/* ---- Submenus in Left Sidebar ---- */
.sidebar-item-group {
  display: flex;
  flex-direction: column;
}

.sidebar-link-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--border-radius-md);
  position: relative;
  transition: all var(--transition-fast);
}

.sidebar-link-wrap:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-link-wrap .sidebar-link {
  flex: 1;
  border-radius: var(--border-radius-md) 0 0 var(--border-radius-md);
}

.sidebar-submenu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 42px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
  font-size: 0.85rem;
}

.sidebar-submenu-toggle:hover {
  color: var(--accent-primary);
}

.sidebar-item-group.open .sidebar-submenu-toggle .submenu-chevron {
  transform: rotate(180deg);
}

.sidebar-submenu {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 8px 14px;
  padding-left: 10px;
  border-left: 2px solid rgba(255, 255, 255, 0.08);
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-submenu::-webkit-scrollbar {
  width: 3px;
}
.sidebar-submenu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.sidebar-submenu.open {
  display: flex;
}

.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-sublink:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  padding-left: 12px;
}

.sidebar-sublink.active {
  background: rgba(245, 166, 35, 0.14);
  color: var(--accent-primary);
  font-weight: 700;
  border-left: 2px solid var(--accent-primary);
  margin-left: -12px;
  padding-left: 10px;
}

.sidebar-sublink-num {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--accent-primary);
  background: rgba(245, 166, 35, 0.12);
  padding: 1px 5px;
  border-radius: 4px;
  min-width: 20px;
  text-align: center;
}

.sidebar-sublink-bullet {
  font-size: 0.82rem;
  line-height: 1;
}

.sidebar-sublink-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Language Toggle Button in Topbar & Sidebar */
.topbar-lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  height: 38px;
  border-radius: var(--border-radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.topbar-lang-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.sidebar-lang-badge {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--accent-primary);
  background: rgba(245, 166, 35, 0.15);
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: auto;
}

/* Today's Goal Ring Widget (Image 1) */
.sidebar-goal-widget {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 12px 14px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.goal-ring-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.goal-ring-svg {
  width: 44px;
  height: 44px;
  transform: rotate(-90deg);
}

.goal-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 4;
}

.goal-ring-fill {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 40; /* 60% progress */
  transition: stroke-dashoffset 0.6s ease;
}

.goal-ring-text {
  position: absolute;
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffffff;
}

.goal-info {
  flex: 1;
}

.goal-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.goal-sub {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.goal-chevron {
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

/* Sidebar Footer (Settings / Logout) */
.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ---- Main Content Wrapper ---- */
.app-main-wrap {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Top Header Bar (Image 1 & 2) ---- */
.app-topbar {
  height: var(--topbar-height);
  background: var(--bg-topbar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 16px;
}

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

.topbar-mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
}

.topbar-search-box {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.topbar-search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-tertiary);
  font-size: 0.95rem;
  pointer-events: none;
}

.topbar-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-full);
  padding: 8px 52px 8px 38px;
  color: #ffffff;
  font-size: 0.88rem;
  transition: all 0.2s ease;
  outline: none;
}

.topbar-search-input:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--accent-primary);
  box-shadow: 0 0 14px rgba(245, 166, 35, 0.2);
}

.topbar-search-kbd {
  position: absolute;
  right: 12px;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Search Dropdown */
.search-results-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  max-height: 380px;
  overflow-y: auto;
  z-index: 500;
  display: none;
}

.search-results-dropdown.active {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Topbar Right Controls */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.topbar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.topbar-badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-danger);
  border: 2px solid var(--bg-sidebar);
}

.topbar-profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-full);
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topbar-profile-chip:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-username {
  font-size: 0.88rem;
  font-weight: 600;
  color: #ffffff;
}

/* ---- REIMAGINED DASHBOARD OVERVIEW (Image 1) ---- */

.dash-hero-banner {
  position: relative;
  min-height: 230px;
  border-radius: var(--border-radius-xl);
  border: 1px solid rgba(245, 166, 35, 0.25);
  background: linear-gradient(90deg, #1d140a 0%, #291a0c 40%, rgba(27, 18, 10, 0.82) 70%, rgba(27, 18, 10, 0.4) 100%),
              url('https://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Saint_Francis_of_Assisi_by_Jusepe_de_Ribera.jpg/800px-Saint_Francis_of_Assisi_by_Jusepe_de_Ribera.jpg') right center / cover no-repeat;
  padding: 34px 38px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 24px rgba(245, 166, 35, 0.08);
  margin-bottom: 24px;
}

.dash-hero-left {
  max-width: 620px;
  z-index: 2;
}

.dash-hero-greeting {
  font-size: 0.95rem;
  color: #d1d5db;
  font-weight: 500;
  margin-bottom: 4px;
}

.dash-hero-name {
  font-size: 2.2rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 10px 0;
  letter-spacing: -0.02em;
  font-family: var(--font-display);
}

.dash-hero-quote {
  font-size: 0.96rem;
  color: #e2e8f0;
  font-style: italic;
  line-height: 1.7;
  margin-bottom: 20px;
}

.dash-hero-btn {
  background: var(--accent-primary);
  color: #0d0f1a !important;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 10px 24px;
  border-radius: var(--border-radius-full);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(245, 166, 35, 0.45);
  transition: all 0.25s ease;
  border: none;
  cursor: pointer;
}

.dash-hero-btn:hover {
  background: var(--accent-primary-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(245, 166, 35, 0.6);
}

.dash-hero-right {
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--border-radius-lg);
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.dash-hero-right:hover {
  background: rgba(0, 0, 0, 0.65);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.dash-hero-saint-info h4 {
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.dash-hero-saint-info p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 2px 0 0 0;
}

.dash-hero-arrow-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  font-size: 1.1rem;
}

/* 4 Topic Cards Row (Image 1) */
.dash-topic-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.topic-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.topic-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.topic-card-bg-art {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 48%;
  background-size: cover;
  background-position: center;
  opacity: 0.22;
  mix-blend-mode: luminosity;
  pointer-events: none;
  transition: opacity 0.3s ease;
  mask-image: linear-gradient(to right, transparent, black 60%);
  -webkit-mask-image: linear-gradient(to right, transparent, black 60%);
}

.topic-card:hover .topic-card-bg-art {
  opacity: 0.38;
}

.topic-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  z-index: 1;
}

.topic-card-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.topic-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.topic-card-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  z-index: 1;
  line-height: 1.4;
}

.topic-card-action {
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  z-index: 1;
  transition: gap 0.2s ease;
}

.topic-card:hover .topic-card-action {
  gap: 10px;
}

/* Topic Card Themes */
.topic-card.card-lastoria {
  background: linear-gradient(135deg, rgba(245, 166, 35, 0.12) 0%, rgba(22, 24, 46, 0.95) 100%);
  border-color: rgba(245, 166, 35, 0.25);
}
.topic-card.card-lastoria .topic-card-action { color: var(--accent-primary); }

.topic-card.card-saints {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.12) 0%, rgba(22, 24, 46, 0.95) 100%);
  border-color: rgba(236, 72, 153, 0.25);
}
.topic-card.card-saints .topic-card-action { color: var(--accent-secondary); }

.topic-card.card-church-docs {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(22, 24, 46, 0.95) 100%);
  border-color: rgba(59, 130, 246, 0.25);
}
.topic-card.card-church-docs .topic-card-action { color: var(--accent-blue); }

.topic-card.card-bible {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(22, 24, 46, 0.95) 100%);
  border-color: rgba(16, 185, 129, 0.25);
}
.topic-card.card-bible .topic-card-action { color: var(--accent-success); }

/* Main 2-Column Dashboard Grid (Image 1) */
.dash-main-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 24px;
}

.dash-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Learning Progress Card */
.progress-donut-section {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 8px 0;
}

.progress-donut-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  min-width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-svg {
  width: 90px;
  height: 90px;
  transform: rotate(-90deg);
}

.donut-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
}

.donut-fill {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 198; /* ~10% */
}

.donut-center-pct {
  position: absolute;
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  top: 24px;
}

.donut-center-label {
  position: absolute;
  font-size: 0.65rem;
  color: var(--text-tertiary);
  bottom: 22px;
}

.progress-topics-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
}

.progress-topic-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-weight: 600;
  min-width: 140px;
}

.progress-topic-bar-bg {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-topic-bar-fill {
  height: 100%;
  border-radius: 9999px;
}

.progress-topic-count {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 700;
  min-width: 48px;
  text-align: right;
}

/* Quick Actions Grid (2x2) */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.quick-action-item {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-action-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

.quick-action-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quick-action-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.quick-action-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.quick-action-sub {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.quick-action-arrow {
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

/* Recent Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  transition: background 0.2s ease;
}

.activity-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.activity-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.activity-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius-sm);
  object-fit: cover;
}

.activity-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--border-radius-full);
  display: inline-block;
  margin-bottom: 3px;
}

.activity-badge.reading {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.activity-badge.quiz {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.activity-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
}

.activity-sub {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.activity-time {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Key Takeaways Card */
.key-takeaways-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
}

.key-takeaways-list li::marker {
  color: var(--accent-primary);
}

/* ---- STUDY READER & COMPANION SIDEBAR (Image 2) ---- */

.study-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.study-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.study-breadcrumb a:hover {
  color: var(--accent-primary);
}

.study-hero-banner {
  background: linear-gradient(135deg, rgba(245, 166, 35, 0.14) 0%, rgba(22, 24, 46, 0.95) 100%),
              url('https://upload.wikimedia.org/wikipedia/commons/thumb/d/d6/St_Peter%27s_Square%2C_Vatican_City_-_April_2007.jpg/800px-St_Peter%27s_Square%2C_Vatican_City_-_April_2007.jpg') center / cover no-repeat;
  border: 1px solid var(--border-accent);
  border-radius: var(--border-radius-xl);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.study-hero-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.study-hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.study-hero-sub {
  font-size: 0.95rem;
  color: var(--accent-primary-light);
  margin-bottom: 14px;
}

.study-hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.study-hero-progress-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 14px;
  flex-wrap: wrap;
}

.study-hero-progress-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.study-hero-progress-bar {
  flex: 1;
  min-width: 140px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
}

.study-hero-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), #10b981);
  border-radius: 9999px;
}

/* Two-column study layout */
.study-grid-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

/* White High-Contrast Reader Card (Image 2) */
.study-reader-card {
  background: #ffffff;
  color: #1e293b;
  border-radius: var(--border-radius-xl);
  padding: 34px 38px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  position: relative;
  transition: all 0.3s ease;
}

/* Dark mode toggle support for reader */
.study-reader-card.dark-mode {
  background: #16182e;
  color: #f3f4f8;
}

.study-reader-card.dark-mode .reader-section-badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-primary);
}

.study-reader-card.dark-mode .reader-section-title {
  color: #ffffff;
}

.study-reader-card.dark-mode .reader-text {
  color: #cbd5e1;
}

.study-reader-card.dark-mode .reader-quote-box {
  background: rgba(245, 166, 35, 0.08);
  border-left-color: var(--accent-primary);
  color: #fde68a;
}

.reader-section-badge {
  background: #f1f5f9;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 12px;
}

.reader-section-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 18px 0;
  line-height: 1.35;
}

.reader-text {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #334155;
  margin-bottom: 20px;
}

.reader-inline-img {
  float: right;
  width: 280px;
  max-width: 45%;
  margin: 0 0 16px 20px;
  border-radius: var(--border-radius-md);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.reader-quote-box {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  padding: 14px 18px;
  border-radius: 6px;
  margin: 22px 0;
  color: #92400e;
  font-style: italic;
  font-size: 0.98rem;
  line-height: 1.7;
  clear: both;
}

.reader-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #e2e8f0;
  padding-top: 20px;
  margin-top: 24px;
}

.study-reader-card.dark-mode .reader-pagination-bar {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.reader-page-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--border-radius-md);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #1e293b;
  transition: all 0.2s ease;
}

.reader-page-btn.btn-gold {
  background: var(--accent-primary);
  color: #0f172a;
  border-color: var(--accent-primary-dark);
  box-shadow: 0 4px 12px rgba(245, 166, 35, 0.35);
}

.reader-page-btn.btn-gold:hover {
  background: var(--accent-primary-light);
  transform: translateY(-1px);
}

/* Study Companion Right Sidebar (Image 2) */
.study-companion-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.study-quiz-cta-btn {
  background: linear-gradient(135deg, #fbbf24 0%, #f5a623 100%);
  color: #0f172a !important;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 18px 24px;
  border-radius: var(--border-radius-lg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(245, 166, 35, 0.4);
  transition: all 0.25s ease;
  width: 100%;
}

.study-quiz-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(245, 166, 35, 0.55);
}

.companion-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 18px 20px;
}

.companion-panel-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.companion-section-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 4px;
}

.companion-section-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.companion-section-item.active {
  background: rgba(245, 166, 35, 0.14);
  color: var(--accent-primary);
  font-weight: 700;
}

.companion-related-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--border-radius-sm);
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.15s ease;
  margin-bottom: 6px;
}

.companion-related-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.companion-related-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  object-fit: cover;
}

.companion-resource-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  text-decoration: none;
  margin-bottom: 8px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.companion-resource-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
  .dash-topic-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-main-grid {
    grid-template-columns: 1fr;
  }
  .study-grid-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 992px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: 290px;
    max-width: 86vw;
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.85);
  }
  .sidebar-close-btn {
    display: inline-flex;
  }
  .app-main-wrap {
    margin-left: 0;
  }
  .topbar-mobile-toggle {
    display: flex;
  }
  .dash-hero-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    padding: 24px;
  }
}

@media (max-width: 640px) {
  .dash-topic-grid {
    grid-template-columns: 1fr;
  }
  .quick-actions-grid {
    grid-template-columns: 1fr;
  }
  .progress-donut-section {
    flex-direction: column;
    align-items: flex-start;
  }
  .app-topbar {
    padding: 0 16px;
  }
  .study-reader-card {
    padding: 20px 18px;
  }
  .reader-inline-img {
    float: none;
    width: 100%;
    max-width: 100%;
    margin: 14px 0;
  }
}




/* Logged out state */
body.logged-out .app-sidebar { display: none !important; }
body.logged-out .app-main-wrap { margin-left: 0 !important; }
body.logged-out .topbar-mobile-toggle { display: none !important; }

body.light-theme {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;
  --bg-surface: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-card-alt: #ffffff;
  --bg-glass: rgba(0, 0, 0, 0.04);
  --bg-glass-hover: rgba(0, 0, 0, 0.08);
  --bg-sidebar: #ffffff;
  --bg-topbar: rgba(255, 255, 255, 0.95);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-accent: #d97706;
  --text-on-accent: #ffffff;
  --border-subtle: rgba(0, 0, 0, 0.1);
  --border-light: rgba(0, 0, 0, 0.15);
  --border-accent: rgba(217, 119, 6, 0.35);
  --gradient-glass: linear-gradient(135deg, rgba(0,0,0,0.02) 0%, rgba(0,0,0,0.05) 100%);
  --gradient-dark: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
}
