/* ─── FARSI / PERSIAN COURSE STYLES ──────────────────────────────────────────
   Font strategy: Vazirmatn loaded from Google Fonts.
   The GFonts CDN serves an Arabic-subset version automatically (unicode-range
   U+0600-06FF), so only Persian-script glyphs are downloaded for non-Latin text.
   We request only weights 400/500/700 to minimise payload (~60 KB total).
   ─────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;700&display=swap');

/* ── PERSIAN FONT APPLICATION ────────────────────────────────────────────── */
/* Apply Vazirmatn to any element that carries Persian / Arabic script content */
.fa-text,
[dir="rtl"],
.alpha-card-letter,
.alpha-card-form-char,
.alpha-card-example-word,
.lj-target-word,
.lj-rendered,
.lj-tile,
.lj-placed-letter {
  font-family: 'Vazirmatn', 'Tahoma', 'Arial Unicode MS', sans-serif;
}

/* ── TOPBAR ────────────────────────────────────────────────────────────────── */
.topbar-course {
  font-family: 'Vazirmatn', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0px;
  color: #c8d8e8;
  direction: rtl;
}

/* ── COURSE HERO ───────────────────────────────────────────────────────────── */
.course-hero h1 {
  font-family: 'Vazirmatn', serif;
  font-size: 42px;
  font-weight: 700;
  direction: rtl;
}

/* ── UNIT HEADER ───────────────────────────────────────────────────────────── */

.unit-header-title {
  font-family: 'Vazirmatn', sans-serif;
  direction: rtl;
  unicode-bidi: plaintext;
}

/* ── MODULE NAVIGATION ─────────────────────────────────────────────────────── */
.phase-nav-btn {
  transition: background 0.15s, transform 0.1s, box-shadow 0.1s;
}

.phase-nav-btn:active {
  transform: translateY(1px);
}

/* ── SECTION SIDEBAR ───────────────────────────────────────────────────────── */
.section-item.active {
  border-left: 3px solid #1a5a8a;
}

/* ── SECTION CARDS ─────────────────────────────────────────────────────────── */
.section-card {
  border-radius: 8px;
}

/* Section titles that contain Persian text */
.section-card-title {
  font-family: 'Vazirmatn', 'DM Sans', sans-serif;
  unicode-bidi: plaintext;
  direction: rtl;
}

/* ── GRAMMAR MODALS ────────────────────────────────────────────────────────── */
.grammar-modal {
  border-radius: 8px;
}

.grammar-modal-title {
  font-family: 'Vazirmatn', 'Fraunces', serif;
  unicode-bidi: plaintext;
}

.grammar-modal-para {
  font-family: 'Vazirmatn', 'DM Sans', sans-serif;
  line-height: 1.9;
  unicode-bidi: plaintext;
}

/* ── ALPHABET CARDS ────────────────────────────────────────────────────────── */
.alpha-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.alpha-card {
  background: var(--card, var(--surface));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 14px 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  text-align: center;
  user-select: none;
}

.alpha-card:hover {
  border-color: #1a5a8a;
  box-shadow: 0 3px 12px rgba(26, 90, 138, 0.12);
  transform: translateY(-1px);
}

