/* ============================================================
   قُرآني — Main Stylesheet
   Design: Deep forest green + warm gold + cream
   Fonts: Amiri (display), Noto Naskh Arabic (body)
   ============================================================ */

/* ─── CSS CUSTOM PROPERTIES (Design Tokens) ─── */
:root {
  --green-deep:   #1B4332;   /* primary dark green */
  --green-mid:    #2D6A4F;   /* medium green for buttons */
  --green-light:  #52B788;   /* accent / active state */
  --green-pale:   #D8F3DC;   /* very light tint */
  --gold:         #C9A84C;   /* golden accent */
  --gold-light:   #F0D58C;   /* lighter gold */
  --cream:        #FDFAF5;   /* page background */
  --cream-2:      #F4F0E8;   /* card background */
  --text-dark:    #1A1A1A;
  --text-mid:     #4A4A4A;
  --text-soft:    #8A8A8A;
  --border:       #E2DDD4;
  --radius-sm:    8px;
  --radius-md:    16px;
  --radius-lg:    24px;
  --shadow-sm:    0 2px 8px rgba(27,67,50,.08);
  --shadow-md:    0 6px 20px rgba(27,67,50,.12);
  --transition:   0.3s cubic-bezier(0.4,0,0.2,1);
}

/* ─── RESET & BASE ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Naskh Arabic', serif;
  background: var(--cream);
  color: var(--text-dark);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Decorative font for headings */
h1, h2, h3, .brand-name {
  font-family: 'Amiri', serif;
}

/* ─── BACKGROUND CANVAS (geometric pattern) ─── */
#bgCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: .35;
}

/* ─── APP WRAPPER ─── */
#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* ─── PAGE TRANSITIONS ─── */
/* Pages are shown/hidden; .active triggers fade-in */
.page {
  min-height: 100vh;
  animation: fadeIn .45s ease forwards;
}

.page.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── UTILITY ─── */
.hidden { display: none !important; }

/* ============================================================
   AUTH PAGES (Login & Register)
   ============================================================ */

/* Centered column container for auth pages */
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 48px;
  gap: 28px;
}

/* ─── BRAND BLOCK ─── */
.brand {
  text-align: center;
  animation: dropIn .6s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-24px) scale(.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Circular icon container with gold ring */
.brand-icon  {
  background: transparent !important;
  box-shadow: none !important;
}

.brand-icon img {
  width: 30%;
  height: 30%;
  object-fit: contain;
}

.brand-name {
  font-size: 2.8rem;
  color: var(--green-deep);
  letter-spacing: -.5px;
  line-height: 1;
}

.brand-tagline {
  font-size: .95rem;
  color: var(--text-soft);
  margin-top: 6px;
}

/* ─── CARD ─── */
/* Generic white card used throughout the app */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px;
  animation: slideUp .5s .15s cubic-bezier(0.4,0,0.2,1) both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Form title inside card */
.form-title {
  font-size: 1.5rem;
  color: var(--green-deep);
  margin-bottom: 24px;
  text-align: center;
}

/* ─── FORM FIELDS ─── */
.field-group {
  margin-bottom: 18px;
}

.field-label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 8px;
}

/* Wrapper that holds icon + input */
.field-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  right: 14px;
  color: var(--green-light);
  font-size: .9rem;
  pointer-events: none;
}

.field-input {
  width: 100%;
  padding: 12px 40px 12px 42px; /* space for icons on both sides */
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Noto Naskh Arabic', serif;
  font-size: 1rem;
  color: var(--text-dark);
  background: var(--cream);
  transition: border-color var(--transition), box-shadow var(--transition);
  direction: rtl;
}

.field-input:focus {
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(45,106,79,.15);
}

/* Show/hide password toggle button */
.toggle-password {
  position: absolute;
  left: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-soft);
  font-size: .9rem;
  padding: 4px;
  transition: color var(--transition);
}

.toggle-password:hover { color: var(--green-mid); }

/* Inline hint text under a field */
.field-hint {
  font-size: .8rem;
  margin-top: 5px;
  display: block;
}

