/* kalimati — main.css */

/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ─── CSS Variables (light mode) ────────────────────────────── */
:root {
  --brand-from: #F5A623;
  --brand-to: #F06B2D;
  --brand-gradient: linear-gradient(135deg, #F5A623, #F06B2D);

  --bg-page: #F7F5F2;
  --bg-primary: #FFFFFF;
  --bg-secondary: #F3F0ED;
  --bg-tertiary: #EAE7E2;

  --text-primary: #1A1714;
  --text-secondary: #5C5449;
  --text-tertiary: #9C9188;

  --border-light: rgba(0,0,0,0.08);
  --border-medium: rgba(0,0,0,0.14);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);

  --nav-height: 64px;
  --topbar-height: 56px;

  --arabic-font: 'Amiri', 'Scheherazade New', 'Noto Naskh Arabic', 'Traditional Arabic', serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #111009;
    --bg-primary: #1C1A17;
    --bg-secondary: #262320;
    --bg-tertiary: #302D29;

    --text-primary: #F0EDE8;
    --text-secondary: #A89F94;
    --text-tertiary: #6E665D;

    --border-light: rgba(255,255,255,0.06);
    --border-medium: rgba(255,255,255,0.12);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  }
}

/* Force dark/light from settings */
body.theme-light {
  color-scheme: light;
  --bg-page: #F7F5F2;
  --bg-primary: #FFFFFF;
  --bg-secondary: #F3F0ED;
  --bg-tertiary: #EAE7E2;
  --text-primary: #1A1714;
  --text-secondary: #5C5449;
  --text-tertiary: #9C9188;
  --border-light: rgba(0,0,0,0.08);
  --border-medium: rgba(0,0,0,0.14);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
}
body.theme-dark {
  color-scheme: dark;
  --bg-page: #111009; --bg-primary: #1C1A17; --bg-secondary: #262320;
  --bg-tertiary: #302D29; --text-primary: #F0EDE8; --text-secondary: #A89F94;
  --text-tertiary: #6E665D; --border-light: rgba(255,255,255,0.06);
  --border-medium: rgba(255,255,255,0.12);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
}

/* ─── App Shell ─────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

#topbar {
  height: var(--topbar-height);
  background: var(--bg-primary);
  border-bottom: 0.5px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}
#topbar-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 20px; font-weight: 600; color: var(--text-primary);
  text-decoration: none; flex: 1;
}
#topbar-logo .logo-ar {
  font-family: var(--arabic-font);
  font-size: 22px;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
#topbar-logo .logo-en {
  font-size: 13px; color: var(--text-tertiary); font-weight: 400;
}
#topbar-actions { display: flex; gap: 6px; }
#topbar-actions button {
  width: 36px; height: 36px;
  border: none; background: none; cursor: pointer;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
}
#topbar-actions button:hover { background: var(--bg-secondary); }

/* ─── Body layout below topbar ──────────────────────────────── */
#app-body {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--topbar-height));
}

/* ─── Sidebar nav (desktop) ─────────────────────────────────── */
#sidebar-nav {
  width: 200px;
  flex-shrink: 0;
  background: var(--bg-primary);
  border-right: 0.5px solid var(--border-light);
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  border: none; background: none;
  color: var(--text-secondary);
  font-size: 14px; font-weight: 400;
  text-align: left; width: 100%;
  border-radius: 0;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}
.sidebar-item .ti { font-size: 18px; flex-shrink: 0; }
.sidebar-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
.sidebar-item.active {
  background: var(--bg-secondary);
  color: #F06B2D;
  font-weight: 500;
}
.sidebar-divider {
  border: none; border-top: 0.5px solid var(--border-light);
  margin: 8px 16px;
}
.sidebar-label {
  font-size: 10px; font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 10px 20px 4px;
}

#app-screen {
  flex: 1;
  min-height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  background: var(--bg-page);
}

/* ─── Bottom nav — mobile only ──────────────────────────────── */
#bottom-nav {
  height: var(--nav-height);
  background: var(--bg-primary);
  border-top: 0.5px solid var(--border-light);
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  cursor: pointer;
  border: none; background: none;
  color: var(--text-tertiary);
  font-size: 10px;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-item .ti { font-size: 22px; }
