/* ==========================================================================
   تبيان - Tibyan Quran Memorization Platform Stylesheet
   Design System: Luxury Emerald & Warm Gold Theme System (Light & Dark)
   Enhanced Layout & Mobile Responsiveness Edition
   ========================================================================== */

:root {
  --font-ui: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-quran: 'Amiri', 'Scheherazade New', serif;

  --emerald-900: #064e3b;
  --emerald-800: #065f46;
  --emerald-700: #047857;
  --emerald-600: #059669;
  --emerald-500: #10b981;
  --emerald-400: #34d399;
  --emerald-100: rgba(16, 185, 129, 0.15);
  --emerald-50:  rgba(16, 185, 129, 0.08);

  --gold-600: #d97706;
  --gold-500: #f59e0b;
  --gold-400: #fbbf24;
  --gold-100: rgba(245, 158, 11, 0.15);

  --blue-600: #2563eb;
  --blue-100: rgba(59, 130, 246, 0.15);

  --purple-600: #9333ea;
  --purple-100: rgba(147, 51, 234, 0.15);

  --border-radius-sm: 12px;
  --border-radius-md: 18px;
  --border-radius-lg: 26px;

  --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Theme Variables Overrides (Light Mode vs Dark Mode)
   ========================================================================== */

/* Dark Mode (Default) */
body, body.dark-mode {
  --bg-primary: #030712;
  --bg-secondary: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.9);
  --bg-input: rgba(30, 41, 59, 0.8);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(16, 185, 129, 0.4);
  --box-shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.25);
  --box-shadow-md: 0 12px 32px rgba(0, 0, 0, 0.4);
  --box-shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.6);
}

/* Light Mode */
body.light-mode {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.95);
  --bg-input: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --border-color: rgba(203, 213, 225, 0.8);
  --border-hover: rgba(5, 150, 105, 0.4);
  --box-shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.04);
  --box-shadow-md: 0 10px 30px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.03);
  --box-shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.1);
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
  direction: rtl;
  min-height: 100vh;
  position: relative;
}

/* Ambient Background Orbs */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(100px);
  z-index: 0;
}
.ambient-glow.orb-1 {
  top: -10%;
  right: 15%;
  width: min(600px, 85vw);
  height: min(600px, 85vw);
  background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, transparent 70%);
}
.ambient-glow.orb-2 {
  top: 35%;
  left: -10%;
  width: min(500px, 80vw);
  height: min(500px, 80vw);
  background: radial-gradient(circle, rgba(245, 158, 11, 0.1) 0%, transparent 70%);
}
.ambient-glow.orb-3 {
  bottom: 5%;
  right: 20%;
  width: min(550px, 80vw);
  height: min(550px, 80vw);
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--emerald-600);
  border-radius: 4px;
}

/* App Main Layout Container */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Header Styling
   ========================================================================== */
.main-header {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.85rem 1.5rem;
  box-shadow: var(--box-shadow-sm);
}

.header-content {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.back-hub-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--emerald-600);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: all var(--transition-fast);
}
.back-hub-btn:hover {
  background: var(--emerald-100);
  border-color: var(--emerald-500);
  transform: translateX(3px);
}

.logo-icon {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--emerald-700), var(--emerald-500));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.4rem;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1.1;
}
.brand-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Header Navigation Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  padding: 5px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-btn:hover {
  color: var(--emerald-600);
  background: rgba(16, 185, 129, 0.08);
}

.nav-btn.active {
  background: linear-gradient(135deg, var(--emerald-600), var(--emerald-500));
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}
.icon-btn:hover {
  border-color: var(--emerald-500);
  color: var(--emerald-600);
  transform: translateY(-2px);
}
.icon-btn.danger:hover {
  border-color: #f87171;
  color: #f87171;
}

/* ==========================================================================
   Hero Progress Banner - High-Contrast Emerald Card
   ========================================================================== */
.hero-banner {
  max-width: 1300px;
  margin: 1.5rem auto 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

.banner-content {
  background: linear-gradient(145deg, #064e3b 0%, #047857 60%, #065f46 100%);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  box-shadow: 0 20px 40px rgba(6, 78, 59, 0.25);
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 2rem;
  align-items: center;
  color: #ffffff !important;
}

.progress-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.badge-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #34d399 !important;
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 12px;
  border-radius: 9999px;
  margin-bottom: 0.5rem;
}

.progress-details h2 {
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 900;
  color: #ffffff !important;
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.progress-details p {
  font-size: 0.9rem;
  color: #e2e8f0 !important;
  font-weight: 600;
}

.circular-progress-wrapper {
  position: relative;
  width: 105px;
  height: 105px;
  flex-shrink: 0;
}

.circular-progress {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.circular-progress circle {
  fill: none;
  stroke-width: 10;
}

.circular-progress circle.bg {
  stroke: rgba(255, 255, 255, 0.15);
}

.circular-progress circle.meter {
  stroke: #fbbf24;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease;
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.5));
}

.inner-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #34d399;
}

