/* Local Embedded UKIJ Ekran Font */
@font-face {
  font-family: 'UKIJ Ekran';
  src: url('fonts/UKIJEkran.ttf') format('truetype'),
       local('UKIJ Ekran'),
       local('UKIJEkran');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'UKIJ Ekran';
  src: url('fonts/UKIJEkran.ttf') format('truetype'),
       local('UKIJ Ekran'),
       local('UKIJEkran');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Google Fonts import for Arabic Scripture */
@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Scheherazade+New:wght@400;600;700&display=swap');

:root {
  --primary: #047857;
  --primary-dark: #064e3b;
  --primary-light: #10b981;
  --primary-subtle: #ecfdf5;
  --gold: #d97706;
  --gold-light: #fef3c7;
  --gold-border: #f59e0b;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --font-arabic: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
  --font-ui: 'UKIJ Ekran', 'UKIJEkran', 'ALKATIP Basma', 'Microsoft Uighur', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --arabic-size: 1.35rem;
  --border-radius: 14px;
}

[data-theme="dark"] {
  --primary: #10b981;
  --primary-dark: #065f46;
  --primary-light: #34d399;
  --primary-subtle: #064e3b33;
  --gold: #fbbf24;
  --gold-light: #78350f33;
  --gold-border: #d97706;
  --bg-main: #0b131e;
  --bg-card: #152232;
  --bg-subtle: #1c2e42;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #24384f;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 20px -3px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  direction: rtl;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Header & Banner */
.app-header {
  background: linear-gradient(135deg, var(--primary-dark), #0f3d2e);
  color: #ffffff;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

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

.brand-logo {
  width: 48px;
  height: 48px;
  background: var(--gold);
  color: #ffffff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: 0 2px 10px rgba(217, 119, 6, 0.4);
}

.brand-title h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
  letter-spacing: -0.02em;
}

.brand-title p {
  font-size: 0.85rem;
  opacity: 0.9;
  color: #a7f3d0;
}

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

.btn-icon {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* Nav Tabs */
.app-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 73px;
  z-index: 95;
}

.nav-container {
  max-width: 1250px;
  margin: 0 auto;
  display: flex;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 0 1rem;
}

.nav-btn {
  padding: 0.9rem 1.25rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

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

.nav-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--primary-subtle);
}

.badge-count {
  background: var(--gold);
  color: #ffffff;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-weight: 700;
}

/* Main Container */
.main-content {
  max-width: 1250px;
  width: 100%;
  margin: 1.5rem auto;
  padding: 0 1rem;
  flex: 1;
}

/* Tab Panes */
.tab-pane {
  display: none;
}

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

/* Controls & Toolbar */
.toolbar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-filter-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

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

.search-input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-subtle);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
}

.search-icon {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

.clear-search-btn {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  display: none;
}

.filter-selects {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.styled-select {
  padding: 0.7rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-subtle);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  min-width: 170px;
}

.styled-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Quick Filter Pills */
.filter-pills {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: none;
}

.pill-btn {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--primary);
}

.pill-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Overview Summary Box */
.stats-banner {
  background: linear-gradient(135deg, var(--primary-subtle), rgba(217, 119, 6, 0.08));
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 1rem;
  text-align: center;
}

.stat-item h3 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-item p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Chapter Card Header */
.chapter-header {
  background: var(--bg-card);
  border-right: 4px solid var(--primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.chapter-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chapter-hierarchy {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Quran Verse Callout Card */
.quran-card {
  background: linear-gradient(to bottom, var(--gold-light), var(--bg-card));
  border: 2px solid var(--gold-border);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.quran-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--gold);
  color: #ffffff;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
}

.quran-text {
  font-family: var(--font-arabic);
  font-size: calc(var(--arabic-size) * 1.15);
  line-height: 2.2;
  color: #92400e;
  text-align: justify;
  margin-bottom: 0.75rem;
}

[data-theme="dark"] .quran-text {
  color: #fde68a;
}

.quran-ref {
  font-size: 0.9rem;
  color: var(--gold);
  font-weight: 600;
  text-align: left;
}

/* Hadith Card */
.hadith-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.hadith-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(4, 120, 87, 0.3);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--border-color);
}