.nav-item.active { color: #F06B2D; }
.nav-item:hover { color: var(--text-secondary); }

/* ─── Mobile: hide sidebar, show bottom nav ─────────────────── */
@media (max-width: 768px) {
  #sidebar-nav { display: none; }
  #bottom-nav { display: flex; }
  #app-screen { padding-bottom: calc(var(--nav-height) + 16px); }
}

/* ─── Back button ────────────────────────────────────────────── */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 15px;
  padding: 8px 16px;
}
.back-btn:hover { color: var(--text-primary); }

/* ─── Cards & Sections ──────────────────────────────────────── */
.card {
  background: var(--bg-primary);
  border: 0.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
  margin-bottom: 12px;
}
.section-label {
  font-size: 11px; font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin: 1rem 0 0.4rem;
}
.grammar-box {
  background: var(--bg-secondary);
  border-left: 2.5px solid #2563EB;
  border-radius: 0;
  padding: 0.55rem 0.9rem;
  margin: 0.35rem 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-primary);
}
.grammar-box.warn { border-color: #D97706; }
.prose { font-size: 15px; line-height: 1.7; color: var(--text-primary); }

/* ─── Arabic text ────────────────────────────────────────────── */
.ar, .ar-text, [lang="ar"] {
  font-family: var(--arabic-font);
  direction: rtl;
  line-height: 1.9;
}
.hl { color: #1D6FBF; font-weight: 500; }

/* ─── Tags & Badges ─────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-size: 12px; font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  margin: 2px 2px;
  white-space: nowrap;
}
.tag-clickable { cursor: pointer; transition: opacity 0.15s; }
.tag-clickable:hover { opacity: 0.8; }
.root-tag {
  display: inline-block;
  font-family: var(--arabic-font);
  font-size: 15px;
  direction: rtl;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  margin: 2px;
}
.accuracy-tag {
  display: inline-block; font-size: 12px;
  padding: 3px 10px; border-radius: var(--radius-sm);
  background: #DCFCE7; color: #14532D; margin: 2px;
}
.badge-acc { font-size: 13px; padding: 3px 10px; border-radius: var(--radius-sm); background: #DCFCE7; color: #14532D; }
.badge-res { font-size: 13px; padding: 3px 10px; border-radius: var(--radius-sm); background: #FEF3C7; color: #92400E; margin-left: 6px; }
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500;
  padding: 3px 10px; border-radius: var(--radius-sm);
}
.quran-note {
  background: #FFFBEB; color: #92400E;
  border: 0.5px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 0.6rem 0.9rem;
  font-size: 14px;
  margin-top: 8px;
}

/* ─── Word Card page ─────────────────────────────────────────── */
.word-card-page { padding: 0 0 2rem; }
.card-header {
  background: var(--brand-gradient);
  padding: 1.5rem 1.25rem 1.25rem;
  border-radius: 0;
}
.card-ar {
  font-family: var(--arabic-font);
  direction: rtl; color: #fff;
  font-weight: 400; line-height: 1.4;
  margin-bottom: 2px;
}
.card-plain {
  font-family: var(--arabic-font);
  direction: rtl; color: rgba(255,255,255,0.75);
  font-size: 18px; margin-bottom: 10px;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.card-section { padding: 0 1rem; margin-top: 4px; }

/* ─── Example blocks ─────────────────────────────────────────── */
.example-block {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
  margin: 0.35rem 0;
}
.ex-ar {
  font-family: var(--arabic-font);
  font-size: 20px; direction: rtl;
  text-align: right; line-height: 1.9;
  margin-bottom: 2px;
}
.ex-ar-plain {
  font-family: var(--arabic-font);
  font-size: 15px; direction: rtl;
  text-align: right; color: var(--text-secondary);
  margin-bottom: 3px;
}
.ex-en { font-size: 14px; color: var(--text-primary); line-height: 1.5; }
.meaning-block { margin-bottom: 1rem; }
.meaning-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.meaning-label { font-size: 14px; color: var(--text-secondary); }

/* ─── Sarf Table ─────────────────────────────────────────────── */
.sarf-scroll { overflow-x: auto; margin: 0.5rem 0; }
.sarf-table, .sarf-mini {
  border-collapse: collapse; direction: rtl;
  font-size: 13px;
  width: 100%; min-width: 480px;
}
.sarf-table th, .sarf-mini th {
  background: var(--bg-secondary);
  padding: 6px 7px; font-weight: 500; font-size: 11px;
  border: 0.5px solid var(--border-medium);
  text-align: center; color: var(--text-secondary);
  font-family: var(--arabic-font);
}
.sarf-table th span, .sarf-mini th span {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 10px; color: var(--text-tertiary);
  display: block; font-weight: 400;
  direction: ltr;
}
.sarf-table td, .sarf-mini td {
  padding: 5px 7px; border: 0.5px solid var(--border-light);
  text-align: center; vertical-align: top;
}
.sar {
  font-family: var(--arabic-font);
  font-size: 15px; display: block; direction: rtl;
}
.sen {
  font-size: 11px; color: var(--text-tertiary);
  display: block; direction: ltr; margin-top: 1px;
}
.sarf-mini .sar { font-size: 14px; }

/* ─── Pairing tags ───────────────────────────────────────────── */
.pairings-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pairing-tag {
  font-family: var(--arabic-font);
  direction: rtl; font-size: 16px;
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-medium);
  padding: 4px 12px; border-radius: var(--radius-md);
  cursor: pointer; color: var(--text-primary);
}
.pairing-tag:hover { background: var(--bg-tertiary); }

/* ─── Pop-up ─────────────────────────────────────────────────── */
.popup-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 200;
  backdrop-filter: blur(2px);
}
.word-popup {
  position: fixed;
  bottom: calc(var(--nav-height) + 12px);
  left: 50%; transform: translateX(-50%);
  width: min(580px, calc(100vw - 24px));
  max-height: 55vh;
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  z-index: 201;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.popup-inner {
  overflow-y: auto; padding: 1rem 1.125rem;
  -webkit-overflow-scrolling: touch;
}
.popup-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 10px;
}
.popup-arabic {
  font-family: var(--arabic-font);
  direction: rtl; font-weight: 400;
  color: var(--text-primary); line-height: 1.3;
}
.popup-plain {
  font-family: var(--arabic-font);
  direction: rtl; font-size: 16px;
  color: var(--text-secondary);
}
.popup-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-secondary); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); flex-shrink: 0;
}
.popup-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.popup-root-note { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.5; }
.popup-grammar {
  font-size: 13px; color: var(--text-secondary);
  background: var(--bg-secondary); padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md); margin-bottom: 10px; line-height: 1.55;
}
.popup-section-label {
  font-size: 10px; font-weight: 500; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin: 10px 0 5px;
}
.popup-meaning { margin-bottom: 10px; }
.popup-meaning-label { font-size: 13px; color: var(--text-secondary); margin: 3px 0 5px; }
.popup-ex { background: var(--bg-secondary); border-radius: var(--radius-md); padding: 0.5rem 0.75rem; }
.popup-ex-ar {
  font-family: var(--arabic-font);
  font-size: 17px; direction: rtl; text-align: right;
  line-height: 1.9; margin-bottom: 2px;
}
.popup-ex-en { font-size: 13px; color: var(--text-primary); }
.full-entry-btn {
  width: 100%; padding: 10px;
  background: var(--bg-secondary); border: 0.5px solid var(--border-medium);
  border-radius: var(--radius-md); cursor: pointer;
  font-size: 14px; color: var(--text-primary);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 10px;
}
.full-entry-btn:hover { background: var(--bg-tertiary); }
body.popup-open { overflow: hidden; }