/* Quick Stats Grid */
.quick-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.18);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.stat-info .number {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff !important;
  line-height: 1.2;
}

.stat-info .label {
  font-size: 0.8rem;
  color: #cbd5e1 !important;
  font-weight: 600;
}

/* ==========================================================================
   Main Content Area & Tabs
   ========================================================================== */
.main-content {
  max-width: 1300px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  width: 100%;
  flex: 1;
}

.tab-view {
  display: none;
  animation: fadeIn 0.4s ease;
}

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

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

/* Filter Controls Bar */
.filter-controls-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1 1 300px;
}

.search-box i {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 12px 46px 12px 16px;
  border-radius: var(--border-radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 3px var(--emerald-100);
}

.filter-scroll-wrapper {
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  color: var(--emerald-600);
  border-color: var(--border-hover);
}

.filter-btn.active {
  background: var(--emerald-100);
  border-color: var(--emerald-500);
  color: var(--emerald-600);
}

.custom-select {
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

/* ==========================================================================
   Surahs Grid & Cards Fix
   ========================================================================== */
.surahs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}

.surah-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column; /* Corrected CSS syntax */
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--box-shadow-sm);
}

.surah-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-hover);
  box-shadow: var(--box-shadow-md);
}

.surah-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.surah-num-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--emerald-100);
  color: var(--emerald-600);
  font-weight: 900;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(16, 185, 129, 0.3);
  flex-shrink: 0;
}

.status-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 9999px;
  white-space: nowrap;
}
.status-badge.not_started { background: rgba(148, 163, 184, 0.12); color: var(--text-muted); }
.status-badge.in_progress { background: var(--gold-100); color: var(--gold-600); }
.status-badge.needs_review { background: var(--blue-100); color: var(--blue-600); }
.status-badge.completed { background: var(--emerald-100); color: var(--emerald-600); }

.surah-title {
  width: 100%;
}
.surah-title h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
  font-family: var(--font-quran);
}
.surah-title span {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.surah-card-bottom {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
  width: 100% !important;
  padding-top: 0.85rem !important;
  border-top: 1px solid var(--border-color) !important;
  margin-top: auto !important;
}

.status-select-wrapper {
  width: 100% !important;
}

.status-select-mini {
  width: 100% !important;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  background: var(--bg-input) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  outline: none !important;
  box-sizing: border-box !important;
  transition: all var(--transition-fast) !important;
}

.status-select-mini:hover {
  border-color: var(--border-hover) !important;
}

.open-surah-btn {
  width: 100% !important;
  min-height: 44px !important;
  padding: 11px 16px !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, var(--emerald-600) 0%, var(--emerald-500) 100%) !important;
  color: #ffffff !important;
  font-size: 0.92rem !important;
  font-weight: 800 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25) !important;
  transition: all var(--transition-fast) !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

.open-surah-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4) !important;
  background: linear-gradient(135deg, var(--emerald-500) 0%, #059669 100%) !important;
}

.open-surah-btn:active {
  transform: translateY(0) !important;
}

/* ==========================================================================
   Practice Workspace & Quran Text Reader
   ========================================================================== */
.practice-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.surah-reader-header {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--box-shadow-sm);
}

.reader-surah-info {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.surah-title-block h2 {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-primary);
  font-family: var(--font-quran);
}

.surah-title-block .meta-tag {
  font-size: 0.82rem;
  color: var(--emerald-600);
  font-weight: 700;
}

.audio-control-panel {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  border: none;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn.primary {
  background: linear-gradient(135deg, var(--emerald-600), var(--emerald-500));
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn.warning {
  background: linear-gradient(135deg, var(--gold-600), var(--gold-500));
  color: #ffffff;
}

/* Practice Toolbar */
.practice-toolbar {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--box-shadow-sm);
}

.tool-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.tool-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
}

.hide-mode-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hide-btn {
  padding: 7px 14px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.hide-btn.active {
  background: var(--emerald-100);
  border-color: var(--emerald-500);
  color: var(--emerald-600);
}

.font-size-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.small-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Quran Page Display Frame */
.quran-page-frame {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--box-shadow-md);
  text-align: center;
}

body.light-mode .quran-page-frame {
  background: #ffffff;
}

.bismillah-header {
  font-family: var(--font-quran);
  font-size: 2rem;
  color: var(--gold-500);
  margin-bottom: 2rem;
  letter-spacing: 1px;
}

.quran-text-display {
  font-family: var(--font-quran);
  line-height: 2.3;
  color: var(--text-primary);
  word-spacing: 4px;
}

body.light-mode .quran-text-display {
  color: #064e3b;
}

