/* ============================================
   SpiritFit — Main Stylesheet
   Light theme · Purple + Blue · Refined Spiritual
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&family=Noto+Nastaliq+Urdu:wght@400;600;700&family=Noto+Naskh+Arabic:wght@400;600;700&display=swap');

:root {
  --purple:      #6c3fc5;
  --purple-soft: #8b5cf6;
  --purple-pale: #ede9fe;
  --purple-xpal: #f5f3ff;
  --blue:        #3b82f6;
  --blue-soft:   #60a5fa;
  --blue-pale:   #dbeafe;
  --gold:        #d97706;
  --gold-pale:   #fef3c7;
  --green:       #059669;
  --green-pale:  #d1fae5;
  --red:         #dc2626;
  --red-pale:    #fee2e2;
  --orange:      #ea580c;
  --orange-pale: #ffedd5;

  --bg:          #f8f7ff;
  --bg2:         #ffffff;
  --card:        #ffffff;
  --card-hover:  #faf9ff;
  --border:      #e5e0f8;
  --border2:     #ede9fe;
  --text:        #1e1b4b;
  --text2:       #4c4489;
  --muted:       #5c548a; /* Enhanced contrast slate-purple (passes WCAG AA 4.5:1 ratio) */
  --muted2:      #8e85be; /* Enhanced contrast medium-purple for borders/scrollbars */

  --shadow-sm:   0 1px 4px rgba(108,63,197,0.08);
  --shadow-md:   0 4px 20px rgba(108,63,197,0.12);
  --shadow-lg:   0 8px 40px rgba(108,63,197,0.16);
  --radius-sm:   10px;
  --radius:      16px;
  --radius-lg:   24px;

  --nav-h:       64px;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.lang-ur {
  font-family: 'Noto Nastaliq Urdu', serif;
  line-height: 2.3;
  font-size: 17px;
}
body.lang-ar {
  font-family: 'Noto Naskh Arabic', serif;
  line-height: 1.8;
  font-size: 16px;
}

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

/* ── App Shell ── */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background: var(--bg);
}

/* ── Pages ── */
.page {
  display: none;
  padding: 0 0 calc(var(--nav-h) + 80px); /* Account for both bottom nav and floating sticky bottom ad spacing */
  animation: fadeUp 0.3s ease;
}
.page.active { display: block; }

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

/* ── Top Bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248,247,255,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.topbar-date {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.lang-pill {
  display: flex;
  gap: 2px;
  background: var(--purple-xpal);
  border-radius: 20px;
  padding: 3px;
}
.lang-btn {
  padding: 3px 9px;
  border-radius: 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.lang-btn.active {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 2px 8px rgba(108,63,197,0.3);
}

/* ── Hero / Greeting ── */
.hero {
  padding: 24px 20px 16px;
  background: linear-gradient(160deg, #f5f3ff 0%, #dbeafe 100%);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '✦';
  position: absolute;
  top: -10px; right: 20px;
  font-size: 5rem;
  color: rgba(108,63,197,0.06);
  line-height: 1;
}
.hero-greeting {
  font-size: 0.8rem;
  color: var(--purple-soft);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}
.hero-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 12px;
}
.hero-quote {
  font-size: 0.82rem;
  color: var(--text2);
  font-style: italic;
  line-height: 1.6;
  border-right: 3px solid var(--purple-soft);
  padding-right: 12px;
  margin-bottom: 16px;
}
body[dir="ltr"] .hero-quote {
  border-right: none;
  border-left: 3px solid var(--purple-soft);
  padding-right: 0;
  padding-left: 12px;
}

/* Streak + Progress Row */
.hero-stats {
  display: flex;
  gap: 10px;
  align-items: center;
}
.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--purple), var(--blue-soft));
  color: #fff;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(108,63,197,0.3);
}
.progress-ring-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border-radius: 12px;
  padding: 8px 14px;
  box-shadow: var(--shadow-sm);
}
.progress-ring-wrap svg { flex-shrink: 0; }
.progress-ring-text { font-size: 0.78rem; color: var(--text2); }
.progress-ring-text strong { display: block; font-size: 1.1rem; color: var(--purple); font-weight: 700; }