.alpha-card.expanded {
  border-color: #1a5a8a;
  background: var(--surface2, #f5f5f5);
}

.alpha-card-letter {
  font-size: 44px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--accent, #1a5a8a);
  margin-bottom: 8px;
  direction: rtl;
}

.alpha-card-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.alpha-card-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.alpha-card-translit {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--red, #c8403a);
  background: rgba(200, 64, 58, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
}

.alpha-card-sound {
  font-size: 10px;
  color: var(--text3);
  line-height: 1.4;
  margin-bottom: 6px;
  font-style: italic;
}

.alpha-card-connect-badge {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 8px;
  margin-top: 4px;
}

.alpha-card-connect-badge.connector {
  background: rgba(45, 122, 80, 0.1);
  color: #2d7a50;
  border: 1px solid rgba(45, 122, 80, 0.25);
}

.alpha-card-connect-badge.non-connector {
  background: rgba(212, 119, 42, 0.1);
  color: #c8963a;
  border: 1px solid rgba(212, 119, 42, 0.25);
}

/* ── EXPANDED CARD CONTENT ─────────────────────────────────────────────────── */
.alpha-card-expanded {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  text-align: right;
}

.alpha-card-forms {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.alpha-card-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.alpha-card-form-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text3);
  text-align: left;
  flex: 1;
}

.alpha-card-form-char {
  font-size: 22px;
  color: var(--text);
  direction: rtl;
  line-height: 1.3;
}

.alpha-card-example {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.alpha-card-example-word {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  direction: rtl;
}

.alpha-card-example-gloss {
  font-size: 11px;
  color: var(--text3);
  font-style: italic;
  direction: ltr;
  text-align: right;
}

.alpha-note {
  background: rgba(26, 90, 138, 0.06);
  border: 1px solid rgba(26, 90, 138, 0.18);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 16px;
  line-height: 1.6;
  font-style: italic;
}

/* ── LETTER JOINER EXERCISE ─────────────────────────────────────────────────── */
.lj-target {
  background: var(--surface2, #f5f5f5);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  text-align: center;
  margin: 16px 0;
}

.lj-target-word {
  font-size: 52px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  direction: rtl;
  margin-bottom: 6px;
  display: block;
}

.lj-target-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lj-target-translit {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  color: var(--red, #c8403a);
}

.lj-target-meaning {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text3);
  font-style: italic;
}

/* Assembly area: shows rendered connected form + placed tiles */
.lj-assembly {
  min-height: 100px;
  border: 2px dashed var(--border2);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: border-color 0.15s, background 0.15s;
}

.lj-assembly.correct {
  border-color: var(--green, #2d7a50);
  background: var(--green-light, rgba(45, 122, 80, 0.07));
}

.lj-assembly.wrong {
  border-color: var(--red, #c8403a);
  background: var(--red-light, rgba(200, 64, 58, 0.07));
}

.lj-rendered {
  font-size: 36px;
  font-weight: 600;
  direction: rtl;
  color: var(--accent, #1a5a8a);
  min-height: 44px;
  line-height: 1.3;
}

.lj-placeholder {
  font-size: 18px;
  color: var(--text3);
  font-style: italic;
  font-family: 'DM Sans', sans-serif;
}

.lj-placed-tiles {
  display: flex;
  flex-direction: row-reverse;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Individual letter tiles (bank and placed) */
.lj-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 52px;
  padding: 0 8px;
  font-size: 28px;
  font-weight: 500;
  border: 2px solid var(--border2);
  border-radius: 8px;
  background: var(--bg, #f7f5f0);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
  direction: rtl;
  user-select: none;
}

.lj-tile:hover {
  background: var(--surface2);
  border-color: #1a5a8a;
  transform: translateY(-2px);
}

.lj-tile.placed {
  background: rgba(26, 90, 138, 0.08);
  border-color: #1a5a8a;
  color: #1a5a8a;
}

.lj-tile.placed:hover {
  background: rgba(200, 64, 58, 0.08);
  border-color: var(--red);
  color: var(--red);
}

/* Letter bank */
.lj-bank {
  display: flex;
  flex-direction: row-reverse;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 16px 0 8px;
}

/* ── SENTENCE CONSTRUCTION RTL ──────────────────────────────────────────────── */
.sc-drop-zone.rtl,
.sc-tiles.rtl {
  direction: rtl;
  font-family: 'Vazirmatn', sans-serif;
}

.sc-tile.rtl {
  font-family: 'Vazirmatn', sans-serif;
}

/* ── READING SECTIONS ────────────────────────────────────────────────────────── */
.reading-content,
.reading-text {
  unicode-bidi: plaintext;
}

/* ── FOOTER ──────────────────────────────────────────────────────────────────── */
.course-footer {
  border-top: 1px solid rgba(26, 90, 138, 0.2);
}

/* ── SCORE / PROGRESS ACCENTS ─────────────────────────────────────────────────── */
.practice-progress-fill {
  background: #1a5a8a;
}

/* ── ALPHABET FLASHCARD — FARSI OVERRIDES ─────────────────────────────────────── */
/* Ensure Persian letters on flashcards render RTL and use the correct font */
.fc-card-front [style*="Vazirmatn"],
.fc-card-back [style*="Vazirmatn"] {
  direction: rtl;
}