.quran-text-display.font-size-24 { font-size: 24px; }
.quran-text-display.font-size-28 { font-size: 28px; }
.quran-text-display.font-size-32 { font-size: 32px; }
.quran-text-display.font-size-36 { font-size: 36px; }

/* Authentic Mushaf Quranic Ayah Bracket Ornament ﴿ ٣ ﴾ */
.quran-ayah-end {
  font-family: var(--font-quran), 'Amiri', 'Scheherazade New', serif !important;
  color: var(--gold-500) !important;
  font-size: 1.15em !important;
  font-weight: bold !important;
  margin: 0 6px !important;
  display: inline !important;
  user-select: none !important;
  direction: rtl !important;
  line-height: 1 !important;
}

body.light-mode .quran-ayah-end {
  color: #d97706 !important;
}

/* Active Reading Verse Highlight Bar & Glow Indicator */
.ayah-block {
  display: inline;
  padding: 4px 6px;
  border-radius: 8px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.ayah-block:hover {
  background: rgba(16, 185, 129, 0.08);
}

.ayah-block.active-reading {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22) 0%, rgba(245, 158, 11, 0.22) 100%) !important;
  color: #34d399 !important;
  border-radius: 12px !important;
  padding: 6px 12px !important;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.3) !important;
  border-bottom: 3px solid #f59e0b !important;
  font-weight: 700 !important;
}

body.light-mode .ayah-block.active-reading {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(245, 158, 11, 0.18) 100%) !important;
  color: #064e3b !important;
  border-bottom: 3px solid #d97706 !important;
}

/* Hide mode effects */
.word-hidden {
  background: rgba(148, 163, 184, 0.2);
  color: transparent !important;
  border-radius: 4px;
  user-select: none;
  cursor: pointer;
}

/* ==========================================================================
   Quiz & Analytics
   ========================================================================== */
.quiz-container, .analytics-container {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  box-shadow: var(--box-shadow-md);
}

.quiz-header, .analytics-header {
  text-align: center;
  margin-bottom: 2rem;
}
.quiz-header h2, .analytics-header h2 {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-primary);
}
.quiz-header p, .analytics-header p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0 2rem 0;
}

.quiz-option-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quiz-option-card.selected {
  border-color: var(--emerald-500);
  background: var(--emerald-100);
}

.quiz-option-card .opt-icon {
  font-size: 2rem;
  color: var(--emerald-600);
  margin-bottom: 0.75rem;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.chart-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
}

.chart-card.full-width {
  grid-column: 1 / -1;
}

.badges-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.badge-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  text-align: center;
}

.badge-card .b-icon {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

/* Floating Audio Bar */
.sticky-audio-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(650px, 94vw);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(3, 7, 18, 0.98) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(16, 185, 129, 0.5);
  border-radius: 9999px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(16, 185, 129, 0.2);
  z-index: 200;
  color: #ffffff !important;
  direction: rtl;
}

.sticky-audio-bar.hidden {
  display: none !important;
}

.audio-info {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  flex: 1;
}

.audio-info i {
  color: #10b981;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.playing-title {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.playing-title strong {
  font-size: 0.92rem;
  font-weight: 800;
  color: #ffffff !important;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.playing-title span {
  font-size: 0.78rem;
  color: #34d399 !important;
  font-weight: 600;
}

.sticky-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#sticky-play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff !important;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  transition: all 0.2s ease;
}

#sticky-play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

/* Footer */
.main-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}

/* ==========================================================================
   Mobile Responsiveness Media Queries
   ========================================================================== */
@media (max-width: 768px) {
  .header-content {
    flex-wrap: wrap;
  }
  
  .banner-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
  }

  .nav-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    z-index: 150;
    justify-content: space-around;
    padding: 8px 4px;
  }

  .nav-btn span {
    font-size: 0.75rem;
  }

  .main-content {
    padding-bottom: 80px;
  }
}

/* ==========================================================================
   PWA Add to Home Screen Floating Card Banner
   ========================================================================== */
.pwa-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  max-width: 440px;
  width: calc(100vw - 48px);
  animation: slideUpPwa 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-banner.hidden {
  display: none !important;
}

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

.pwa-banner-content {
  background: linear-gradient(145deg, rgba(6, 78, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6), 0 0 24px rgba(16, 185, 129, 0.25);
  display: flex;
  align-items: center;
  gap: 1rem;
  color: #ffffff;
}

.pwa-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.pwa-text {
  flex: 1;
}

.pwa-text h3 {
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff !important;
  margin-bottom: 2px;
}

.pwa-text p {
  font-size: 0.8rem;
  color: #cbd5e1 !important;
  line-height: 1.4;
}

.pwa-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pwa-btn-install {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff !important;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.pwa-btn-install:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.5);
}

.pwa-btn-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pwa-btn-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

@media (max-width: 640px) {
  .pwa-banner {
    bottom: 80px;
    right: 50%;
    transform: translateX(50%);
    width: calc(100vw - 32px);
  }
}