/* ── Ad Banner ── */
.ad-banner {
  margin: 12px 20px;
  background: linear-gradient(135deg, #f0ebff, #e0eaff);
  border: 1px dashed var(--muted2);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-banner-sticky {
  position: fixed;
  bottom: var(--nav-h);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(255,255,255,0.95);
  border-top: 1px solid var(--border);
  padding: 8px 16px;
  z-index: 90;
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Sections ── */
.section-wrap { padding: 0 16px; margin-bottom: 12px; }

.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border2);
  background: linear-gradient(135deg, #faf9ff, #f0f4ff);
}
.section-icon { font-size: 1.1rem; flex-shrink: 0; }
.section-title {
  flex: 1;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}
.section-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--purple-xpal);
  color: var(--purple-soft);
  transition: all 0.3s;
}
.section-pill.done {
  background: var(--green-pale);
  color: var(--green);
}
.section-chevron {
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform 0.2s;
}
.section-card.collapsed .section-chevron { transform: rotate(-90deg); }
.section-card.collapsed .section-body { display: none; }

/* ── Items ── */
.sub-label {
  padding: 10px 16px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--purple-xpal);
  border-bottom: 1px solid var(--border2);
}

.tracker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border2);
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}
.tracker-item:last-child { border-bottom: none; }
.tracker-item:active, .tracker-item:hover { background: var(--card-hover); }

.item-accent {
  width: 4px;
  height: 32px;
  border-radius: 4px;
  background: var(--muted2);
  flex-shrink: 0;
  transition: background 0.2s;
}
.tracker-item.done .item-accent { background: var(--green); }

.item-text { flex: 1; }
.item-name { font-size: 0.88rem; font-weight: 500; color: var(--text); line-height: 1.4; }
.item-sub  { font-size: 0.72rem; color: var(--muted); margin-top: 1px; }

.count-box {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--purple-xpal);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 4px 8px;
  flex-shrink: 0;
}
.count-box input {
  width: 44px;
  border: none;
  background: transparent;
  color: var(--purple);
  font-weight: 700;
  font-size: 0.88rem;
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  -moz-appearance: textfield;
}
.count-box input:focus { outline: none; }
.count-box input::-webkit-inner-spin-button,
.count-box input::-webkit-outer-spin-button { -webkit-appearance: none; }
.count-box span { font-size: 0.65rem; color: var(--muted); }

/* Toggle Switch */
.toggle {
  width: 44px; height: 26px;
  border-radius: 13px;
  background: var(--muted2);
  position: relative;
  flex-shrink: 0;
  transition: background 0.25s;
}
.toggle::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  top: 3px; left: 3px;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.tracker-item.done .toggle { background: linear-gradient(135deg, var(--green), #34d399); }
.tracker-item.done .toggle::after { transform: translateX(18px); }

/* ── Reflection Card ── */
.reflect-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin: 0 16px 12px;
}
.reflect-head {
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--purple-xpal), var(--blue-pale));
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.reflect-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.field-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
textarea {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 10px 12px;
  resize: none;
  line-height: 1.7;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea:focus {
  outline: none;
  border-color: var(--purple-soft);
  box-shadow: 0 0 0 3px rgba(108,63,197,0.1);
}
textarea::placeholder { color: var(--muted2); }

/* Rating Buttons */
.rating-row { display: flex; gap: 6px; flex-wrap: wrap; }
.rating-btn {
  flex: 1; min-width: 56px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  font-weight: 500;
}
.rating-btn:hover { border-color: var(--purple-soft); color: var(--purple); }
.rating-btn.selected {
  border-color: var(--purple);
  background: var(--purple-xpal);
  color: var(--purple);
  font-weight: 700;
}

/* ── Action Buttons ── */
.btn-primary {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  border: none;
  border-radius: var(--radius);
  color: white;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(108,63,197,0.35);
  letter-spacing: 0.2px;
}
.btn-primary:active { transform: scale(0.98); opacity: 0.9; }

.btn-ghost {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--purple-soft); color: var(--purple); }