.field-hint.ok  { color: var(--green-light); }
.field-hint.err { color: #d32f2f; }

/* ─── ALERTS ─── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-error   { background: #fdecea; color: #c62828; border: 1px solid #ef9a9a; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-family: 'Noto Naskh Arabic', serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

/* Primary green button */
.btn-primary {
  background: linear-gradient(135deg, var(--green-mid), var(--green-deep));
  color: #fff;
  box-shadow: 0 4px 14px rgba(27,67,50,.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(27,67,50,.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Disabled state: applies to any button (e.g. login/register when
   required fields are still empty) */
.btn:disabled,
.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Ghost / outline button */
.btn-ghost {
  background: transparent;
  color: var(--green-mid);
  border: 1.5px solid var(--green-mid);
}

.btn-ghost:hover { background: var(--green-pale); }

/* Full-width button */
.btn-full {
  width: 100%;
  margin-top: 8px;
}

/* Plain text link button */
.btn-text {
  background: none;
  border: none;
  color: var(--green-mid);
  font-family: 'Noto Naskh Arabic', serif;
  font-size: .9rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background var(--transition);
}

.btn-text:hover { background: var(--green-pale); }

/* Icon-only button (used in topbar logout) */
.btn-icon {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-mid);
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--green-pale);
  color: var(--green-deep);
}

/* Switch link under auth forms */
.auth-switch {
  text-align: center;
  font-size: .9rem;
  color: var(--text-soft);
  margin-top: 20px;
}

.auth-switch a {
  color: var(--green-mid);
  font-weight: 700;
  text-decoration: none;
}

.auth-switch a:hover { text-decoration: underline; }


/* ============================================================
   MAIN APP LAYOUT
   ============================================================ */

/* Top navigation bar (now contains brand/user row + nav tabs row) */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--green-deep);
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}

.topbar-inner {
  max-width: 600px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
  font-family: 'Amiri', serif;
  font-size: 1.3rem;
}

.topbar-brand i { font-size: 1.1rem; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,.85);
  font-size: .9rem;
}

.logout-btn {
  color: rgba(255,255,255,.7) !important;
}

.logout-btn:hover {
  background: rgba(255,255,255,.15) !important;
  color: #fff !important;
}

/* Tab navigation — now a second row inside the top bar */
.top-nav {
  max-width: 600px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  border-top: 1px solid rgba(255,255,255,.12);
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.55);  /* dimmed: pages I'm NOT on */
  font-family: 'Noto Naskh Arabic', serif;
  font-size: .75rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

/* The page I'm currently on: clearly brighter than the others */
.nav-tab.active {
  color: var(--gold);
  font-weight: 700;
  text-shadow: 0 0 12px rgba(212,175,55,.45);
}

.nav-tab.active::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 3px;
  background: var(--gold);
  border-radius: 3px 3px 0 0;
}

.nav-tab:hover:not(.active) { color: rgba(255,255,255,.8); }

.nav-tab i { font-size: 1.15rem; }

/* Scrollable main content area below the top bar */
.main-content {
  padding-top: 132px;  /* topbar (60px) + nav row (56px) + gap */
  padding-bottom: 24px;
  padding-inline: 16px;
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
}

/* Tab panels: only .active is shown */
.tab-panel {
  animation: fadeIn .35s ease;
}

.tab-panel.hidden { display: none; }

/* Section headers inside tabs */
.section-header {
  margin-bottom: 18px;
}

.greeting-sub {
  font-size: .9rem;
  color: var(--text-soft);
}

.greeting-name {
  font-size: 1.7rem;
  color: var(--green-deep);
  line-height: 1.2;
}

.section-title {
  font-size: 1.5rem;
  color: var(--green-deep);
}

.section-sub {
  font-size: .85rem;
  color: var(--text-soft);
  margin-top: 4px;
}


/* ============================================================
   PROGRESS TAB COMPONENTS
   ============================================================ */

/* ─── Progress ring card ─── */
.progress-ring-card {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

/* SVG ring wrapper (positions text over ring) */
.ring-wrap {
  position: relative;
  width: 140px;
  height: 140px;
}

.ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* start fill from top */
}

/* Background track circle */
.ring-bg {
  fill: none;
  stroke: var(--green-pale);
  stroke-width: 10;
}

