/* ==========================================================
   RAMADAN TIMES — Main Stylesheet
   Dynamic theming, mobile-first, accessibility-ready
   ========================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', 'Poppins', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  background: var(--bg-gradient);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 1s ease, color 0.4s ease;
}

a { color: var(--accent-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }

/* ── CSS Custom Properties — Default (Night) Theme ──── */
:root {
  --bg-gradient:          linear-gradient(160deg, #0d1b3e 0%, #162248 55%, #0d1535 100%);
  --bg-solid:             #0d1b3e;
  --card-bg:              rgba(22, 34, 72, 0.72);
  --card-bg-solid:        #162248;
  --card-border:          rgba(168, 180, 224, 0.18);
  --nav-bg:               rgba(10, 20, 50, 0.92);
  --accent-primary:       #7b8ed4;
  --accent-secondary:     #a8b4e0;
  --accent-glow:          rgba(123, 142, 212, 0.35);
  --text-primary:         #e0e6f8;
  --text-secondary:       #8898c8;
  --text-muted:           #4a5880;
  --border-color:         rgba(140, 160, 220, 0.16);
  --highlight-bg:         rgba(123, 142, 212, 0.12);
  --prayer-active-bg:     rgba(123, 142, 212, 0.22);
  --prayer-active-border: #7b8ed4;
  --countdown-color:      #a8b4e0;
  --moon-color:           #b8c4e8;
  --suhoor-accent:        #6fc8e4;
  --iftar-accent:         #f0a060;
  --today-highlight:      rgba(123, 142, 212, 0.28);
  --shadow-sm:            0 2px 12px rgba(0, 0, 0, 0.25);
  --shadow-md:            0 6px 28px rgba(0, 0, 0, 0.35);
  --shadow-lg:            0 12px 48px rgba(0, 0, 0, 0.45);
  --radius-sm:            8px;
  --radius-md:            16px;
  --radius-lg:            24px;
  --radius-xl:            32px;
  --transition-fast:      0.18s ease;
  --transition:           0.3s ease;
  --transition-slow:      0.6s ease;
  --footer-bg:            rgba(8, 14, 38, 0.9);
}

/* ── Theme: Pre-Fajr / Suhoor (midnight → Fajr) ────── */
[data-theme="pre-fajr"] {
  --bg-gradient:          linear-gradient(160deg, #06101e 0%, #091830 55%, #071420 100%);
  --bg-solid:             #06101e;
  --card-bg:              rgba(8, 20, 42, 0.8);
  --card-bg-solid:        #091830;
  --card-border:          rgba(78, 210, 200, 0.22);
  --nav-bg:               rgba(6, 10, 20, 0.95);
  --accent-primary:       #3ec9c0;
  --accent-secondary:     #5be0d8;
  --accent-glow:          rgba(62, 201, 192, 0.4);
  --text-primary:         #d8f4f2;
  --text-secondary:       #7ac8c4;
  --text-muted:           #3d7876;
  --border-color:         rgba(62, 201, 192, 0.15);
  --highlight-bg:         rgba(62, 201, 192, 0.1);
  --prayer-active-bg:     rgba(62, 201, 192, 0.2);
  --prayer-active-border: #3ec9c0;
  --countdown-color:      #5be0d8;
  --moon-color:           #9ef0eb;
  --today-highlight:      rgba(62, 201, 192, 0.25);
  --footer-bg:            rgba(4, 8, 18, 0.95);
}

/* ── Theme: Fajr (dawn light) ────────────────────────── */
[data-theme="fajr"] {
  --bg-gradient:          linear-gradient(160deg, #12204a 0%, #1e3060 55%, #162240 100%);
  --bg-solid:             #12204a;
  --card-bg:              rgba(20, 36, 80, 0.78);
  --card-bg-solid:        #1e3060;
  --card-border:          rgba(110, 168, 230, 0.24);
  --nav-bg:               rgba(10, 18, 48, 0.95);
  --accent-primary:       #5a9de8;
  --accent-secondary:     #7ab8f8;
  --accent-glow:          rgba(90, 157, 232, 0.38);
  --text-primary:         #d8ecf8;
  --text-secondary:       #7aaed8;
  --text-muted:           #3a6888;
  --border-color:         rgba(90, 157, 232, 0.2);
  --highlight-bg:         rgba(90, 157, 232, 0.1);
  --prayer-active-bg:     rgba(90, 157, 232, 0.22);
  --prayer-active-border: #5a9de8;
  --countdown-color:      #7ab8f8;
  --moon-color:           #a0c8f0;
  --today-highlight:      rgba(90, 157, 232, 0.25);
  --footer-bg:            rgba(8, 14, 40, 0.95);
}

/* ── Theme: Day (sunrise → late afternoon) ─────────── */
[data-theme="day"] {
  --bg-gradient:          linear-gradient(160deg, #f5efe0 0%, #fef8ed 55%, #f8f0d8 100%);
  --bg-solid:             #fef8ed;
  --card-bg:              rgba(255, 252, 242, 0.92);
  --card-bg-solid:        #fffcf2;
  --card-border:          rgba(200, 140, 20, 0.22);
  --nav-bg:               rgba(248, 242, 224, 0.95);
  --accent-primary:       #b06010;
  --accent-secondary:     #d07820;
  --accent-glow:          rgba(176, 96, 16, 0.3);
  --text-primary:         #2c3a48;
  --text-secondary:       #5a7080;
  --text-muted:           #9aadb8;
  --border-color:         rgba(176, 96, 16, 0.18);
  --highlight-bg:         rgba(176, 96, 16, 0.07);
  --prayer-active-bg:     rgba(176, 96, 16, 0.12);
  --prayer-active-border: #b06010;
  --countdown-color:      #b06010;
  --moon-color:           #b06010;
  --suhoor-accent:        #5a7080;
  --iftar-accent:         #b06010;
  --today-highlight:      rgba(176, 96, 16, 0.18);
  --shadow-sm:            0 2px 12px rgba(0, 0, 0, 0.1);
  --shadow-md:            0 6px 28px rgba(0, 0, 0, 0.14);
  --footer-bg:            rgba(230, 220, 200, 0.95);
}

/* ── Theme: Golden Hour (90 min before Maghrib) ─────── */
[data-theme="golden"] {
  --bg-gradient:          linear-gradient(160deg, #180c38 0%, #2c1a4e 40%, #481a18 80%, #280a10 100%);
  --bg-solid:             #180c38;
  --card-bg:              rgba(44, 26, 78, 0.8);
  --card-bg-solid:        #2c1a4e;
  --card-border:          rgba(240, 160, 0, 0.3);
  --nav-bg:               rgba(14, 8, 30, 0.96);
  --accent-primary:       #f0a000;
  --accent-secondary:     #ff8c40;
  --accent-glow:          rgba(240, 160, 0, 0.45);
  --text-primary:         #feecd8;
  --text-secondary:       #d4a878;
  --text-muted:           #806848;
  --border-color:         rgba(240, 160, 0, 0.22);
  --highlight-bg:         rgba(240, 160, 0, 0.12);
  --prayer-active-bg:     rgba(240, 160, 0, 0.22);
  --prayer-active-border: #f0a000;
  --countdown-color:      #ffcc60;
  --moon-color:           #f0a000;
  --today-highlight:      rgba(240, 160, 0, 0.3);
  --footer-bg:            rgba(10, 6, 22, 0.97);
}

/* ── Theme: Evening (Maghrib → Isha) ────────────────── */
[data-theme="evening"] {
  --bg-gradient:          linear-gradient(160deg, #1a0830 0%, #2a1048 55%, #1e0a28 100%);
  --bg-solid:             #1a0830;
  --card-bg:              rgba(30, 12, 52, 0.8);
  --card-bg-solid:        #2a1048;
  --card-border:          rgba(200, 130, 220, 0.22);
  --nav-bg:               rgba(14, 6, 26, 0.96);
  --accent-primary:       #c070e8;
  --accent-secondary:     #9050c0;
  --accent-glow:          rgba(192, 112, 232, 0.38);
  --text-primary:         #f0e8f8;
  --text-secondary:       #b890d0;
  --text-muted:           #6a4880;
  --border-color:         rgba(192, 112, 232, 0.18);
  --highlight-bg:         rgba(192, 112, 232, 0.1);
  --prayer-active-bg:     rgba(192, 112, 232, 0.2);
  --prayer-active-border: #c070e8;
  --countdown-color:      #d890f8;
  --moon-color:           #d890f8;
  --today-highlight:      rgba(192, 112, 232, 0.28);
  --footer-bg:            rgba(10, 4, 20, 0.97);
}

/* ── Layout Utilities ────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Navbar ──────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-slow), border-color var(--transition-slow);
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
  flex-shrink: 0;
}

.nav-moon {
  font-size: 1.4rem;
  line-height: 1;
  color: var(--moon-color);
  transition: color var(--transition-slow);
}

.nav-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.nav-location-btn {
  flex: 1;
  max-width: 380px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--highlight-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  overflow: hidden;
}

.nav-location-btn:hover {
  background: var(--prayer-active-bg);
  color: var(--text-primary);
}

.icon-pin { width: 14px; height: 14px; flex-shrink: 0; color: var(--accent-primary); }
.icon-chevron { width: 14px; height: 14px; flex-shrink: 0; margin-left: auto; }

#locationDisplay {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.btn-icon:hover { background: var(--highlight-bg); color: var(--text-primary); }
.btn-icon svg { width: 18px; height: 18px; }

/* ── Modals ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay[hidden] { display: none; }

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

.modal-panel {
  background: var(--card-bg-solid);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0.5; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}

.modal-close-btn:hover { background: var(--highlight-bg); color: var(--text-primary); }
.modal-close-btn svg { width: 16px; height: 16px; }

.modal-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 16px; }

/* Location modal */

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 11px 12px 11px 38px;
  background: var(--highlight-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent-primary); background: var(--prayer-active-bg); }

.search-results { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; }

.search-result-item {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: background var(--transition), color var(--transition);
  border: 1px solid transparent;
}

.search-result-item:hover {
  background: var(--prayer-active-bg);
  border-color: var(--card-border);
  color: var(--text-primary);
}

.search-result-item strong { color: var(--text-primary); display: block; margin-bottom: 2px; }

.search-error {
  color: #f06060;
  font-size: 0.85rem;
  padding: 8px 12px;
  background: rgba(240, 96, 96, 0.1);
  border-radius: var(--radius-sm);
}

/* Settings modal */
.setting-group { display: flex; flex-direction: column; gap: 8px; }

.setting-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.setting-select {
  padding: 10px 12px;
  background: var(--highlight-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.setting-select:focus { border-color: var(--accent-primary); }

.radio-group { display: flex; flex-direction: column; gap: 8px; }

.radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.radio-label:hover { background: var(--highlight-bg); color: var(--text-primary); }
.radio-label input { accent-color: var(--accent-primary); }

.toggle-group {
  display: flex;
  background: var(--highlight-bg);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.toggle-btn {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.toggle-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-save {
  padding: 12px;
  background: var(--accent-primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  border: none;
  margin-top: 4px;
}

.btn-save:hover { opacity: 0.88; transform: translateY(-1px); }

/* ── Hero Section ────────────────────────────────────── */
.hero-section {
  padding: 40px 20px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.5;
}

/* Last 10 banner */
.last10-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: linear-gradient(90deg, rgba(240, 160, 0, 0.2), rgba(255, 200, 60, 0.15));
  border: 1px solid rgba(240, 160, 0, 0.4);
  border-radius: var(--radius-xl);
  color: #f0c040;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 20px;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; box-shadow: 0 0 20px rgba(240, 160, 0, 0.3); }
}

/* Ramadan badge */
.ramadan-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  background: var(--highlight-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 20px;
}

.badge-crescent { color: var(--moon-color); font-size: 1rem; }

/* Date display */
.date-block { margin-bottom: 8px; }

.date-gregorian {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.date-hijri {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Live clock */
.live-clock {
  font-family: 'Poppins', monospace;
  font-size: clamp(3rem, 10vw, 5.5rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 16px 0 24px;
  transition: color var(--transition-slow);
}

/* Countdown */
.countdown-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.countdown-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--countdown-color);
  opacity: 0.9;
}

.countdown-timer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 8px 8px;
  backdrop-filter: blur(10px);
}

.time-val {
  font-family: 'Poppins', monospace;
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  font-weight: 700;
  color: var(--countdown-color);
  line-height: 1;
  letter-spacing: -0.04em;
  transition: color var(--transition-slow);
}

.time-unit {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: 4px;
}

.time-colon {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--countdown-color);
  opacity: 0.6;
  line-height: 1;
  margin-bottom: 16px;
  animation: blink 1s step-start infinite;
}

@keyframes blink { 50% { opacity: 0.2; } }

/* Suhoor / Iftar bar */
.key-times-bar {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(10px);
  max-width: 480px;
  width: 100%;
}

.key-time {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  transition: background var(--transition);
}

.key-time:hover { background: var(--highlight-bg); }

.key-time-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  line-height: 1;
}

.key-time-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.key-time-value {
  font-family: 'Poppins', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

#suhoorCard .key-time-value { color: var(--suhoor-accent); }
#iftarCard  .key-time-value { color: var(--iftar-accent); }

.key-time-divider {
  width: 1px;
  background: var(--border-color);
  flex-shrink: 0;
}

/* ── Prayer Times Section ────────────────────────────── */
.prayer-section { padding: 20px 0 32px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.section-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.day-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn svg { width: 14px; height: 14px; }

.btn-ghost {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--highlight-bg);
  border-color: var(--card-border);
  color: var(--text-primary);
}

.btn-today {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.btn-today:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-retry {
  background: var(--highlight-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
}

.btn-retry:hover { background: var(--prayer-active-bg); }

/* Prayer grid */
.prayer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

/* Prayer card */
.prayer-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  backdrop-filter: blur(10px);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
  cursor: default;
}

.prayer-card::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background var(--transition-slow);
}

.prayer-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.prayer-card.active {
  background: var(--prayer-active-bg);
  border-color: var(--prayer-active-border);
  box-shadow: 0 0 0 2px var(--accent-glow), var(--shadow-md);
  animation: pulseGlow 3s ease-in-out infinite;
}

.prayer-card.active::before { background: var(--prayer-active-border); }

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent-glow), var(--shadow-md); }
  50% { box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow-lg); }
}

.prayer-card.past { opacity: 0.55; }

.prayer-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.prayer-emoji { font-size: 1.4rem; line-height: 1; }

.prayer-active-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--prayer-active-border);
  background: var(--highlight-bg);
  padding: 2px 7px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--prayer-active-border);
  opacity: 0;
  transition: opacity var(--transition);
}

.prayer-card.active .prayer-active-badge { opacity: 1; }

.prayer-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1;
}

