/* ============================================
   ALHAMMAD PRAYER APP — style.css
   Enhanced Edition: Fixed Tasbih Ring Alignment + Polished UI
   ============================================ */

:root {
  /* Dark Theme (default) */
  --bg-primary: #0d1f16;
  --bg-secondary: #132a1e;
  --bg-card: #1a3a2a;
  --bg-card2: #1f4533;
  --bg-nav: #0a1710;
  --text-primary: #f0ede4;
  --text-secondary: #a8c4b0;
  --text-muted: #6a8f76;
  --gold: #c9a84c;
  --gold-light: #e8c76a;
  --gold-dim: #7a6430;
  --accent: #2d8c5e;
  --accent-light: #3aaa72;
  --accent-glow: rgba(45, 140, 94, 0.15);
  --border: rgba(45, 140, 94, 0.2);
  --border-strong: rgba(201, 168, 76, 0.3);
  --prayer-active-bg: linear-gradient(135deg, #1e5c3e, #2d8c5e);
  --ring-bg: rgba(255, 255, 255, 0.08);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.12);
  --header-height: 60px;
  --nav-height: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="light"] {
  --bg-primary: #f8f5ef;
  --bg-secondary: #f0ebe2;
  --bg-card: #ffffff;
  --bg-card2: #f9f6ef;
  --bg-nav: #ffffff;
  --text-primary: #1a2e22;
  --text-secondary: #4a6b56;
  --text-muted: #8aaa96;
  --gold: #a07830;
  --gold-light: #c09040;
  --gold-dim: #d4b870;
  --accent: #1e7048;
  --accent-light: #28905e;
  --accent-glow: rgba(30, 112, 72, 0.08);
  --border: rgba(30, 112, 72, 0.12);
  --border-strong: rgba(160, 120, 48, 0.25);
  --prayer-active-bg: linear-gradient(135deg, #1e7048, #28905e);
  --ring-bg: rgba(0, 0, 0, 0.05);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* ============ BASE RESET ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Cairo', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow: hidden;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body.lang-en {
  direction: ltr;
}

/* Language visibility */
.lang-ar .en,
.lang-en .ar {
  display: none !important;
}

.lang-ar .ar,
.lang-en .en {
  display: block;
}

span.ar,
span.en {
  display: inline;
}

/* ============ SPLASH SCREEN ============ */
.splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.splash.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-inner {
  text-align: center;
  animation: splashIn 0.8s ease forwards;
}

@keyframes splashIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bismillah {
  font-family: 'Amiri', serif;
  font-size: 1.3rem;
  color: var(--gold);
  letter-spacing: 0.08em;
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

.splash-title {
  font-family: 'Amiri', serif;
  font-size: 3.8rem;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 40px rgba(201, 168, 76, 0.2);
}

.splash-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
}

.splash-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.splash-loader span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse 1.2s ease-in-out infinite;
}

.splash-loader span:nth-child(2) {
  animation-delay: 0.2s;
}

.splash-loader span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulse {
  0%,
  80%,
  100% {
    opacity: 0.2;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============ APP LAYOUT ============ */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  background: var(--bg-primary);
  box-shadow: var(--shadow);
}

.app.hidden {
  display: none;
}

/* ============ HEADER ============ */
.app-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.2rem;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.header-title {
  font-family: 'Amiri', serif;
  font-size: 1.7rem;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:active {
  transform: scale(0.92);
  background: var(--accent-glow);
  border-color: var(--gold-dim);
}

/* ============ PAGES ============ */
.pages-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.page {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 1rem;
  opacity: 0;
  transform: translateX(30px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  -webkit-overflow-scrolling: touch;
}

.lang-en .page {
  transform: translateX(-30px);
}

.page.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: all;
}

/* Custom scrollbar */
.page::-webkit-scrollbar,
.modal-sheet::-webkit-scrollbar {
  width: 4px;
}

.page::-webkit-scrollbar-track {
  background: transparent;
}

.page::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.page::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dim);
}

.page-title {
  font-family: 'Amiri', serif;
  font-size: 1.5rem;
  color: var(--gold);
  text-align: center;
  padding: 1.2rem 1rem 0.8rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.2rem;
  font-weight: 600;
}

/* ============ HOME PAGE ============ */
.home-top {
  background: var(--bg-secondary);
  padding: 1.4rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.greeting-text {
  font-family: 'Amiri', serif;
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.hijri-date {
  font-family: 'Amiri', serif;
  font-size: 1.05rem;
  color: var(--gold);
  margin-bottom: 0.2rem;
}

.greg-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Location bar */
.location-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.7rem 1.2rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.location-bar svg {
  flex-shrink: 0;
  color: var(--accent-light);
}

.location-bar span {
  flex: 1;
}

.refresh-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  border-radius: 50%;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.refresh-btn:active {
  color: var(--gold);
  background: var(--accent-glow);
  transform: rotate(90deg);
}

/* Next prayer card */
.next-prayer-card {
  margin: 1rem 1.2rem;
  background: var(--prayer-active-bg);
  border-radius: 24px;
  padding: 1.4rem 1rem;
  text-align: center;
  border: 1px solid rgba(201, 168, 76, 0.25);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.next-prayer-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='rgba(255,255,255,0.05)' stroke-width='1.5'%3E%3Ccircle cx='30' cy='30' r='22'/%3E%3Ccircle cx='30' cy='30' r='14'/%3E%3C/g%3E%3C/svg%3E") center/70px;
  pointer-events: none;
}

.next-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.next-prayer-name {
  font-family: 'Amiri', serif;
  font-size: 1.8rem;
  color: #fff;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.next-prayer-time {
  font-size: 2.6rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.next-countdown {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.1em;
  font-family: monospace;
}

/* Prayer list */
.prayer-list {
  padding: 0 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prayer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.2rem;
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  cursor: pointer;
}

.prayer-item.current {
  border-color: var(--gold-dim);
  background: var(--bg-card2);
  box-shadow: 0 0 0 1px var(--gold-dim) inset, var(--shadow-sm);
}

.prayer-item.passed {
  opacity: 0.5;
}

.prayer-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.prayer-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.2s;
}

.prayer-item.current .prayer-dot {
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.prayer-name {
  font-family: 'Amiri', serif;
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 500;
}

.prayer-item.current .prayer-name {
  color: var(--gold);
  font-weight: 600;
}

.prayer-time-display {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  font-family: monospace;
}

.prayer-item.current .prayer-time-display {
  color: var(--gold-light);
  font-size: 1.2rem;
}

/* Daily quote on home */
.daily-quote {
  margin: 1rem 1.2rem;
  padding: 1rem 1.2rem;
  background: var(--bg-card);
  border-radius: 16px;
  border-right: 4px solid var(--gold);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}

.lang-en .daily-quote {
  border-right: none;
  border-left: 4px solid var(--gold);
}

.quote-icon {
  font-family: 'Amiri', serif;
  font-size: 2rem;
  color: var(--gold-dim);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.quote-text {
  font-family: 'Amiri', serif;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.quote-source {
  font-size: 0.75rem;
  color: var(--gold-dim);
  margin-top: 0.6rem;
}

/* ============ QIBLA PAGE ============ */
.qibla-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem 1.5rem;
  gap: 1.2rem;
}

.compass-wrap {
  position: relative;
  width: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(var(--shadow-sm));
}

.compass-center-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  z-index: 10;
  box-shadow: 0 0 12px var(--gold);
  border: 2px solid var(--bg-card);
}

#compassCanvas {
  border-radius: 50%;
  display: block;
  box-shadow: var(--shadow-sm);
}

.qibla-info {
  text-align: center;
}

.qibla-angle-label,
.qibla-dist-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  letter-spacing: 0.05em;
}

.qibla-angle-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 0.8rem;
}