.action-wrap { padding: 0 16px; margin-bottom: 10px; }
.copy-toast {
  text-align: center;
  font-size: 0.82rem;
  color: var(--green);
  font-weight: 600;
  height: 24px;
  margin: 4px 0;
  transition: opacity 0.3s;
}

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: var(--nav-h);
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(108,63,197,0.08);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s;
  border: none;
  background: transparent;
  color: var(--muted);
  flex: 1;
}
.nav-item:hover { color: var(--purple-soft); }
.nav-item.active { color: var(--purple); }
.nav-icon { font-size: 1.3rem; transition: transform 0.2s; }
.nav-item.active .nav-icon { transform: translateY(-2px); }
.nav-label { font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; font-family: 'DM Sans', sans-serif; }

/* Active nav indicator */
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 32px; height: 3px;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  border-radius: 0 0 4px 4px;
}
.nav-item { position: relative; }

/* ── Onboarding ── */
#onboarding {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* Prevent vertical clipping on small screens */
  overflow-y: auto;           /* Enable scrolling for onboarding content */
  padding: 40px 24px;
  gap: 24px;
  animation: fadeUp 0.4s ease;
}
.ob-logo {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ob-tagline { font-size: 0.9rem; color: var(--muted); text-align: center; }
.ob-title { font-size: 1rem; font-weight: 700; color: var(--text); text-align: center; }

.lang-row { display: flex; gap: 10px; justify-content: center; }
.lang-choice {
  padding: 8px 18px;
  border-radius: 20px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text2);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.lang-choice.active {
  border-color: var(--purple);
  background: var(--purple);
  color: white;
}

.mode-grid { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 360px; }
.mode-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.mode-card:hover { border-color: var(--purple-soft); background: var(--purple-xpal); }
.mode-card.active { border-color: var(--purple); background: var(--purple-xpal); }
.mode-card.active .mode-check { background: var(--purple); border-color: var(--purple); color: white; }
.mode-emoji { font-size: 1.8rem; }
.mode-info { flex: 1; }
.mode-name { font-weight: 700; font-size: 0.92rem; color: var(--text); }
.mode-desc { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.mode-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--muted2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  color: transparent;
  transition: all 0.2s;
  flex-shrink: 0;
}

/* ── Progress Page ── */
.prog-header {
  padding: 24px 20px 16px;
  background: linear-gradient(160deg, var(--purple-xpal), var(--blue-pale));
  border-bottom: 1px solid var(--border);
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}
.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.stat-val {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: 0.72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

.week-chart {
  margin: 0 16px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.chart-title { font-size: 0.78rem; font-weight: 700; color: var(--text2); margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.5px; }
.bar-row { display: flex; align-items: flex-end; gap: 8px; height: 80px; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--purple-soft), var(--blue-soft));
  min-height: 4px;
  transition: height 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
.bar-day { font-size: 0.62rem; color: var(--muted); font-weight: 600; }
.bar-pct { font-size: 0.6rem; color: var(--purple); font-weight: 700; }

/* ── History Page ── */
.hist-header {
  padding: 24px 20px 16px;
  background: linear-gradient(160deg, var(--purple-xpal), var(--blue-pale));
  border-bottom: 1px solid var(--border);
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}
.hist-list { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.hist-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: box-shadow 0.2s;
}
.hist-item:hover { box-shadow: var(--shadow-md); }
.hist-ring {
  width: 44px; height: 44px;
  flex-shrink: 0;
}
.hist-info { flex: 1; }
.hist-date { font-size: 0.8rem; font-weight: 700; color: var(--text); }
.hist-rating { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.hist-pct {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--purple);
}
.hist-empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 0.9rem; }

/* ── Settings Page ── */
.set-header {
  padding: 24px 20px 16px;
  background: linear-gradient(160deg, var(--purple-xpal), var(--blue-pale));
  border-bottom: 1px solid var(--border);
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
}
.set-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.set-group {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.set-group-title {
  padding: 10px 16px;
  background: var(--purple-xpal);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--purple);
  border-bottom: 1px solid var(--border);
}
.set-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border2);
  cursor: pointer;
}
.set-row:last-child { border-bottom: none; }
.set-row-icon { font-size: 1.1rem; flex-shrink: 0; }
.set-row-text { flex: 1; }
.set-row-name { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.set-row-sub  { font-size: 0.72rem; color: var(--muted); margin-top: 1px; }
.set-row-arrow { color: var(--muted); font-size: 0.8rem; }

.set-input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 14px;
  transition: border-color 0.2s;
}
.set-input:focus { outline: none; border-color: var(--purple-soft); }