.prayer-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.prayer-time {
  font-family: 'Poppins', monospace;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  transition: color var(--transition-slow);
}

.prayer-card.active .prayer-time { color: var(--prayer-active-border); }

.prayer-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xl);
  display: inline-block;
  margin-top: 4px;
}

.prayer-tag.suhoor { background: rgba(110, 200, 228, 0.15); color: var(--suhoor-accent); }
.prayer-tag.iftar  { background: rgba(240, 160, 96, 0.15); color: var(--iftar-accent); }

/* Loading state */
.prayer-loading, .calendar-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  grid-column: 1 / -1;
}

.loader-ring {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }


/* ── Ad Placements ───────────────────────────────────── */
.ad-wrap {
  max-width: 1100px;
  margin: 8px auto 24px;
  padding: 0 20px;
}

.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 90px;
  background: var(--highlight-bg);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad-placeholder-small { height: 50px; }


/* ── Ramadan Calendar Section ────────────────────────────── */
.calendar-section { padding: 0 0 40px; }

.calendar-meta { font-size: 0.85rem; color: var(--text-muted); }

.calendar-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.calendar-error {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Scroll container */
.calendar-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  backdrop-filter: blur(10px);
}

/* Table base */
.calendar-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  font-size: 0.82rem;
}

/* Sticky header */
.calendar-table thead {
  position: sticky;
  top: 60px;
  z-index: 10;
}