/* ─── Tag tooltip ─────────────────────────────────────────────── */
.tag-tooltip {
  position: fixed;
  background: var(--bg-primary);
  border: 0.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font-size: 13px;
  z-index: 300;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  max-width: 200px;
  text-align: center;
}
.tag-tooltip .tt-ar {
  font-family: var(--arabic-font);
  font-size: 18px; direction: rtl;
  display: block; margin-bottom: 3px;
}

/* ─── Home screen ────────────────────────────────────────────── */
.home-hero {
  background: var(--brand-gradient);
  padding: 1.5rem 1.25rem 1.25rem;
  color: #fff;
}
.home-hero h1 {
  font-family: var(--arabic-font);
  font-size: 28px; direction: rtl;
  margin-bottom: 4px;
}
.home-hero p { font-size: 14px; opacity: 0.85; }
.streak-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  padding: 4px 10px; font-size: 13px; margin-top: 8px;
}
.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; padding: 1rem;
}
.stat-card {
  background: var(--bg-primary);
  border: 0.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem; text-align: center;
}
.stat-num { font-size: 28px; font-weight: 500; color: var(--text-primary); }
.stat-label { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem 0.25rem;
}
.section-header h2 { font-size: 16px; font-weight: 500; }
.section-header button {
  font-size: 13px; color: #F06B2D;
  background: none; border: none; cursor: pointer;
}
.word-row {
  display: flex; align-items: center;
  padding: 12px 16px; gap: 12px;
  border-bottom: 0.5px solid var(--border-light);
  cursor: pointer; background: var(--bg-primary);
}
.word-row:hover { background: var(--bg-secondary); }
.word-row:last-child { border-bottom: none; }
.wr-ar {
  font-family: var(--arabic-font);
  font-size: 20px; direction: rtl;
  min-width: 70px; text-align: right;
}
.wr-info { flex: 1; min-width: 0; }
.wr-type { font-size: 11px; color: var(--text-tertiary); margin-bottom: 1px; }
.wr-meaning { font-size: 14px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-status { flex-shrink: 0; }

/* ─── Word List ───────────────────────────────────────────────── */
.wordlist-filters {
  display: flex; gap: 8px; padding: 10px 16px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.filter-btn {
  flex-shrink: 0; padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border-medium);
  background: var(--bg-primary);
  color: var(--text-secondary); font-size: 13px; cursor: pointer;
}
.filter-btn.active {
  background: #F06B2D; color: #fff; border-color: #F06B2D;
}

/* ─── Word Bank ──────────────────────────────────────────────── */
.view-toggle {
  display: flex; gap: 6px; padding: 10px 16px;
}
.view-btn {
  padding: 6px 14px; border-radius: var(--radius-md);
  border: 0.5px solid var(--border-medium);
  background: var(--bg-primary); color: var(--text-secondary);
  font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
}
.view-btn.active { background: #F06B2D; color: #fff; border-color: #F06B2D; }
.status-filter-row {
  display: flex; gap: 6px; padding: 0 16px 10px;
  overflow-x: auto;
}
.status-filter {
  flex-shrink: 0; padding: 4px 12px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border-medium);
  background: var(--bg-primary); color: var(--text-secondary);
  font-size: 12px; cursor: pointer;
}
.status-filter.active { border-color: #F06B2D; color: #F06B2D; }

/* ─── Flashcard ──────────────────────────────────────────────── */
.flashcard-wrap {
  padding: 1rem;
  display: flex; flex-direction: column;
  align-items: center; gap: 16px;
}
.flashcard {
  width: 100%;
  background: var(--bg-primary);
  border: 0.5px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 2rem 1.5rem;
  text-align: center;
  min-height: 200px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.flashcard-ar {
  font-family: var(--arabic-font);
  direction: rtl; font-size: 36px;
  color: var(--text-primary); margin-bottom: 8px;
}
.flashcard-tap { font-size: 13px; color: var(--text-tertiary); }
.flashcard-answer { font-size: 16px; color: var(--text-secondary); margin-top: 12px; }
.fc-actions { display: flex; gap: 10px; width: 100%; }
.fc-btn {
  flex: 1; padding: 12px;
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border-medium);
  cursor: pointer; font-size: 15px; font-weight: 500;
}
.fc-btn-good { background: #DCFCE7; color: #14532D; border-color: #86EFAC; }
.fc-btn-again { background: #FEF2F2; color: #991B1B; border-color: #FCA5A5; }

/* ─── Search ─────────────────────────────────────────────────── */
.search-bar-wrap { padding: 12px 16px; }
.search-bar {
  width: 100%; padding: 10px 14px;
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border-medium);
  background: var(--bg-secondary);
  font-size: 16px; color: var(--text-primary);
  outline: none;
}
.search-bar:focus { border-color: #F06B2D; background: var(--bg-primary); }

/* ─── Settings ───────────────────────────────────────────────── */
.settings-section { padding: 0 16px; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
  border-bottom: 0.5px solid var(--border-light);
}
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 15px; color: var(--text-primary); }
.settings-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.settings-control select, .settings-control input[type="range"] {
  font-size: 14px; color: var(--text-primary);
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-medium);
  border-radius: var(--radius-sm); padding: 4px 8px;
}
.toggle-switch {
  position: relative; width: 44px; height: 24px;
  display: inline-block;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-tertiary); border-radius: 12px;
  cursor: pointer; transition: background 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; left: 3px; top: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: #F06B2D; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ─── Admin ──────────────────────────────────────────────────── */
.admin-login {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 3rem 2rem; gap: 12px;
}
.admin-login input {
  width: 100%; max-width: 300px;
  padding: 10px 14px; border-radius: var(--radius-md);
  border: 0.5px solid var(--border-medium);
  background: var(--bg-secondary);
  font-size: 16px; color: var(--text-primary);
  outline: none;
}
.admin-login input:focus { border-color: #F06B2D; }
.btn-primary {
  padding: 10px 24px; border-radius: var(--radius-md);
  background: var(--brand-gradient); color: #fff;
  border: none; cursor: pointer; font-size: 15px; font-weight: 500;
}
.btn-secondary {
  padding: 8px 18px; border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-medium);
  cursor: pointer; font-size: 14px; color: var(--text-primary);
}
.admin-word-editor { padding: 1rem; }
.editor-field { margin-bottom: 16px; }
.editor-label { font-size: 12px; font-weight: 500; color: var(--text-tertiary); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.editor-input, .editor-textarea {
  width: 100%; padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border-medium);
  background: var(--bg-secondary);
  font-size: 15px; color: var(--text-primary);
  outline: none; font-family: inherit;
}
.editor-input:focus, .editor-textarea:focus { border-color: #F06B2D; }
.editor-textarea { min-height: 80px; resize: vertical; }
.editor-ar {
  font-family: var(--arabic-font);
  direction: rtl; font-size: 20px;
}

/* ─── Onboarding ─────────────────────────────────────────────── */
.onboarding-page {
  min-height: 100vh; padding-bottom: 2rem;
}
.onboarding-hero {
  background: var(--brand-gradient);
  padding: 3rem 1.5rem 2rem;
  text-align: center; color: #fff;
}
.onboarding-logo {
  font-family: var(--arabic-font);
  font-size: 56px; direction: rtl;
  margin-bottom: 8px;
}
.onboarding-tagline { font-size: 18px; opacity: 0.9; }
.onboarding-steps { padding: 1.5rem 1.25rem; }
.ob-step {
  display: flex; gap: 14px; margin-bottom: 1.25rem;
  align-items: flex-start;
}
.ob-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.ob-title { font-size: 15px; font-weight: 500; margin-bottom: 3px; }
.ob-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.onboarding-cta { padding: 0 1.25rem 2rem; }
.onboarding-cta button {
  width: 100%; padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--brand-gradient); color: #fff;
  border: none; cursor: pointer;
  font-size: 16px; font-weight: 500;
}

/* ─── Progress ───────────────────────────────────────────────── */
.progress-ring-wrap {
  display: flex; justify-content: center; padding: 1.5rem;
}
.history-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 0.5px solid var(--border-light);
  font-size: 14px;
}
.history-date { color: var(--text-tertiary); font-size: 12px; }

/* ─── Reference page ─────────────────────────────────────────── */
.ref-page { padding: 1rem; }
.ref-card {
  background: var(--bg-primary);
  border: 0.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
  margin-bottom: 12px;
}
.ref-label { font-size: 11px; font-weight: 500; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.ref-value { font-size: 15px; color: var(--text-primary); line-height: 1.6; }
.ref-page-ref {
  background: #FFFBEB;
  border: 0.5px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem; font-size: 14px;
  color: #92400E;
}
.ref-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-medium);
  cursor: pointer; font-size: 14px; color: var(--text-primary);
  margin-top: 8px;
}