/* ── Privacy Page ── */
.privacy-body { padding: 20px; max-width: 480px; }
.privacy-body h1 { font-family: 'Playfair Display', serif; font-size: 1.6rem; color: var(--text); margin-bottom: 8px; }
.privacy-body h2 { font-size: 1rem; color: var(--purple); margin: 20px 0 6px; }
.privacy-body p, .privacy-body li { font-size: 0.85rem; color: var(--text2); line-height: 1.8; margin-bottom: 8px; }
.privacy-body ul { padding-right: 20px; }
body[dir='ltr'] .privacy-body ul { padding-right: 0; padding-left: 20px; }

/* ── Utility ── */
.hidden { display: none !important; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }

/* ── RTL Fixes ── */
body[dir="rtl"] .toggle::after { left: auto; right: 3px; }
body[dir="rtl"] .tracker-item.done .toggle::after { transform: translateX(-18px); }
body[dir="rtl"] .hero-quote { border-right: 3px solid var(--purple-soft); border-left: none; padding-right: 12px; padding-left: 0; }

/* ── Animations ── */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.streak-badge { animation: pulse 3s ease-in-out infinite; }

/* ── Section color themes ── */
.section-faraiz  .section-head { background: linear-gradient(135deg, #fff7ed, #ffedd5); }
.section-faraiz  .section-title { color: var(--orange); }
.section-quran   .section-head { background: linear-gradient(135deg, #eff6ff, #dbeafe); }
.section-quran   .section-title { color: var(--blue); }
.section-azkaar  .section-head { background: linear-gradient(135deg, #fef2f2, #fee2e2); }
.section-azkaar  .section-title { color: var(--red); }
.section-nawafil .section-head { background: linear-gradient(135deg, #f0fdf4, #dcfce7); }
.section-nawafil .section-title { color: var(--green); }
.section-muraq   .section-head { background: linear-gradient(135deg, #faf5ff, #ede9fe); }
.section-muraq   .section-title { color: var(--purple); }
.section-mamno   .section-head { background: linear-gradient(135deg, #fefce8, #fef9c3); }
.section-mamno   .section-title { color: var(--gold); }
.section-spirit  .section-head { background: linear-gradient(135deg, #faf5ff, #ede9fe); }
.section-spirit  .section-title { color: var(--purple); }
.section-fitness .section-head { background: linear-gradient(135deg, #f0fdf4, #dcfce7); }
.section-fitness .section-title { color: var(--green); }

/* ── Desktop & Large Screen Optimizations ── */
@media (min-width: 768px) {
  body {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    padding: 24px 20px;
    min-height: 100vh;
  }

  /* Page visibility — must override ID selectors below */
  .page { display: none !important; }
  .page.active { display: block !important; }

  #app {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    background: var(--bg2);
    min-height: auto;
    position: relative;
  }

  /* Keep bottom navigation inside the desktop card container */
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 600px;
    border-radius: 0;
  }

  .ad-banner-sticky {
    max-width: 600px;
  }

  /* Wider stat cards on desktop */
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  /* History items side by side */
  .hist-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  /* Settings 2-column on desktop */
  .set-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .set-body .btn-primary {
    grid-column: span 2;
  }

  .set-body .copy-toast {
    grid-column: span 2;
  }

  /* Onboarding desktop card */
  #onboarding {
    max-width: 600px;
    margin: 40px auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    position: relative;
    inset: auto;
    height: auto;
    min-height: 500px;
    padding: 48px;
  }
}

/* ── Firebase Auth UI ─────────────────────────────────────────────────────── */

/* Signed-in user card */
.auth-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--purple-xpal);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.auth-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.auth-info { flex: 1; min-width: 0; }

.auth-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-sub {
  font-size: 0.75rem;
  color: var(--green);
  margin-top: 1px;
}

/* Google Sign-In button inherits .btn-primary but we add an icon gap */
#btn-google-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9rem;
}

#btn-google-signin:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ── Email/Password Authentication UI Styles ── */
.email-auth-box {
  animation: fadeIn 0.3s ease;
}

.auth-tab {
  transition: all 0.2s ease;
}

.auth-tab.active {
  background: #ffffff !important;
  color: var(--purple) !important;
  box-shadow: var(--shadow-sm);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