/* Animated fill circle */
.ring-fill {
  fill: none;
  stroke: url(#ringGradient);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4,0,0.2,1);
}

/* Centered text over the ring */
.ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-percent {
  font-family: 'Amiri', serif;
  font-size: 2rem;
  color: var(--green-deep);
  line-height: 1;
}

.ring-label {
  font-size: .75rem;
  color: var(--text-soft);
}

.ring-detail {
  text-align: center;
  font-size: .9rem;
  color: var(--text-mid);
}

.ring-detail strong {
  color: var(--green-mid);
  font-size: 1.1rem;
}

/* ─── Stats row ─── */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  padding: 18px 16px;
  text-align: center;
}

.stat-icon {
  font-size: 1.4rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.stat-val {
  font-family: 'Amiri', serif;
  font-size: 2rem;
  color: var(--green-deep);
  line-height: 1;
}

.stat-lbl {
  font-size: .78rem;
  color: var(--text-soft);
  margin-top: 4px;
}

/* ─── Weekly repetition card ─── */
.repeat-card {
  padding: 20px;
  margin-bottom: 16px;
}

.repeat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.repeat-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green-mid);
  font-weight: 600;
  font-size: .95rem;
}

.repeat-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.repeat-surah-name {
  font-family: 'Amiri', serif;
  font-size: 1.5rem;
  color: var(--green-deep);
}

/* Counter: − [number] + */
.repeat-counter {
  display: flex;
  align-items: center;
  gap: 14px;
}

.counter-val {
  font-family: 'Amiri', serif;
  font-size: 1.8rem;
  color: var(--green-deep);
  min-width: 40px;
  text-align: center;
}

.counter-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mid);
  transition: all var(--transition);
}

.counter-btn:hover { border-color: var(--green-mid); color: var(--green-mid); }

.counter-btn-add {
  background: var(--green-mid);
  border-color: var(--green-mid);
  color: #fff;
}

.counter-btn-add:hover {
  background: var(--green-deep);
  color: #fff;
}

/* Thin progress bar for repeat goal */
.repeat-progress-wrap {
  height: 6px;
  background: var(--green-pale);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.repeat-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green-light), var(--green-mid));
  border-radius: 3px;
  width: 0%;
  transition: width .6s ease;
}

.repeat-target-lbl {
  font-size: .82rem;
  color: var(--text-soft);
}

/* ─── Activity heatmap ─── */
.heatmap-card {
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 1rem;
  color: var(--text-mid);
  font-weight: 600;
  margin-bottom: 16px;
}

/* 7-column grid for days (Sun-Sat columns) */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

/* Each day cell */
.heatmap-day {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--cream-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  color: var(--text-soft);
  cursor: pointer;
  transition: transform .2s, background .2s;
  position: relative;
}

.heatmap-day:hover { transform: scale(1.1); }

/* Color levels based on pages read that day */
.heatmap-day.level-1 { background: #c8f0d8; border-color: #a8e4c0; color: var(--green-deep); }
.heatmap-day.level-2 { background: #74c69d; border-color: #52b788; color: #fff; }
.heatmap-day.level-3 { background: #2d6a4f; border-color: #1b4332; color: #fff; }
.heatmap-day.level-4 { background: #1b4332; border-color: #0d2b1f; color: var(--gold-light); }

/* Today highlight ring */
.heatmap-day.today {
  box-shadow: 0 0 0 2px var(--gold);
}


/* ============================================================
   SURAHS TAB COMPONENTS
   ============================================================ */

/* Search field */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.search-icon {
  position: absolute;
  right: 14px;
  color: var(--text-soft);
  font-size: .9rem;
}

.search-input {
  width: 100%;
  padding: 12px 42px 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: 'Noto Naskh Arabic', serif;
  font-size: .95rem;
  background: #fff;
  color: var(--text-dark);
  transition: border-color var(--transition);
  direction: rtl;
}

.search-input:focus {
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(45,106,79,.12);
}

/* Pages progress card (above surah list) */
.pages-card {
  padding: 18px 20px;
  margin-bottom: 16px;
}

.pages-header {
  display: flex;
  justify-content: space-between;
  font-size: .9rem;
  color: var(--text-mid);
  margin-bottom: 10px;
  font-weight: 600;
}

.thin-progress-wrap {
  height: 8px;
  background: var(--green-pale);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.thin-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green-light), var(--green-deep));
  border-radius: 4px;
  width: 0%;
  transition: width .8s ease;
}

.pages-surahs {
  font-size: .82rem;
  color: var(--text-soft);
}

/* List of surah items */
.surah-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 8px;
}

/* Individual surah row */
.surah-item {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition);
}