.card-tags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag-number {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  font-size: 0.85rem;
  border: 1px solid var(--primary-light);
}

.tag-source {
  background: var(--bg-subtle);
  color: var(--text-main);
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.tag-narrator {
  background: #f0fdf4;
  color: #166534;
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
}

[data-theme="dark"] .tag-narrator {
  background: #064e3b44;
  color: #86efac;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.action-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.15s ease;
}

.action-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-subtle);
}

.action-btn.active {
  color: var(--gold);
  border-color: var(--gold);
  background: var(--gold-light);
}

.btn-sharh {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

/* =========================================================================
   CLICKABLE WORDS FOR VOCABULARY LEARNING
   ========================================================================= */
.clickable-word {
  display: inline-block;
  cursor: pointer;
  padding: 0 0.12rem;
  border-radius: 4px;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
  border-bottom: 1px dotted rgba(4, 120, 87, 0.35);
}

.clickable-word:hover {
  background-color: #fef08a;
  color: #854d0e;
  transform: translateY(-1px);
}

[data-theme="dark"] .clickable-word:hover {
  background-color: #854d0e;
  color: #fef08a;
}

/* Hadith Body Text */
.hadith-text {
  font-family: var(--font-arabic);
  font-size: var(--arabic-size);
  line-height: 2.3;
  color: var(--text-main);
  text-align: justify;
  margin-bottom: 1rem;
  word-spacing: 0.08em;
}

/* =========================================================================
   SHARH & TAFSIR ACCORDION CONTAINER
   ========================================================================= */
.sharh-container {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-right: 4px solid var(--primary);
  border-radius: 10px;
  padding: 1.25rem;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  display: none;
  animation: slideDown 0.25s ease-out;
}

.sharh-container.open {
  display: block;
}

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

.sharh-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sharh-text {
  font-size: 0.95rem;
  line-height: 1.9;
  color: var(--text-main);
  margin-bottom: 1rem;
  text-align: justify;
}

.benefits-list {
  list-style: none;
  margin-top: 0.5rem;
}

.benefit-item {
  position: relative;
  padding-right: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.7;
}

.benefit-item::before {
  content: "✦";
  position: absolute;
  right: 0;
  color: var(--gold);
  font-weight: bold;
}

/* Card Bottom Info */
.card-bottom {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hadith-notes {
  background: var(--bg-subtle);
  border-right: 3px solid var(--gold);
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-main);
  margin-top: 0.75rem;
  line-height: 1.6;
}

/* Study Status Badge */
.status-pill {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

.status-pill.learning {
  background: #fef3c7;
  color: #92400e;
  border-color: #f59e0b;
}

.status-pill.mastered {
  background: #dcfce7;
  color: #166534;
  border-color: #22c55e;
}

/* =========================================================================
   VOCABULARY CENTER (TAB 7)
   ========================================================================= */
.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.vocab-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.vocab-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.vocab-word-ar {
  font-family: var(--font-arabic);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
}

.vocab-meaning-ug {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.vocab-meaning-ar {
  font-family: var(--font-arabic);
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Memorization / Hifz Mode */
.hifz-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hifz-card {
  background: var(--bg-card);
  border: 2px solid var(--primary);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.hifz-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--bg-subtle);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.mask-slider-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mask-slider {
  cursor: pointer;
  accent-color: var(--primary);
  width: 140px;
}

.hifz-text-display {
  font-family: var(--font-arabic);
  font-size: calc(var(--arabic-size) * 1.3);
  line-height: 2.5;
  margin: 2rem 0;
  text-align: justify;
  direction: rtl;
  user-select: none;
}

.hifz-word {
  display: inline-block;
  margin: 0 0.15rem;
  padding: 0 0.25rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.hifz-word.hidden-word {
  background: var(--border-color);
  color: transparent;
  border-bottom: 2px dashed var(--primary);
}

.hifz-word.hidden-word:hover {
  background: var(--primary-subtle);
}

.hifz-word.revealed {
  background: #fef08a;
  color: #854d0e;
}

[data-theme="dark"] .hifz-word.revealed {
  background: #854d0e;
  color: #fef08a;
}

.repetition-box {
  background: var(--primary-subtle);
  border: 1px dashed var(--primary);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.counter-num {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary);
}

.btn-repeat {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.65rem 1.5rem;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.btn-repeat:hover {
  background: var(--primary-dark);
  transform: scale(1.03);
}

/* Flashcard Mode */
.flashcard-area {
  max-width: 780px;
  margin: 0 auto;
  perspective: 1000px;
}

.flashcard {
  width: 100%;
  min-height: 380px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-face.front {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--bg-card), var(--primary-subtle));
}

.card-face.back {
  transform: rotateY(180deg);
  border-color: var(--gold);
  background: linear-gradient(135deg, var(--bg-card), var(--gold-light));
}

.flashcard-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn-card {
  padding: 0.65rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-card:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-card.primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-card.primary:hover {
  background: var(--primary-dark);
}

/* Quiz Mode */
.quiz-container {
  max-width: 800px;
  margin: 0 auto;
}

.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.quiz-progress-bar {
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(to left, var(--primary), var(--gold));
  width: 0%;
  transition: width 0.3s ease;
}

.question-prompt {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
}

.question-body {
  font-family: var(--font-arabic);
  font-size: calc(var(--arabic-size) * 1.1);
  line-height: 2.2;
  background: var(--bg-subtle);
  padding: 1.25rem;
  border-radius: 12px;
  border-right: 4px solid var(--gold);
  margin-bottom: 1.5rem;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.quiz-option {
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: 12px;
  color: var(--text-main);
  text-align: right;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quiz-option:hover:not(.disabled) {
  border-color: var(--primary);
  background: var(--primary-subtle);
}

.quiz-option.correct {
  border-color: #22c55e;
  background: #dcfce7;
  color: #15803d;
  font-weight: 700;
}

.quiz-option.wrong {
  border-color: #ef4444;
  background: #fee2e2;
  color: #b91c1c;
}

.quiz-feedback {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 10px;
  display: none;
  font-weight: 600;
}

.quiz-feedback.show {
  display: block;
}

.quiz-feedback.success {
  background: #dcfce7;
  color: #166534;
}

.quiz-feedback.error {
  background: #fee2e2;
  color: #991b1b;
}

/* Modal Popup */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.modal-dialog {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 580px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  position: relative;
}

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

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

/* Toast Message */
.toast-msg {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-main);
  color: var(--bg-main);
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  pointer-events: none;
  opacity: 0;
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: stretch;
  }
  .search-filter-row {
    flex-direction: column;
  }
  .filter-selects {
    flex-direction: column;
  }
  .styled-select {
    width: 100%;
  }
  .stats-banner {
    flex-direction: column;
    gap: 0.5rem;
  }
  .hadith-text {
    font-size: calc(var(--arabic-size) * 0.95);
    line-height: 2.1;
  }
  .vocab-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   NEW FEATURE 1: SEPARATED DAILY GOALS (HADITH & AYAH) & SRS BADGES
   ========================================================================= */
.daily-goals-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.daily-goal-card {
  border-radius: var(--border-radius);
  padding: 1.25rem 1.4rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
}

.daily-goal-card.hadith-goal {
  background: linear-gradient(135deg, rgba(4, 120, 87, 0.08), rgba(6, 78, 59, 0.03));
  border: 2px solid var(--primary-light);
}

.daily-goal-card.verse-goal {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.09), rgba(180, 83, 9, 0.03));
  border: 2px solid rgba(245, 158, 11, 0.5);
}

.daily-goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.daily-goal-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

.goal-stepper-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.2rem 0.4rem;
}

.goal-step-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  transition: all 0.2s ease;
}

.goal-step-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.daily-goal-card.verse-goal .goal-step-btn:hover {
  background: #b45309;
  border-color: #b45309;
}

.goal-count-label {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0 0.4rem;
  white-space: nowrap;
  color: var(--text-main);
}

.goal-progress-wrap {
  margin-bottom: 0.75rem;
}

.goal-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.goal-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.goal-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.daily-goal-card.verse-goal .goal-progress-fill {
  background: #f59e0b;
}

.daily-goal-content {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  margin-bottom: 0.85rem;
  flex: 1;
}

.goal-item-card {
  background: var(--bg-subtle);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.6rem;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.goal-item-card:last-child {
  margin-bottom: 0;
}

.goal-item-card.completed {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.goal-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.goal-item-check-btn {
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.goal-item-check-btn.checked {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}

.daily-goal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.daily-goal-status-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.srs-badge-due {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

[data-theme="dark"] .srs-badge-due {
  background: #450a0a;
  color: #fca5a5;
  border-color: #7f1d1d;
}

/* =========================================================================
   NEW FEATURE 2: CROSS REFERENCE BUTTONS
   ========================================================================= */
.btn-cross-ref {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(217, 119, 6, 0.1);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  direction: rtl;
}

.btn-cross-ref:hover {
  background: var(--gold);
  color: #ffffff;
  transform: translateY(-1px);
}

.card-highlighted-pulse {
  animation: cardPulse 1.8s ease-in-out;
}

@keyframes cardPulse {
  0% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.7); }
  50% { box-shadow: 0 0 0 12px rgba(217, 119, 6, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
}

/* =========================================================================
   NEW FEATURE 3: GOLDEN QUOTES & ROOT WORDS
   ========================================================================= */
.golden-quote {
  background: linear-gradient(120deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.25) 100%);
  border-bottom: 2px solid var(--gold);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: #92400e;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
  display: inline;
}

[data-theme="dark"] .golden-quote {
  color: #fde68a;
  background: linear-gradient(120deg, rgba(245, 158, 11, 0.25) 0%, rgba(217, 119, 6, 0.35) 100%);
}

.root-word-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid var(--primary-light);
  padding: 0.3rem 0.8rem;
  border-radius: 8px;
  font-family: var(--font-arabic);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 2px;
}

/* =========================================================================
   NEW FEATURE 4: CONTINUOUS AUDIO PLAYER BAR
   ========================================================================= */
.audio-player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 2px solid var(--primary);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
  padding: 0.75rem 1.5rem;
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  transition: transform 0.3s ease;
  backdrop-filter: blur(10px);
}

.audio-player-bar.active {
  display: flex;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 240px;
}

.player-icon {
  width: 42px;
  height: 42px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  animation: pulseIcon 1.5s infinite;
}

@keyframes pulseIcon {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(4, 120, 87, 0.5); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(4, 120, 87, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(4, 120, 87, 0); }
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.player-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.player-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: scale(1.06);
}

.player-btn.primary-play {
  width: 46px;
  height: 46px;
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  font-size: 1.25rem;
}

.player-btn.primary-play:hover {
  background: var(--primary-dark);
}

.player-toggle-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* =========================================================================
   NEW FEATURE 5: POSTER / SHARE IMAGE GENERATOR
   ========================================================================= */
.poster-dialog {
  max-width: 650px !important;
  width: 95%;
  text-align: center;
}

.poster-preview-container {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #0f172a;
  padding: 1rem;
  border-radius: 12px;
  margin: 1rem 0;
  max-height: 450px;
  overflow: auto;
}

.poster-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}

.poster-theme-select {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.theme-pill-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-pill-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* =========================================================================
   HOME PAGE (باش بەت) STYLING
   ========================================================================= */
.home-hero-card {
  background: linear-gradient(135deg, #064e3b 0%, #047857 60%, #0f766e 100%);
  color: #ffffff;
  border-radius: var(--border-radius);
  padding: 2.25rem 2.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.home-hero-card::after {
  content: "✨";
  position: absolute;
  left: 25px;
  bottom: -25px;
  font-size: 8.5rem;
  opacity: 0.1;
  pointer-events: none;
}

.home-hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.home-hero-title {
  font-size: 1.95rem;
  font-weight: 800;
  margin-bottom: 0.85rem;
  line-height: 1.4;
  color: #ffffff;
}

.home-hero-desc {
  font-size: 1.05rem;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.92);
  max-width: 840px;
  margin-bottom: 1.6rem;
}

.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.btn-hero {
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  border: none;
}

.btn-hero.primary {
  background: #ffffff;
  color: #064e3b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-hero.primary:hover {
  background: #f8fafc;
  transform: translateY(-2px);
}

.btn-hero.secondary {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn-hero.secondary:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.btn-hero.outline {
  background: transparent;
  color: #fde68a;
  border: 1px solid #fde68a;
}

.btn-hero.outline:hover {
  background: rgba(253, 230, 138, 0.15);
  transform: translateY(-2px);
}

.home-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.home-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
  margin: 0;
}

.home-section-tag {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
}

.home-curriculum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.home-part-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 4px solid var(--primary);
  border-radius: var(--border-radius);
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.home-part-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.home-part-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.home-part-badge {
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--primary-light);
}

.home-part-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.home-part-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
  flex: 1;
  margin-bottom: 1rem;
}

.home-part-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--bg-subtle);
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.home-subsections-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.home-sub-pill {
  text-align: right;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.home-sub-pill:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.home-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem;
  margin-bottom: 2rem;
}

.home-feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.3rem 1.25rem;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
}

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

.home-feature-card .feature-icon {
  font-size: 2.2rem;
  margin-bottom: 0.6rem;
}

.home-feature-card h4 {
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
  color: var(--text-main);
}

.home-feature-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

@media (max-width: 768px) {
  /* Native App Header Bar — Exact match with user's desired style */
  .app-header {
    padding: 0.65rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #064e3b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .header-container {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 0.75rem;
    max-width: 100%;
  }
  .brand-section {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
  }
  .brand-logo {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  }
  .brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .brand-title {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.15;
    text-align: right;
  }
  .brand-title h1 {
    font-size: 1.3rem;
    margin: 0 0 0.2rem 0;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0;
    white-space: nowrap;
  }
  .brand-title p {
    display: block !important;
    font-size: 0.68rem;
    color: #a7f3d0;
    opacity: 0.9;
    margin: 0;
    white-space: nowrap;
    line-height: 1.2;
  }
  .header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    direction: ltr; /* Keeps buttons in a clean horizontal order */
  }
  .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 0.92rem;
    font-weight: 700;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .btn-icon:hover, .btn-icon:active {
    background: rgba(255, 255, 255, 0.28);
  }

  /* Hide top desktop navigation on mobile */
  .app-nav {
    display: none !important;
  }

  /* Native Mobile Bottom Navigation Bar (خۇددى ئەپ كۆرۈنۈشى) */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 2000;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .bottom-nav-item {
    background: none;
    border: none;
    outline: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.25rem 0;
  }

  .bottom-nav-item .nav-icon {
    font-size: 1.25rem;
    line-height: 1.2;
    margin-bottom: 0.15rem;
    transition: transform 0.2s ease;
  }

  .bottom-nav-item .nav-label {
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-ui);
  }

  .bottom-nav-item.active {
    color: var(--primary);
  }

  .bottom-nav-item.active .nav-icon {
    transform: scale(1.15);
  }

  .bottom-nav-item.active .nav-label {
    font-weight: 700;
  }

  /* Native App Body Layout */
  .main-content {
    padding: 0 0.75rem;
    margin: 0.85rem auto 75px auto !important; /* Space for bottom nav */
  }
  .home-hero-card {
    padding: 1.25rem 1rem;
    border-radius: 14px;
  }
  .home-hero-title {
    font-size: 1.2rem;
    line-height: 1.5;
  }
  .home-hero-desc {
    font-size: 0.86rem;
    line-height: 1.65;
  }
  .home-hero-actions {
    flex-direction: column;
    gap: 0.55rem;
  }
  .btn-hero {
    width: 100%;
    justify-content: center;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
  .daily-goals-container {
    grid-template-columns: 1fr;
  }
  .home-curriculum-grid {
    grid-template-columns: 1fr;
  }
  .audio-player-bar {
    padding: 0.55rem 0.75rem;
    bottom: 64px; /* Above bottom nav */
    padding-bottom: 0.55rem;
  }
}

/* Hide mobile bottom nav on Desktop */
@media (min-width: 769px) {
  .mobile-bottom-nav {
    display: none !important;
  }
}