.calendar-table th {
  padding: 11px 12px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  white-space: nowrap;
  background: var(--card-bg-solid);
  border-bottom: 1px solid var(--card-border);
}

.th-suhoor { color: var(--suhoor-accent) !important; }
.th-iftar  { color: var(--iftar-accent)  !important; }
.th-hours  { text-align: right; }

/* Rows */
.calendar-table tbody tr {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.calendar-table td {
  padding: 0;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.calendar-table tr:last-child td { border-bottom: none; }
.calendar-table tbody tr:hover td { background: var(--highlight-bg); }

/* Today */
.calendar-table tr.today-row td { background: var(--today-highlight); }
.calendar-table tr.today-row:hover td { filter: brightness(1.1); }

/* Past */
.calendar-table tr.past-row { opacity: 0.45; }

/* ── Cell content layout ────────────────────────── */
/* Every cell uses a flex column with label on top, time below */
.cal-day-num,
.cal-date,
.cal-suhoor,
.cal-prayer,
.cal-iftar,
.cal-hours {
  padding: 10px 12px;
}

/* Day number */
.cal-day-num {
  width: 44px;
  text-align: center;
  vertical-align: middle;
  position: relative;
}

.day-number {
  font-family: 'Poppins', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: block;
  line-height: 1;
}

.today-num .day-number {
  color: var(--accent-primary);
  font-size: 1.15rem;
}

.today-dot {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-primary);
  margin: 3px auto 0;
}

/* Date column */
.cal-date {
  min-width: 72px;
}

.cal-weekday {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.cal-datestr {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.85rem;
  white-space: nowrap;
}

.friday-day .cal-weekday,
.friday-day .cal-datestr { color: var(--accent-primary) !important; }

/* Label + time stack used inside each prayer/suhoor/iftar cell */
.cal-suhoor,
.cal-prayer,
.cal-iftar {
  min-width: 72px;
}

.cal-label {
  display: block;
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 3px;
  white-space: nowrap;
}

.cal-time {
  display: block;
  font-family: 'Poppins', monospace;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Suhoor accent */
.cal-suhoor { border-left: 2px solid rgba(110, 200, 228, 0.2); }
.suhoor-time { color: var(--suhoor-accent) !important; }

/* Iftar accent */
.cal-iftar { border-left: 2px solid rgba(240, 160, 96, 0.2); }
.iftar-time { color: var(--iftar-accent) !important; }

/* Today row brightens times */
.today-row .cal-time { color: var(--text-primary) !important; }
.today-row .suhoor-time { color: var(--suhoor-accent) !important; }
.today-row .iftar-time  { color: var(--iftar-accent)  !important; }

/* Fasting hours */
.cal-hours {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: right;
  white-space: nowrap;
  min-width: 52px;
}

/* ── Last 10 Nights ──────────────────────────────────── */
.last10-section { padding: 0 0 32px; }

.last10-card {
  background: linear-gradient(135deg, rgba(240, 160, 0, 0.08), rgba(255, 200, 60, 0.04));
  border: 1px solid rgba(240, 160, 0, 0.3);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
}

.last10-header { margin-bottom: 28px; }

.last10-stars {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 12px;
  animation: twinkle 2s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.7; text-shadow: none; }
  to   { opacity: 1; text-shadow: 0 0 12px rgba(255, 220, 80, 0.7); }
}

.last10-card h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #f0c040;
  margin-bottom: 6px;
}

.last10-subtitle { color: var(--text-muted); font-size: 0.9rem; }

.last10-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.last10-item {
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
}

.l10-icon { font-size: 1.5rem; margin-bottom: 8px; }
.l10-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.l10-value { font-weight: 600; color: var(--text-primary); font-size: 0.9rem; }

.last10-dua {
  padding: 20px 24px;
  background: var(--highlight-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.dua-arabic {
  font-size: 1.3rem;
  color: #f0c040;
  margin-bottom: 8px;
  direction: rtl;
  font-family: 'Amiri', 'Traditional Arabic', serif;
}

.dua-transliteration {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.dua-meaning { font-size: 0.85rem; color: var(--text-muted); }

/* ── Footer ──────────────────────────────────────────── */
.footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border-color);
  padding: 40px 0 100px;
  transition: background var(--transition-slow);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-brand { display: flex; flex-direction: column; gap: 8px; }

.footer-moon { font-size: 1.6rem; color: var(--moon-color); }
.footer-name { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-primary); }
.footer-tagline { font-size: 0.85rem; color: var(--text-muted); max-width: 280px; }

.footer-links { display: flex; gap: 48px; }

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.footer-col a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.footer-col a:hover { color: var(--accent-primary); text-decoration: none; }

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-bottom p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-bottom a { color: var(--text-secondary); }
.footer-bottom a:hover { color: var(--accent-primary); }

/* ── Mobile Sticky Ad ────────────────────────────────── */
.mobile-sticky-ad {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--nav-bg);
  border-top: 1px solid var(--border-color);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  transition: transform 0.3s ease;
}

.mobile-sticky-ad.hidden { transform: translateY(100%); }

.sticky-ad-close {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--highlight-bg);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--border-color);
}