.qibla-dist-val {
  font-size: 1.2rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.qibla-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  min-height: 2rem;
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.85rem 2rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 60px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-primary:active {
  transform: scale(0.96);
  background: var(--accent-light);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ============ TASBIH PAGE (FIXED RING ALIGNMENT) ============ */
.tasbih-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem 1rem;
  gap: 0.75rem;
  min-height: 60vh;
}

/* Centered ring & button wrapper using relative container */
.tasbih-ring-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1rem 0;
  width: 100%;
  height: auto;
}

/* SVG ring perfectly centered around the button */
.tasbih-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 180px;
  height: 180px;
  pointer-events: none;
  z-index: 1;
}

.tasbih-btn {
  position: relative;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.15s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(2px);
}

/* Clean active effect - golden glow ring exactly around button */
.tasbih-btn:active {
  transform: scale(0.96);
  background: var(--accent-glow);
  border-color: var(--gold);
  box-shadow: 0 0 0 6px rgba(201, 168, 76, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tasbih-phrase {
  font-family: 'Amiri', serif;
  font-size: 1.7rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 0.2rem;
}

.tasbih-phrase-en {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: -0.2rem;
}

.tasbih-count-display {
  font-size: 4rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  transition: transform 0.1s ease;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tasbih-count-display.bump {
  transform: scale(1.12);
  color: var(--gold);
}

.tasbih-total-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: baseline;
}

#tasbihTarget {
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 1rem;
}

/* Phrase selector grid */
.tasbih-phrases-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  margin: 0.5rem 0;
}

.phrase-btn {
  padding: 0.7rem 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 40px;
  color: var(--text-secondary);
  font-family: 'Amiri', serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.phrase-btn.active {
  border-color: var(--gold);
  background: var(--bg-card2);
  color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-dim);
}

.phrase-btn:active {
  transform: scale(0.96);
}

/* Controls */
.tasbih-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.8rem 0 0.4rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.btn-ghost {
  padding: 0.55rem 1.4rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 40px;
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-ghost:active {
  background: var(--accent-glow);
  border-color: var(--accent);
  transform: scale(0.96);
}

.tasbih-sets {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: baseline;
  background: var(--bg-card);
  padding: 0.4rem 1rem;
  border-radius: 40px;
  border: 1px solid var(--border);
}

#tasbihSets {
  color: var(--gold);
  font-weight: 800;
  font-size: 1.1rem;
}

/* ============ QUOTES PAGE ============ */
.quotes-container {
  padding: 0 1rem;
}

.quote-card {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 2rem 1.5rem;
  border: 1px solid var(--border-strong);
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: opacity 0.3s ease;
  box-shadow: var(--shadow-card);
}

.quote-card.fading {
  opacity: 0;
}

.big-quote-mark {
  font-family: 'Amiri', serif;
  font-size: 3rem;
  color: var(--gold-dim);
  line-height: 1;
  margin-bottom: 1rem;
}

.big-quote-text {
  font-family: 'Amiri', serif;
  font-size: 1.2rem;
  color: var(--text-primary);
  line-height: 1.8;
  text-align: center;
  flex: 1;
}

.big-quote-source {
  font-size: 0.8rem;
  color: var(--gold);
  text-align: center;
  margin-top: 1.2rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}

.quote-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  margin-top: 1.2rem;
}

.quote-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.quote-nav-btn:active {
  background: var(--accent-glow);
  border-color: var(--accent);
  transform: scale(0.92);
}

.quote-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.quote-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.2s ease;
}

.quote-dot.active {
  background: var(--gold);
  width: 20px;
  border-radius: 6px;
}

/* ============ SETTINGS PANEL ============ */
.settings-list {
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-group {
  background: var(--bg-card);
  border-radius: 20px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.settings-group-label {
  padding: 0.7rem 1rem 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem;
  border-bottom: 1px solid var(--border);
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item-info {
  flex: 1;
}

.settings-item-label {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 3px;
  font-weight: 500;
}

.settings-item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.settings-badge {
  background: var(--accent-glow);
  color: var(--accent-light);
  font-size: 0.7rem;
  padding: 4px 12px;
  border-radius: 30px;
  border: 1px solid var(--accent);
  white-space: nowrap;
}

.settings-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.2s;
}

.settings-select:active {
  border-color: var(--gold);
}

.settings-select[type="text"] {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.settings-select[type="text"]::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

#adhanPreviewBtn,
#adhanPreviewBtnModal {
  flex-shrink: 0;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 40px;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
}

#adhanPreviewBtn:active,
#adhanPreviewBtnModal:active {
  background: var(--accent-glow);
  border-color: var(--gold);
  transform: scale(0.94);
}

#adhanPreviewBtn.playing,
#adhanPreviewBtnModal.playing {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-light);
  animation: pulse 1.2s ease-in-out infinite;
}