.surah-item:hover {
  border-color: var(--green-mid);
  transform: translateX(-2px);
  box-shadow: var(--shadow-sm);
}

/* Completed surah gets a filled background */
.surah-item.completed {
  background: linear-gradient(135deg, var(--green-pale), #edf7f0);
  border-color: var(--green-light);
}

.surah-info { display: flex; align-items: center; gap: 12px; }

/* Circular surah number badge */
.surah-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cream-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  color: var(--text-soft);
  flex-shrink: 0;
}

.surah-item.completed .surah-num {
  background: var(--green-mid);
  border-color: var(--green-mid);
  color: #fff;
}

.surah-name {
  font-family: 'Amiri', serif;
  font-size: 1.1rem;
  color: var(--text-dark);
}

.surah-meta {
  font-size: .78rem;
  color: var(--text-soft);
  margin-top: 2px;
}

/* Pages indicator on the left side of each row */
.surah-pages-indicator {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.surah-pages-lbl {
  font-size: .78rem;
  color: var(--text-soft);
}

/* Thin bar showing pages read vs total for this surah */
.surah-bar-wrap {
  width: 60px;
  height: 4px;
  background: var(--cream-2);
  border-radius: 2px;
  overflow: hidden;
}

.surah-bar {
  height: 100%;
  background: var(--green-light);
  border-radius: 2px;
}


/* ============================================================
   CLASSMATES TAB (LEADERBOARD)
   ============================================================ */

.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Single leaderboard entry */
.leaderboard-item {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition);
}

.leaderboard-item:hover {
  transform: translateX(-2px);
  box-shadow: var(--shadow-sm);
}