/* ─── Empty state ─────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 3rem 2rem; gap: 10px; text-align: center;
  color: var(--text-tertiary);
}
.empty-title { font-size: 16px; font-weight: 500; color: var(--text-secondary); }
.empty-sub { font-size: 14px; line-height: 1.5; }

/* ─── Homework ───────────────────────────────────────────────── */
.hw-page { padding: 1rem; }
.hw-progress-bg {
  background: var(--bg-secondary);
  border-radius: var(--radius-md); height: 5px;
  margin-bottom: 1rem; overflow: hidden;
}
.hw-progress-fill {
  height: 5px; background: var(--brand-gradient);
  border-radius: var(--radius-md); transition: width 0.4s;
}
.hw-stats { display: flex; gap: 8px; margin-bottom: 1rem; flex-wrap: wrap; }
.hw-stat {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 4px 10px; font-size: 13px; color: var(--text-secondary);
}
.hw-stat b { font-weight: 500; }
.hw-card {
  background: var(--bg-primary);
  border: 0.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.125rem; margin-bottom: 12px;
}
.hw-card.hw-full { border-color: #16A34A; }
.hw-card.hw-close { border-color: #2563EB; }
.hw-card.hw-partial { border-color: #D97706; }
.hw-card.hw-notquite { border-color: #DC2626; }
.hw-word-ref { font-size: 12px; color: var(--text-tertiary); margin-bottom: 4px; }
.hw-eng { font-size: 16px; line-height: 1.8; margin-bottom: 6px; }
.hw-hint { font-size: 13px; color: var(--text-tertiary); margin-bottom: 10px; }
.hw-hover-word {
  display: inline; position: relative;
  border-bottom: 1px dashed var(--border-medium);
  cursor: pointer;
}
.hw-word-tip {
  display: none; position: absolute;
  bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--bg-primary);
  border: 0.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem; white-space: nowrap;
  z-index: 99; font-size: 13px; text-align: center;
  box-shadow: var(--shadow-sm); min-width: 110px; pointer-events: none;
}
.hw-hover-word:hover .hw-word-tip,
.hw-hover-word:focus .hw-word-tip { display: block; }
.hw-word-tip .wt-ar { font-family: var(--arabic-font); font-size: 17px; direction: rtl; display: block; }
.hw-word-tip .wt-status {
  font-size: 11px; padding: 2px 6px; border-radius: var(--radius-sm);
  display: inline-block; margin-top: 3px;
}
.wt-studied { background: #DCFCE7; color: #14532D; }
.wt-unseen { background: #FEF3C7; color: #92400E; }
.hw-input-row { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; }
.hw-input {
  flex: 1; font-family: var(--arabic-font);
  font-size: 18px; direction: rtl;
  padding: 9px 12px; border-radius: var(--radius-md);
  border: 0.5px solid var(--border-medium);
  background: var(--bg-secondary);
  color: var(--text-primary); outline: none;
}
.hw-input:focus { border-color: #F06B2D; background: var(--bg-primary); }
.hw-btn-check {
  padding: 9px 18px; border-radius: var(--radius-md);
  background: var(--brand-gradient); color: #fff;
  border: none; cursor: pointer; font-size: 14px;
}
.hw-btn-skip {
  padding: 9px 12px; border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-medium);
  cursor: pointer; font-size: 13px; color: var(--text-tertiary);
}
.hw-band {
  display: inline-block; font-size: 13px; font-weight: 500;
  padding: 3px 10px; border-radius: var(--radius-sm); margin-bottom: 8px;
}
.band-full { background: #DCFCE7; color: #14532D; }
.band-close { background: #DBEAFE; color: #1E3A8A; }
.band-partial { background: #FEF3C7; color: #92400E; }
.band-notquite { background: #FEF2F2; color: #991B1B; }
.hw-diff-row {
  font-family: var(--arabic-font);
  font-size: 15px; direction: rtl; line-height: 2;
  background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 6px 10px; margin: 4px 0;
}
.hw-diff-label { font-family: inherit; font-size: 11px; color: var(--text-tertiary); direction: ltr; margin-bottom: 2px; }
.hw-del { background: #FEF2F2; color: #991B1B; border-radius: 3px; padding: 0 2px; text-decoration: line-through; }
.hw-ins { background: #DCFCE7; color: #14532D; border-radius: 3px; padding: 0 2px; }
.hw-explain-btn {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 6px; padding: 6px 14px;
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  cursor: pointer; font-size: 13px; color: var(--text-primary);
}

/* ─── Forgetting list ────────────────────────────────────────── */
.forgetting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border-light);
  background: var(--bg-primary); cursor: pointer;
}
.forgetting-row:hover { background: var(--bg-secondary); }
.forgetting-count {
  font-size: 12px; padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: #FEF2F2; color: #991B1B;
}

/* ─── Daily Review ───────────────────────────────────────────── */
.daily-header {
  background: var(--brand-gradient);
  padding: 1.25rem; color: #fff;
}
.daily-header h1 { font-size: 20px; font-weight: 500; margin-bottom: 4px; }
.daily-header p { font-size: 13px; opacity: 0.85; }

/* ─── Utility ────────────────────────────────────────────────── */
.divider { border: none; border-top: 0.5px solid var(--border-light); margin: 8px 0; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.p-1 { padding: 8px; } .p-2 { padding: 16px; }
.px-1 { padding-left: 8px; padding-right: 8px; }
.full-width { width: 100%; }
.acc-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 400px) {
  .card-ar { font-size: 26px !important; }
  .sarf-table { font-size: 12px; }
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 2px; }