.settings-val {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-sm {
  padding: 6px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 40px;
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-sm:active {
  background: var(--accent-glow);
  transform: scale(0.94);
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 34px;
  cursor: pointer;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  left: 2px;
  top: 2px;
  transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  background: #fff;
  transform: translateX(22px);
}

/* ============ BOTTOM NAVIGATION ============ */
.bottom-nav {
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-nav);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-top: 6px;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.nav-btn::after {
  content: '';
  position: absolute;
  bottom: -4px;
  width: 28px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.nav-btn.active::after {
  transform: scaleX(1);
}

.nav-btn.active {
  color: var(--gold);
}

.nav-btn.active svg {
  stroke: var(--gold);
}

.nav-btn svg {
  transition: stroke 0.2s;
  width: 24px;
  height: 24px;
}

.nav-btn:active {
  transform: scale(0.94);
}

/* ============ MODAL SHEET ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-radius: 28px 28px 0 0;
  border-top: 1px solid var(--border-strong);
  padding-bottom: var(--safe-bottom);
  max-height: 85dvh;
  overflow-y: auto;
  animation: sheetUp 0.3s cubic-bezier(0.2, 0.9, 0.4, 1);
}

@keyframes sheetUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-handle {
  width: 48px;
  height: 5px;
  background: var(--border);
  border-radius: 4px;
  margin: 12px auto 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem 0.8rem;
  font-family: 'Amiri', serif;
  font-size: 1.25rem;
  color: var(--gold);
  border-bottom: 1px solid var(--border);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.modal-close:active {
  background: var(--accent-glow);
  transform: scale(0.9);
}

.modal-body {
  padding: 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ============ UTILITIES ============ */
.hidden {
  display: none !important;
}

/* ============ ENHANCED ANIMATIONS ============ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.prayer-item {
  animation: fadeInUp 0.3s ease forwards;
  opacity: 0;
}

.prayer-item:nth-child(1) {
  animation-delay: 0.05s;
}

.prayer-item:nth-child(2) {
  animation-delay: 0.1s;
}

.prayer-item:nth-child(3) {
  animation-delay: 0.15s;
}

.prayer-item:nth-child(4) {
  animation-delay: 0.2s;
}

.prayer-item:nth-child(5) {
  animation-delay: 0.25s;
}

.prayer-item:nth-child(6) {
  animation-delay: 0.3s;
}

.prayer-item:nth-child(7) {
  animation-delay: 0.35s;
}

/* Sunrise dashed style */
.prayer-item.sunrise {
  opacity: 0.6;
  background: transparent;
  border-style: dashed;
}

/* ============ RESPONSIVE TOUCH OPTIMIZATIONS ============ */
@media (hover: hover) {
  .icon-btn:hover,
  .nav-btn:hover,
  .phrase-btn:hover,
  .btn-primary:hover {
    filter: brightness(1.05);
  }
}

/* Ensure proper RTL handling for modals */
.lang-en .modal-sheet {
  direction: ltr;
}

.lang-ar .modal-sheet {
  direction: rtl;
}

/* Imsak / Iftar card (only visible in Ramadan) */
.ramadan-card {
  margin: 0.8rem 1.2rem;
  background: var(--bg-card2);
  border-radius: 16px;
  padding: 0.8rem;
  border-right: 4px solid var(--gold);
  text-align: center;
}
.ramadan-card.hidden { display: none; }

/* Travel mode indicator */
.travel-badge {
  background: #4a2a1a;
  color: #ffcc80;
  font-size: 0.7rem;
  border-radius: 20px;
  padding: 2px 10px;
  margin-left: 8px;
}

/* ============ EVENT‑SPECIFIC THEMES ============ */
/* Muharram (1-6, 8-9) - Dark & somber mourning */
body[data-theme-event="muharram"] {
  --bg-primary: #0a0808 !important;
  --bg-secondary: #111111 !important;
  --bg-card: #1a1414 !important;
  --bg-card2: #241c1c !important;
  --text-primary: #d4c5c5 !important;
  --text-secondary: #a09090 !important;
  --gold: #a67c52 !important;
  --accent: #7a3a2a !important;
  --accent-light: #9a4a3a !important;
  --border: rgba(120, 60, 40, 0.4) !important;
}
body[data-theme-event="muharram"] .next-prayer-card {
  background: linear-gradient(135deg, #2a1a1a, #1a0f0f);
}

/* Ashura (10 Muharram) - Deep Mourning Crimson */
body[data-theme-event="ashura"] {
  --bg-primary: #140303 !important;
  --bg-secondary: #210606 !important;
  --bg-card: #2d0a0a !important;
  --bg-card2: #3d0f0f !important;
  --bg-nav: #0d0202 !important;
  --text-primary: #f5e1e1 !important;
  --text-secondary: #c99696 !important;
  --text-muted: #946868 !important;
  --gold: #b32424 !important;
  --gold-light: #e63939 !important;
  --gold-dim: #661414 !important;
  --accent: #991f1f !important;
  --accent-light: #cc2929 !important;
  --accent-glow: rgba(230, 57, 57, 0.15) !important;
  --border: rgba(230, 57, 57, 0.2) !important;
  --border-strong: rgba(230, 57, 57, 0.4) !important;
  --prayer-active-bg: linear-gradient(135deg, #661414, #991f1f) !important;
  background-image: none !important;
}

/* Abbas (7 Muharram) - Dark red mourning */
body[data-theme-event="abbas"] {
  --bg-primary: #0c0a0a !important;
  --bg-secondary: #141010 !important;
  --bg-card: #1c1616 !important;
  --bg-card2: #261e1e !important;
  --bg-nav: #080505 !important;
  --text-primary: #d8c8c8 !important;
  --text-secondary: #a08080 !important;
  --text-muted: #6a5050 !important;
  --gold: #8a4040 !important;
  --gold-light: #a05050 !important;
  --gold-dim: #4a2020 !important;
  --accent: #5a2828 !important;
  --accent-light: #7a3838 !important;
  --accent-glow: rgba(138, 64, 64, 0.12) !important;
  --border: rgba(100, 50, 50, 0.35) !important;
  --border-strong: rgba(138, 64, 64, 0.5) !important;
  --prayer-active-bg: linear-gradient(135deg, #3a1818, #5a2828) !important;
  background-image: none !important;
}

/* Ramadan - Deep green & gold */
body[data-theme-event="ramadan"] {
  --bg-primary: #0a2a1a !important;
  --bg-secondary: #0e3522 !important;
  --bg-card: #14452d !important;
  --bg-card2: #1c5a3a !important;
  --text-primary: #f0f0e0 !important;
  --text-secondary: #c0e0c0 !important;
  --gold: #e8b84a !important;
  --accent: #3a9a6a !important;
  --accent-light: #4ab87a !important;
  --border: rgba(200, 180, 80, 0.3) !important;
}

/* Prophet's Birth - Light green & white */
body[data-theme-event="birth_prophet"] {
  --bg-primary: #e8f5e9 !important;
  --bg-secondary: #d4e8d4 !important;
  --bg-card: #ffffff !important;
  --bg-card2: #f0f8f0 !important;
  --text-primary: #1a3a2a !important;
  --text-secondary: #2a5a3a !important;
  --gold: #c9a84c !important;
  --accent: #4caf50 !important;
  --accent-light: #66bb6a !important;
  --border: rgba(76, 175, 80, 0.2) !important;
}

/* Prophet's Demise - Soft grey-blue */
body[data-theme-event="prophet_wafat"] {
  --bg-primary: #2a2e35 !important;
  --bg-secondary: #2f333b !important;
  --bg-card: #3a3f48 !important;
  --bg-card2: #454b55 !important;
  --text-primary: #e0e4e8 !important;
  --text-secondary: #b8bec8 !important;
  --gold: #a0a8b8 !important;
  --accent: #5a6a7a !important;
  --accent-light: #6a7a8a !important;
  --border: rgba(100, 110, 130, 0.4) !important;
}

/* Imam Ali's Birth - Emerald & gold */
body[data-theme-event="birth_ali"] {
  --bg-primary: #0a2e2a !important;
  --bg-secondary: #0f3f3a !important;
  --bg-card: #1a524a !important;
  --bg-card2: #256b60 !important;
  --text-primary: #f0f8f5 !important;
  --text-secondary: #c0e0d8 !important;
  --gold: #e8c46a !important;
  --accent: #2c967a !important;
  --accent-light: #3ab88a !important;
  --border: rgba(230, 200, 100, 0.3) !important;
}

/* Imam Ali's Martyrdom - Dark crimson */
body[data-theme-event="wafat_ali"] {
  --bg-primary: #2a0a0a !important;
  --bg-secondary: #2a1010 !important;
  --bg-card: #3a1818 !important;
  --bg-card2: #4a2020 !important;
  --text-primary: #e0c8c8 !important;
  --text-secondary: #c09090 !important;
  --gold: #c07040 !important;
  --accent: #9a3030 !important;
  --accent-light: #b84040 !important;
  --border: rgba(180, 70, 50, 0.5) !important;
}

/* Imam Hussain's Birth - Rich azure blue & silver */
body[data-theme-event="birth_hussain"] {
  --bg-primary: #eef4f9 !important;
  --bg-secondary: #dceaf5 !important;
  --bg-card: #ffffff !important;
  --bg-card2: #f2f8fd !important;
  --bg-nav: #c8dff0 !important;
  --text-primary: #0d2035 !important;
  --text-secondary: #1e4a72 !important;
  --text-muted: #4a7aa0 !important;
  --gold: #2e7bb5 !important;
  --gold-light: #4a9ad4 !important;
  --gold-dim: #b8d8f0 !important;
  --accent: #1a6a9e !important;
  --accent-light: #2880bc !important;
  --accent-glow: rgba(30, 106, 158, 0.1) !important;
  --border: rgba(30, 106, 158, 0.15) !important;
  --border-strong: rgba(74, 154, 212, 0.4) !important;
  --prayer-active-bg: linear-gradient(135deg, #1a6a9e, #2e7bb5) !important;
  background-image: linear-gradient(135deg, #eef4f9 0%, #ffffff 50%, #e0edf8 100%) !important;
}

/* Event banner styling */
.event-banner {
  text-align: center;
  padding: 10px;
  font-family: 'Amiri', serif;
  font-size: 1.2rem;
  font-weight: bold;
  border-bottom: 2px solid var(--gold);
  margin-top: 0;
  animation: fadeSlideDown 0.5s ease;
}
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* White Modern Marble Theme - Birth of Prophet & Imam Ali */
body[data-theme-event="birth_prophet"],
body[data-theme-event="birth_ali"] {
  --bg-primary: #f5f7f6 !important;
  --bg-secondary: #eef2f0 !important;
  --bg-card: #ffffff !important;
  --bg-card2: #f9fbf9 !important;
  --bg-nav: #e5eae7 !important;
  --text-primary: #1c3326 !important;
  --text-secondary: #3d664e !important;
  --text-muted: #708e7c !important;
  --gold: #b3923b !important;
  --gold-light: #c9a84c !important;
  --gold-dim: #ebdcb2 !important;
  --accent: #1e6b45 !important;
  --accent-light: #28a764 !important;
  --accent-glow: rgba(30, 107, 69, 0.1) !important;
  --border: rgba(0, 0, 0, 0.08) !important;
  --border-strong: rgba(179, 146, 59, 0.4) !important;
  --prayer-active-bg: linear-gradient(135deg, #1e6b45, #28a764) !important;
  background-image: linear-gradient(135deg, #f4f7f5 0%, #ffffff 50%, #eaeedd 100%) !important;
  background-attachment: fixed !important;
}
body[data-theme-event="birth_prophet"] #splash,
body[data-theme-event="birth_ali"] #splash {
  background: linear-gradient(135deg, #ffffff, #f0f4f2) !important;
  color: #1c3326 !important;
}
body[data-theme-event="birth_prophet"] .splash-title,
body[data-theme-event="birth_ali"] .splash-title {
  color: #b3923b !important;
  text-shadow: 0 2px 10px rgba(179, 146, 59, 0.2) !important;
}

/* Slate Mourning Theme - Imam Ali Wafat */
body[data-theme-event="wafat_ali"] {
  --bg-primary: #1c2022 !important;
  --bg-secondary: #252a2d !important;
  --bg-card: #2e3438 !important;
  --bg-card2: #383f44 !important;
  --bg-nav: #141719 !important;
  --text-primary: #e0e5e8 !important;
  --text-secondary: #90a4ae !important;
  --text-muted: #607d8b !important;
  --gold: #78909c !important;
  --gold-light: #b0bec5 !important;
  --gold-dim: #455a64 !important;
  --accent: #37474f !important;
  --accent-light: #455a64 !important;
  --accent-glow: rgba(120, 144, 156, 0.1) !important;
  --border: rgba(255, 255, 255, 0.05) !important;
  --border-strong: rgba(144, 164, 174, 0.3) !important;
  --prayer-active-bg: linear-gradient(135deg, #37474f, #455a64) !important;
  background-image: none !important;
}
body[data-theme-event="wafat_ali"] #splash {
  background: #1c2022 !important;
  color: #e0e5e8 !important;
}

/* Mint Green Celebration Layout - Eid al-Fitr */
body[data-theme-event="eid_fitr"] {
  --bg-primary: #e8f5e9 !important;
  --bg-secondary: #c8e6c9 !important;
  --bg-card: #ffffff !important;
  --bg-card2: #f1f8e9 !important;
  --bg-nav: #a5d6a7 !important;
  --text-primary: #1b5e20 !important;
  --text-secondary: #2e7d32 !important;
  --text-muted: #4caf50 !important;
  --gold: #fbc02d !important;
  --gold-light: #fff59d !important;
  --gold-dim: #f9a825 !important;
  --accent: #2e7d32 !important;
  --accent-light: #4caf50 !important;
  --border: rgba(46, 125, 50, 0.15) !important;
  --border-strong: rgba(251, 192, 45, 0.5) !important;
  --prayer-active-bg: linear-gradient(135deg, #2e7d32, #4caf50) !important;
}

/* Olive Gold Theme Layout - Eid al-Adha */
body[data-theme-event="eid_adha"] {
  --bg-primary: #f4f3ef !important;
  --bg-secondary: #e8e5d7 !important;
  --bg-card: #ffffff !important;
  --bg-card2: #fbfbfa !important;
  --bg-nav: #d1cebd !important;
  --text-primary: #3e3b2b !important;
  --text-secondary: #6b6649 !important;
  --text-muted: #8d8756 !important;
  --gold: #bfa15f !important;
  --gold-light: #dec48e !important;
  --gold-dim: #8c733e !important;
  --accent: #8d8756 !important;
  --accent-light: #aba36e !important;
  --border: rgba(141, 135, 86, 0.15) !important;
  --border-strong: rgba(191, 161, 95, 0.5) !important;
  --prayer-active-bg: linear-gradient(135deg, #8d8756, #bfa15f) !important;
}

/* Majestic Emerald and Gold Theme - Eid al-Ghadir */
body[data-theme-event="eid_ghadir"] {
  --bg-primary: #052416 !important;
  --bg-secondary: #0b3321 !important;
  --bg-card: #11422c !important;
  --bg-card2: #18543a !important;
  --bg-nav: #03170e !important;
  --text-primary: #f4f9f6 !important;
  --text-secondary: #99ccb2 !important;
  --text-muted: #66997f !important;
  --gold: #daa520 !important;
  --gold-light: #ffd700 !important;
  --gold-dim: #aa8018 !important;
  --accent: #1b8a5a !important;
  --accent-light: #2bc483 !important;
  --accent-glow: rgba(218, 165, 32, 0.15) !important;
  --border: rgba(218, 165, 32, 0.25) !important;
  --border-strong: rgba(218, 165, 32, 0.5) !important;
  --prayer-active-bg: linear-gradient(135deg, #1b8a5a, #daa520) !important;
}

/* Imam Hassan's Birth - Warm gold & marble white */
body[data-theme-event="birth_hassan"] {
  --bg-primary: #fdfcf8 !important;
  --bg-secondary: #f5f0e8 !important;
  --bg-card: #ffffff !important;
  --bg-card2: #faf7f0 !important;
  --bg-nav: #ede5d4 !important;
  --text-primary: #2a2010 !important;
  --text-secondary: #5a4820 !important;
  --text-muted: #9a8a60 !important;
  --gold: #b3923b !important;
  --gold-light: #d4aa50 !important;
  --gold-dim: #e8d8a0 !important;
  --accent: #7a6530 !important;
  --accent-light: #a08840 !important;
  --accent-glow: rgba(179, 146, 59, 0.12) !important;
  --border: rgba(179, 146, 59, 0.15) !important;
  --border-strong: rgba(179, 146, 59, 0.4) !important;
  --prayer-active-bg: linear-gradient(135deg, #7a6530, #b3923b) !important;
  background-image: linear-gradient(135deg, #fdfcf8 0%, #ffffff 50%, #f5f0e4 100%) !important;
}

/* Imam Hassan's Martyrdom (28 Safar) - Slate mourning */
body[data-theme-event="wafat_hassan"] {
  --bg-primary: #1c2022 !important;
  --bg-secondary: #252a2d !important;
  --bg-card: #2e3438 !important;
  --bg-card2: #383f44 !important;
  --bg-nav: #141719 !important;
  --text-primary: #e0e5e8 !important;
  --text-secondary: #90a4ae !important;
  --text-muted: #607d8b !important;
  --gold: #78909c !important;
  --gold-light: #b0bec5 !important;
  --gold-dim: #455a64 !important;
  --accent: #37474f !important;
  --accent-light: #455a64 !important;
  --accent-glow: rgba(120, 144, 156, 0.1) !important;
  --border: rgba(255, 255, 255, 0.05) !important;
  --border-strong: rgba(144, 164, 174, 0.3) !important;
  --prayer-active-bg: linear-gradient(135deg, #37474f, #455a64) !important;
  background-image: none !important;
}
body[data-theme-event="wafat_hassan"] #splash {
  background: #1c2022 !important;
  color: #e0e5e8 !important;
}

/* Fixed positioning for the Ashura gregorian player (uses custom-media-widget) */
#ashura-gregorian-player.custom-media-widget {
  position: fixed !important;
  bottom: 90px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 320px !important;
  right: auto !important;
}
#ashura-gregorian-player.custom-media-widget.minimized {
  left: auto !important;
  right: 20px !important;
  bottom: 90px !important;
  transform: none !important;
}
.custom-media-widget {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 99999;
  width: 350px;
  padding: 16px;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  direction: rtl;
  font-family: 'Cairo', sans-serif;
  border: 1px solid var(--border-strong);
}
.custom-media-widget.ghadir-theme {
  background: linear-gradient(135deg, #0b3321, #11422c);
  color: #f4f9f6;
}
.custom-media-widget.ashura-theme {
  background: linear-gradient(135deg, #210606, #2d0a0a);
  color: #f5e1e1;
  border-color: rgba(230, 57, 57, 0.5);
  box-shadow: 0 12px 40px rgba(230, 57, 57, 0.15);
}
.custom-media-widget.minimized {
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  bottom: 25px;
  right: 25px;
  cursor: pointer;
}
.custom-media-widget.minimized .widget-content {
  display: none;
}
.custom-media-widget .widget-toggle-icon {
  display: none;
  font-size: 24px;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}
.custom-media-widget.minimized .widget-toggle-icon {
  display: flex;
}
.custom-media-widget .widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
}
.custom-media-widget .widget-title {
  font-size: 14px;
  font-weight: 700;
}
.custom-media-widget .widget-minimize-btn {
  background: none;
  border: none;
  color: inherit;
  font-size: 22px;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}
.custom-media-widget .widget-track {
  font-size: 13px;
  margin-bottom: 12px;
  opacity: 0.95;
  font-weight: 600;
}
.custom-media-widget .widget-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.custom-media-widget .widget-play-btn {
  background: var(--gold);
  color: #0d1f16;
  border: none;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.2s;
}
.custom-media-widget.ashura-theme .widget-play-btn {
  background: #b32424;
  color: #ffffff;
}
.custom-media-widget .widget-progress-bar {
  flex-grow: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}
.custom-media-widget .widget-progress-fill {
  height: 100%;
  background: var(--gold-light);
  width: 0%;
  border-radius: 3px;
}
.custom-media-widget.ashura-theme .widget-progress-fill {
  background: #e63939;
}

/* ==========================================================================
   NEW ADDITIONS — Qadha, Abbas Theme, Notifications, Cache, Country/City
   ========================================================================== */

/* ============ QADHA AL-SALAH ============ */
.qadha-container {
  padding: 0.5rem 1rem 1.5rem;
  max-width: 500px;
  margin: 0 auto;
}

.qadha-start-screen {
  text-align: center;
  padding: 3rem 1rem;
  animation: fadeInUp 0.6s ease;
}

.qadha-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.qadha-start-title {
  font-family: 'Amiri', serif;
  font-size: 1.8rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.qadha-start-desc {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.qadha-start-btn {
  margin: 0 auto;
  min-width: 200px;
  justify-content: center;
}

.qadha-main-screen {
  animation: fadeInUp 0.5s ease;
}

.qadha-summary-card {
  background: linear-gradient(135deg, var(--bg-card2), var(--bg-card));
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.qadha-summary-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, var(--accent-glow), transparent 70%);
  pointer-events: none;
}

.qadha-summary-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.qadha-summary-count {
  font-size: 4rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
  transition: transform 0.3s ease;
}

.qadha-summary-count.pulse {
  animation: qadhaPulse 0.5s ease;
}

@keyframes qadhaPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.qadha-summary-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.qadha-prayers-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 1.5rem;
}

.qadha-prayer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
  animation: fadeInUp 0.4s ease forwards;
  opacity: 0;
  position: relative;
  overflow: hidden;
}

.qadha-prayer-card:nth-child(1) { animation-delay: 0.05s; }
.qadha-prayer-card:nth-child(2) { animation-delay: 0.1s; }
.qadha-prayer-card:nth-child(3) { animation-delay: 0.15s; }
.qadha-prayer-card:nth-child(4) { animation-delay: 0.2s; }
.qadha-prayer-card:nth-child(5) { animation-delay: 0.25s; }

.qadha-prayer-card::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gold);
  opacity: 0.6;
  border-radius: 20px 0 0 20px;
}

.qadha-prayer-card:active {
  transform: scale(0.98);
  border-color: var(--gold-dim);
}

.qadha-prayer-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qadha-prayer-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.qadha-prayer-name {
  font-family: 'Amiri', serif;
  font-size: 1.25rem;
  color: var(--text-primary);
  font-weight: 600;
}

.qadha-prayer-count {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--gold);
  min-width: 50px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.qadha-prayer-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qadha-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  line-height: 1;
}

.qadha-btn:active {
  transform: scale(0.88);
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.qadha-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.qadha-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============ MUHARRAM BANNER ============ */
.muharram-banner {
  background: var(--bg-card);
  border-bottom: 2px solid var(--gold-dim);
  text-align: center;
  padding: 10px 12px;
  font-family: 'Amiri', serif;
  font-size: 1.1rem;
  color: var(--text-secondary);
  animation: fadeSlideDown 0.5s ease;
  line-height: 1.6;
}

/* ============ ABBAS MEDIA PLAYER ============ */
.custom-media-widget.abbas-theme {
  background: linear-gradient(135deg, #141010, #1c1616);
  color: #d8c8c8;
  border-color: rgba(138, 64, 64, 0.5);
  box-shadow: 0 12px 40px rgba(12, 10, 10, 0.5);
}

.custom-media-widget.abbas-theme .widget-play-btn {
  background: #8a4040;
  color: #ffffff;
}

.custom-media-widget.abbas-theme .widget-progress-fill {
  background: #a05050;
}

/* ============ NOTIFICATION TOGGLES IN SETTINGS ============ */
.settings-item .toggle {
  margin-left: 8px;
}

.lang-en .settings-item .toggle {
  margin-left: 0;
  margin-right: 8px;
}

/* ============ CACHE STATUS ============ */
#cacheStatusText,
#cacheStatusText2 {
  transition: color 0.3s ease;
}

/* ============ IOS NOTIFICATION NOTE ============ */
#iosNotifNote,
#iosNotifNote2 {
  background: var(--accent-glow);
  border-radius: 12px;
  padding: 8px 12px;
  margin-top: 4px;
}

/* ============ COUNTRY/CITY SELECTS ============ */
#countrySelect,
#countrySelectModal,
#qiblaCountrySelect {
  margin-bottom: 0;
}

#citySelect,
#citySelectModal,
#qiblaCitySelect {
  margin-top: 0;
}

/* ============ QIBLA PRESET ROW ============ */
.qibla-preset-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-bottom: 1rem;
}

.qibla-preset-row.hidden {
  display: none !important;
}

/* ============ COMPASS SMOOTHING (visual hint) ============ */
.compass-wrap {
  transition: transform 0.3s ease;
}

/* ============ RESPONSIVE QADHA ============ */
@media (max-width: 360px) {
  .qadha-prayer-card {
    padding: 1rem;
  }
  .qadha-prayer-icon {
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
  }
  .qadha-prayer-name {
    font-size: 1.05rem;
  }
  .qadha-prayer-count {
    font-size: 1.8rem;
  }
  .qadha-btn {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
  }
}

/* ============ COMPASS PERMISSION MODAL ============ */
.compass-perm-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}

.compass-perm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.compass-perm-sheet {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border-radius: 24px;
  padding: 2rem 1.5rem;
  max-width: 320px;
  width: 90%;
  border: 1px solid var(--border);
  text-align: center;
  animation: scaleUp 0.3s cubic-bezier(0.2, 0.9, 0.4, 1);
  direction: rtl;
}

.lang-en .compass-perm-sheet {
  direction: ltr;
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.compass-perm-icon {
  font-size: 3rem;
  margin-bottom: 0.8rem;
}

.compass-perm-title {
  font-family: 'Amiri', serif;
  font-size: 1.3rem;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.compass-perm-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.compass-perm-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.compass-perm-deny,
.compass-perm-allow {
  padding: 0.6rem 1.4rem;
  border-radius: 40px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  border: none;
}

.compass-perm-deny {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.compass-perm-deny:active {
  background: var(--accent-glow);
  transform: scale(0.94);
}

.compass-perm-allow {
  background: var(--accent);
  color: #fff;
}

.compass-perm-allow:active {
  background: var(--accent-light);
  transform: scale(0.94);
}

/* ============ CACHE TOAST NOTIFICATION ============ */
.cache-toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.8rem 1.2rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-primary);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  max-width: 90%;
  width: max-content;
}

.cache-toast.success {
  border-color: rgba(0, 210, 106, 0.4);
}

.cache-toast.error {
  border-color: rgba(230, 57, 57, 0.4);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}


/* ============ CACHE BUTTON LOADING SPINNER ============ */
.btn-sm.loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
  color: transparent !important;
}

.btn-sm.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  margin-left: -7px;
  border: 2px solid var(--text-muted);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============ NEW FEATURES CSS ============ */

/* --- Dhikr Page --- */
.dhikr-container {
  padding: 0 1rem 1.5rem;
}
.dhikr-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}
.dhikr-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dhikr-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  transition: transform 0.2s ease;
}
.dhikr-card:active {
  transform: scale(0.98);
}
.dhikr-card-text {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 0.5rem;
  word-break: break-word;
}
.dhikr-card-link {
  font-size: 0.8rem;
  color: var(--accent-light);
  text-decoration: none;
  display: block;
  margin-bottom: 0.6rem;
  word-break: break-all;
}
.dhikr-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}
.dhikr-delete-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s;
}
.dhikr-delete-btn:active {
  background: var(--accent-glow);
}
.dhikr-toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-radius: 16px;
  padding: 0.8rem 1.2rem;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  color: var(--text-primary);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  max-width: 90%;
  width: max-content;
}

/* --- Hijri Offset Controls --- */
.hijri-offset-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
  padding: 4px 0;
}
.hijri-offset-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 80px;
  text-align: center;
  font-family: monospace;
}