/* ── Notification Toast ──────────────────────────────── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--card-bg-solid);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 0.875rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
  backdrop-filter: blur(12px);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Viewing Date Banner ─────────────────────────────── */
.viewing-banner {
  background: var(--highlight-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 20px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: none;
}

.viewing-banner.visible { display: block; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-title { display: none; }

  .nav-location-btn {
    max-width: none;
    margin-left: auto;
  }

  .hero-section { padding: 28px 16px 24px; }

  .live-clock { font-size: clamp(2.8rem, 16vw, 4rem); }

  .time-block { min-width: 60px; padding: 10px 6px 7px; }
  .time-val { font-size: clamp(1.5rem, 8vw, 2.2rem); }

  .key-times-bar { max-width: 100%; }
  .key-time { padding: 14px 16px; gap: 10px; }
  .key-time-value { font-size: 1.2rem; }

  .prayer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .prayer-card { padding: 14px 12px; }

  .section-header { flex-direction: column; align-items: flex-start; }

  .day-nav .btn { padding: 7px 12px; font-size: 0.8rem; }

  .calendar-table th, .calendar-table td { padding: 10px 10px; }

  .footer-grid { grid-template-columns: 1fr; }
  .footer-links { flex-wrap: wrap; gap: 24px; }

  .ad-wrap { padding: 0 12px; }
  .container { padding: 0 16px; }
}

@media (max-width: 480px) {
  .prayer-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .time-block { min-width: 52px; }
  .prayer-time { font-size: 1.15rem; }
  .countdown-timer { gap: 4px; }
  .time-colon { font-size: 1.8rem; margin-bottom: 12px; }
  .last10-grid { grid-template-columns: 1fr; }
  .calendar-table { font-size: 0.8rem; }
  .calendar-table th, .calendar-table td { padding: 8px 8px; }
}

@media (min-width: 1024px) {
  .prayer-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Reduced Motion ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── High Contrast / Dark Mode Overrides ────────────── */
@media (forced-colors: active) {
  .prayer-card.active { border: 3px solid Highlight; }
  .btn-today { background: Highlight; color: HighlightText; }
}

/* ── Iftar imminent pulse ────────────────────────────── */
.countdown-timer.iftar-imminent .time-val {
  color: var(--iftar-accent);
  animation: iftarPulse 1.5s ease-in-out infinite;
}

@keyframes iftarPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(1.04); }
}

/* ── Friday highlight ────────────────────────────────── */
.friday-cell { color: var(--accent-primary) !important; font-weight: 600; }

/* ── Print ───────────────────────────────────────────── */
@media print {
  .navbar, .modal-overlay, .ad-wrap, .mobile-sticky-ad, .day-nav { display: none !important; }
  body { background: #fff; color: #000; }
  .calendar-table { font-size: 0.8rem; }
  .section-title { font-size: 1.1rem; }
}