/* Top 3 get special gold/silver/bronze borders */
.leaderboard-item.rank-1 { border-color: var(--gold); background: linear-gradient(135deg,#fffaef,#fff); }
.leaderboard-item.rank-2 { border-color: #a8b2bc; }
.leaderboard-item.rank-3 { border-color: #c97b3a; }

/* Current user's row highlighted in green */
.leaderboard-item.is-me {
  border-color: var(--green-mid);
  background: linear-gradient(135deg, var(--green-pale), #fff);
}

/* Rank number (1, 2, 3…) */
.rank-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--cream-2);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Amiri', serif;
  font-size: 1.1rem;
  color: var(--text-mid);
  flex-shrink: 0;
}

.leaderboard-item.rank-1 .rank-badge { background: var(--gold); border-color: var(--gold); color: #fff; }
.leaderboard-item.rank-2 .rank-badge { background: #a8b2bc; border-color: #a8b2bc; color: #fff; }
.leaderboard-item.rank-3 .rank-badge { background: #c97b3a; border-color: #c97b3a; color: #fff; }

.leaderboard-info { flex: 1; }

.leaderboard-name {
  font-weight: 600;
  color: var(--text-dark);
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Small tag shown next to your own name */
.me-tag {
  font-size: .7rem;
  background: var(--green-mid);
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
}

.leaderboard-pages {
  font-size: .82rem;
  color: var(--text-soft);
  margin-top: 2px;
}

.leaderboard-pages strong {
  color: var(--green-mid);
}

/* Pages percent pill on right side */
.leaderboard-pct {
  font-family: 'Amiri', serif;
  font-size: 1.1rem;
  color: var(--green-deep);
  font-weight: 700;
}


/* ============================================================
   MODALS
   ============================================================ */

/* Dark overlay behind modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  display: flex;
  align-items: flex-end; /* slides up from bottom on mobile */
  justify-content: center;
  padding: 0 0 0;
  animation: overlayIn .25s ease;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* White modal box */
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 28px 24px 36px;
  width: 100%;
  max-width: 520px;
  position: relative;
  animation: sheetUp .35s cubic-bezier(0.34,1.56,0.64,1);
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--cream-2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  transition: all var(--transition);
}

.modal-close:hover { background: var(--green-pale); color: var(--green-deep); }

.modal-title {
  font-family: 'Amiri', serif;
  font-size: 1.5rem;
  color: var(--green-deep);
  margin-bottom: 6px;
  text-align: center;
}

/* ============================================================
   CELEBRATION MODAL
   Shown when the user finishes the whole Quran, or hits their
   repetition target. Includes a confetti burst animation.
   ============================================================ */

.celebration-box {
  text-align: center;
  overflow: hidden;
  padding-top: 36px;
}

.celebration-icon {
  width: 92px;
  height: 92px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #f0d878);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  color: #fff;
  box-shadow: 0 8px 24px rgba(212,175,55,.45);
  animation: trophyPop .6s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes trophyPop {
  0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

.celebration-title {
  font-family: 'Amiri', serif;
  font-size: 1.9rem;
  color: var(--green-deep);
  margin-bottom: 8px;
}

.celebration-msg {
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 8px;
  padding: 0 8px;
}

/* Confetti burst: a handful of colored pieces falling + spinning */
.confetti-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  opacity: 0;
  animation: confettiFall 2.2s ease-in forwards;
}

@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg);    opacity: 1; }
  100% { transform: translateY(420px) rotate(540deg); opacity: 0; }
}

.modal-sub {
  font-size: .88rem;
  color: var(--text-soft);
  text-align: center;
  margin-bottom: 20px;
}

/* Number counter inside modal */
.modal-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 16px 0;
}

.modal-counter .counter-val {
  font-size: 2.2rem;
}

.modal-max {
  text-align: center;
  font-size: .82rem;
  color: var(--text-soft);
}

/* Two buttons side by side (save / cancel) */
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.modal-actions .btn {
  flex: 1;
}

/* Surah list in repeat modal */
.repeat-surah-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

/* Each row in the repeat surah picker */
.repeat-surah-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  font-size: .95rem;
}

.repeat-surah-option:last-child { border-bottom: none; }
.repeat-surah-option:hover { background: var(--cream-2); }
.repeat-surah-option.selected { background: var(--green-pale); color: var(--green-deep); font-weight: 600; }
.repeat-surah-option .check-icon { color: var(--green-mid); font-size: .85rem; }

/* Currently selected surah display box */
.selected-surah-box {
  background: var(--cream-2);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  text-align: center;
}

.selected-label { font-size: .8rem; color: var(--text-soft); margin-bottom: 4px; }
.selected-name  { font-family: 'Amiri', serif; font-size: 1.4rem; color: var(--green-deep); }


/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */

.toast {
  position: fixed;
  bottom: 80px;   /* above bottom nav */
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--green-deep);
  color: #fff;
  padding: 12px 24px;
  border-radius: 40px;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity: 0;
  transition: all .35s cubic-bezier(0.34,1.56,0.64,1);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-icon { color: var(--gold); }


/* ============================================================
   LOADING SPINNER (shown during async operations)
   ============================================================ */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Button loading state */
.btn.loading {
  opacity: .8;
  pointer-events: none;
}


/* ============================================================
   SVG GRADIENT DEFINITION (for ring)
   — Hidden; referenced by ring-fill stroke
   ============================================================ */
.svg-defs { position: absolute; width: 0; height: 0; }


/* ============================================================
   RESPONSIVE — Mobile-first already; small tweaks for desktop
   ============================================================ */

@media (min-width: 600px) {
  .auth-container { padding: 60px 24px; }

  /* On desktop, modal appears centered, not bottom sheet */
  .modal-overlay { align-items: center; padding: 24px; }
  .modal-box { border-radius: var(--radius-lg); animation: zoomIn .3s ease; max-height: 80vh; }

  @keyframes zoomIn {
    from { opacity: 0; transform: scale(.9); }
    to   { opacity: 1; transform: scale(1); }
  }
}

/* Reduced motion: disable animations for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}