/* --- Tasbih Analytics --- */
.tasbih-analytics {
  width: 100%;
  margin-top: 0.5rem;
}
.tasbih-analytics-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  margin-top: 0.5rem;
  animation: fadeInUp 0.3s ease;
}
.tasbih-analytics-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1rem 0;
}
.tasbih-chart-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}
#tasbihChartCanvas {
  width: 100%;
  max-width: 320px;
  height: auto;
}

/* --- Muharram Interactive Timeline --- */
.muharram-timeline {
  margin: 0.8rem 1.2rem;
  animation: fadeSlideDown 0.5s ease;
}
.muharram-timeline.hidden {
  display: none !important;
}
.muharram-timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.muharram-timeline-bg {
  background: var(--bg-secondary);
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
}
.muharram-timeline-inner {
  padding: 1rem 1.2rem;
}
.muharram-bg-title {
  font-family: 'Amiri', serif;
  font-size: 1.15rem;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 0.6rem;
  text-align: center;
}
.muharram-bg-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.6rem;
  text-align: justify;
}
.muharram-timeline-header {
  font-family: 'Amiri', serif;
  font-size: 1.1rem;
  color: var(--gold);
  text-align: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.muharram-timeline-days {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0.8rem 1rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.muharram-day-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-family: 'Amiri', serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.muharram-day-dot.active {
  background: var(--gold);
  color: #111;
  border-color: var(--gold);
  box-shadow: 0 0 10px var(--gold-dim);
  transform: scale(1.1);
}
.muharram-day-dot:active {
  transform: scale(0.94);
}
.muharram-timeline-story {
  padding: 1rem 1.2rem;
  max-height: 280px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.muharram-story-ar,
.muharram-story-en {
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text-secondary);
  text-align: justify;
  margin-bottom: 0.5rem;
}

/* Muharram theme adjustments for timeline */
body[data-theme-event="muharram"] .muharram-timeline-card {
  border-color: rgba(166, 124, 82, 0.4);
}
body[data-theme-event="muharram"] .muharram-day-dot.active {
  background: var(--gold);
  color: #1a1414;
}
body[data-theme-event="ashura"] .muharram-timeline-card {
  border-color: rgba(230, 57, 57, 0.4);
}
body[data-theme-event="ashura"] .muharram-day-dot.active {
  background: var(--gold-light);
  color: #2d0a0a;
}


/* ============ SAVED DHIKR PAGE ============ */
.dhikr-container {
  padding: 0.5rem 1rem 1.5rem;
}

.dhikr-empty {
  text-align: center;
  padding: 3rem 1rem;
  animation: fadeInUp 0.6s ease;
}

.dhikr-empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

.dhikr-empty-title {
  font-family: 'Amiri', serif;
  font-size: 1.4rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.dhikr-empty-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 280px;
  margin: 0 auto;
}

.dhikr-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dhikr-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  position: relative;
  transition: all 0.2s ease;
  animation: fadeInUp 0.4s ease forwards;
}

.dhikr-card:active {
  transform: scale(0.98);
  border-color: var(--gold-dim);
}

.dhikr-card-text {
  font-family: 'Amiri', serif;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.7;
  margin-bottom: 0.5rem;
  word-break: break-word;
}

.dhikr-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dhikr-card-url {
  color: var(--accent-light);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.dhikr-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.dhikr-delete-btn:active {
  background: rgba(230, 57, 57, 0.15);
  color: #e63939;
}

/* ============ HIJRI OFFSET ROW ============ */
.hijri-offset-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ============ TASBIH ANALYTICS ============ */
.tasbih-analytics {
  margin-top: 1rem;
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  background: var(--bg-card);
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.analytics-header:active {
  background: var(--bg-card2);
}

.analytics-chevron {
  transition: transform 0.3s ease;
  color: var(--text-muted);
}

.analytics-header.open .analytics-chevron {
  transform: rotate(180deg);
}

.analytics-body {
  padding: 1rem 0.5rem 0.5rem;
  animation: fadeInUp 0.3s ease;
}

.analytics-body.hidden {
  display: none;
}

.analytics-canvas-wrap {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 0.8rem;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.analytics-canvas-wrap canvas {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
}

.analytics-legend {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 0.8rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

/* ============ MUHARRAM TIMELINE ============ */
.muharram-timeline {
  margin: 1rem 1.2rem;
  background: var(--bg-card);
  border-radius: 20px;
  border: 1px solid var(--border);
  overflow: hidden;
  animation: fadeInUp 0.5s ease;
}

.muharram-timeline.hidden {
  display: none !important;
}

.timeline-header {
  font-family: 'Amiri', serif;
  font-size: 1.15rem;
  color: var(--gold);
  text-align: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.timeline-backstory {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(166, 124, 82, 0.05);
}

.timeline-backstory-title {
  font-family: 'Amiri', serif;
  font-size: 1.05rem;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.timeline-backstory-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.timeline-days {
  padding: 1rem 0.8rem;
}

.timeline-day {
  display: flex;
  gap: 12px;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.timeline-day:last-child {
  border-bottom: none;
}

.timeline-day:active {
  background: var(--accent-glow);
  border-radius: 12px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.timeline-day.active .timeline-dot {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg-primary);
  box-shadow: 0 0 10px rgba(201, 168, 76, 0.3);
}

.timeline-content {
  flex: 1;
}

.timeline-day-title {
  font-family: 'Amiri', serif;
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.timeline-day.active .timeline-day-title {
  color: var(--gold);
}

.timeline-day-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-height: 2.4em;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.timeline-day.expanded .timeline-day-desc {
  max-height: 400px;
}

.timeline-day-full {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  display: none;
}

.timeline-day.expanded .timeline-day-full {
  display: block;
  animation: fadeInUp 0.3s ease;
}

.timeline-expand-icon {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  transition: transform 0.2s;
}

.timeline-day.expanded .timeline-expand-icon {
  transform: rotate(180deg);
}

/* ============================ SAVED ITEMS PAGE ============================ */

.saved-items-tabs {
  display: flex;
  gap: 8px;
  padding: 0 1rem;
  margin-bottom: 0.8rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.saved-items-tabs::-webkit-scrollbar {
  display: none;
}

.saved-tab {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.saved-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.saved-tab:active {
  transform: scale(0.96);
}

.saved-items-list {
  padding: 0 1rem 6rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.saved-items-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.saved-items-empty.hidden {
  display: none !important;
}
.saved-items-empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}
.saved-items-empty-title {
  font-family: 'Amiri', serif;
  font-size: 1.4rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.saved-items-empty-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 280px;
  margin: 0 auto;
}

/* Item Card */
.saved-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  animation: fadeInUp 0.4s ease;
}

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

.saved-item-category {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.saved-item-source {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.saved-item-text-ar {
  font-family: 'Amiri', serif;
  font-size: 1.15rem;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
  text-align: right;
  direction: rtl;
  white-space: pre-line;
}

.saved-item-text-en {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
  white-space: pre-line;
}

.saved-item-actions {
  display: flex;
  gap: 8px;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.saved-item-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.saved-item-btn:active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.saved-item-btn svg {
  width: 16px;
  height: 16px;
}

/* Floating Add Button */
.fab-add {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: transform 0.2s, box-shadow 0.2s;
}
.fab-add:active {
  transform: scale(0.92);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Add Item Modal */
.add-item-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.add-item-modal.hidden {
  display: none !important;
}

.add-item-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.add-item-sheet {
  position: relative;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.2rem;
  animation: slideUp 0.3s ease;
}

.add-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-family: 'Amiri', serif;
  font-size: 1.2rem;
  color: var(--gold);
}

.add-item-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.add-item-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-row label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.form-row textarea,
.form-row input,
.form-row select {
  padding: 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  outline: none;
}
.form-row textarea:focus,
.form-row input:focus,
.form-row select:focus {
  border-color: var(--accent);
}

/* Share Sheet */
.share-sheet {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.share-sheet.hidden {
  display: none !important;
}

.share-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.share-sheet-panel {
  position: relative;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  width: 100%;
  padding: 1.2rem;
  animation: slideUp 0.3s ease;
}

.share-sheet-title {
  text-align: center;
  font-family: 'Amiri', serif;
  font-size: 1.2rem;
  color: var(--gold);
  margin-bottom: 1rem;
}

.share-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 1rem;
}

.share-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.share-option:active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.share-icon {
  font-size: 1.8rem;
}

.share-cancel {
  width: 100%;
  padding: 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
}

/* Toast */
.saved-item-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-radius: 16px;
  padding: 0.8rem 1.2rem;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  color: var(--text-primary);
  animation: fadeInUp 0.3s ease;
  max-width: 90%;
  width: max-content;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
