/* ============================================
   Waqt Al-Salah — Modern Islamic Prayer Times
   Mobile-first, minimalist, professional
   ============================================ */

:root {
  --bg: #0a0e17;
  --bg-card: #111827;
  --bg-card-hover: #1a2332;
  --surface: #1f2937;
  --border: #374151;
  --border-light: #4b5563;
  --text: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.3);
  --gold: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.25);
  --green: #10b981;
  --red: #ef4444;
  --teal: #14b8a6;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.4);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-arabic: 'Amiri', 'Noto Naskh Arabic', serif;
}

*, *::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: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Background ambient glow */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(59,130,246,0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(245,158,11,0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Typography ---- */
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }

.arabic { font-family: var(--font-arabic); direction: rtl; }

/* ---- Layout ---- */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  position: relative;
  z-index: 10;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-brand .logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 12px var(--gold-glow); }
  50% { box-shadow: 0 0 24px var(--gold-glow), 0 0 48px rgba(245,158,11,0.1); }
}

.header-brand h1 {
  font-size: 1.4rem;
  background: linear-gradient(135deg, var(--text), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-brand .subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

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

.btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #d97706);
  border-color: var(--gold);
  color: #fff;
}

.btn-gold:hover {
  box-shadow: 0 4px 16px var(--gold-glow);
}

/* ---- Language Switcher ---- */
.lang-switcher {
  position: relative;
}

.lang-current {
  font-size: 1rem;
  line-height: 1;
  overflow: hidden;
}

.lang-current img {
  width: 22px;
  height: 16px;
  border-radius: 2px;
  object-fit: cover;
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  min-width: 160px;
  opacity: 0;
  transform: translateY(-8px) scale(0.95);
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.lang-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition);
  text-align: left;
}

.lang-option:hover {
  background: var(--bg-card-hover);
}

.lang-option:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.lang-option:last-child { border-radius: 0 0 var(--radius) var(--radius); }

.lang-flag {
  display: inline-block;
  width: 22px;
  height: 16px;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.lang-flag img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lang-option.active {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
}

/* ---- Settings Sections ---- */
.settings-section-title {
  font-size: 0.85rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0 16px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

.btn-danger {
  border-color: var(--red);
  color: var(--red);
}

.btn-danger:hover { background: rgba(239,68,68,0.1); }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--border-light);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Map Section ---- */
.map-section {
  margin-bottom: 20px;
}

#map {
  width: 100%;
  height: 280px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  z-index: 1;
}

@media (min-width: 768px) {
  #map { height: 360px; }
}

.map-overlay {
  position: relative;
  margin-top: -48px;
  z-index: 2;
  padding: 0 12px;
  margin-bottom: 12px;
}

.search-bar {
  display: flex;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
}

.search-bar input::placeholder { color: var(--text-muted); }

/* ---- Location Info Bar ---- */
.location-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.85rem;
}

.location-bar .coord {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
}

.location-bar .coord span { color: var(--text); font-weight: 500; }
.location-bar .separator { color: var(--border-light); }

/* ---- Grid Layout ---- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .main-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1024px) {
  .main-grid { grid-template-columns: 2fr 1fr; }
}

/* ---- Prayer Times Table ---- */
.prayer-table {
  width: 100%;
  border-collapse: collapse;
}

.prayer-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.prayer-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(55, 65, 81, 0.5);
  font-size: 0.9rem;
  transition: background var(--transition);
}

.prayer-table tr:hover td {
  background: rgba(59, 130, 246, 0.04);
}

.prayer-table .prayer-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prayer-table .prayer-name .en { font-weight: 500; }
.prayer-table .prayer-name .ar {
  font-family: var(--font-arabic);
  font-size: 0.8rem;
  color: var(--text-secondary);
  direction: rtl;
}

.prayer-table .time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--gold);
  font-size: 0.95rem;
}

.prayer-table .azimuth {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.prayer-band {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.prayer-current td {
  background: rgba(59, 130, 246, 0.08) !important;
  border-left: 3px solid var(--accent);
}

.prayer-current .time { color: var(--accent); }

/* ---- Info Cards (Moon, Qibla, Night) ---- */
.info-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.info-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(55,65,81,0.3);
  font-size: 0.85rem;
}

.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-secondary); }
.info-row .value { font-weight: 500; font-variant-numeric: tabular-nums; }

/* Moon phase visual */
.moon-phase-visual {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--surface);
  margin: 12px auto;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--border);
}

.moon-phase-visual .illuminated {
  position: absolute;
  top: 0;
  height: 100%;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  transition: width var(--transition);
}

/* Qibla compass */
.qibla-compass {
  width: 120px;
  height: 120px;
  margin: 12px auto;
  position: relative;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
}

.qibla-compass .needle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 50px;
  background: linear-gradient(to top, var(--gold), var(--red));
  transform-origin: bottom center;
  border-radius: 2px;
  margin-left: -1.5px;
  margin-top: -50px;
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.qibla-compass .center-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  background: var(--gold);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.qibla-compass .direction {
  position: absolute;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
}

.qibla-compass .dir-n { top: 4px; left: 50%; transform: translateX(-50%); color: var(--red); }
.qibla-compass .dir-s { bottom: 4px; left: 50%; transform: translateX(-50%); }
.qibla-compass .dir-e { right: 6px; top: 50%; transform: translateY(-50%); }
.qibla-compass .dir-w { left: 6px; top: 50%; transform: translateY(-50%); }

/* Visibility badge */
.visibility-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.vis-visible { background: rgba(16,185,129,0.15); color: var(--green); }
.vis-difficult { background: rgba(245,158,11,0.15); color: var(--gold); }
.vis-optical { background: rgba(59,130,246,0.15); color: var(--accent); }
.vis-not-visible { background: rgba(107,114,128,0.15); color: var(--text-muted); }

/* ---- Settings Panel ---- */
.settings-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  max-width: 90vw;
  height: 100dvh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 100;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: 20px;
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
}

.settings-panel.open { right: 0; }

.settings-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.settings-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ---- Form Controls ---- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
  transition: border-color var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ---- Favorites Panel ---- */
.favorites-panel {
  position: fixed;
  top: 0;
  left: -380px;
  width: 360px;
  max-width: 90vw;
  height: 100dvh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  z-index: 100;
  transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: 20px;
  box-shadow: 8px 0 32px rgba(0,0,0,0.4);
}

.favorites-panel.open { left: 0; }

.fav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--transition);
}

.fav-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateX(4px);
}

.fav-item .fav-name { font-weight: 500; font-size: 0.9rem; }
.fav-item .fav-coords { font-size: 0.75rem; color: var(--text-muted); }

/* ---- Timezone Column ---- */
.col-tz {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 767px) {
  .col-tz { display: none; }
}

/* ---- Prayer Toggle Checkboxes ---- */
.prayer-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  max-height: 280px;
  overflow-y: auto;
}

.prayer-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.prayer-toggle input[type="checkbox"] {
  accent-color: var(--gold);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ---- Language Dropdown Scroll ---- */
.lang-dropdown {
  max-height: 400px;
  overflow-y: auto;
}

/* ---- Masjid View Button ---- */
.btn-masjid {
  background: linear-gradient(135deg, var(--gold), #d97706);
  border-color: var(--gold);
  color: #fff;
  font-size: 0.7rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
}

.btn-masjid:hover {
  box-shadow: 0 4px 16px var(--gold-glow);
  transform: translateY(-1px);
}

/* ---- Hijri Date Banner ---- */
.hijri-banner {
  text-align: center;
  padding: 12px;
  background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(59,130,246,0.08));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.hijri-banner .hijri-date {
  font-family: var(--font-arabic);
  font-size: 1.1rem;
  color: var(--gold);
}

.hijri-banner .gregorian-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---- Night Fractions ---- */
.night-bar {
  display: flex;
  height: 32px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 12px 0;
  border: 1px solid var(--border);
}

.night-bar .segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: #fff;
  transition: flex var(--transition);
}

.night-bar .seg-1 { background: #1e3a5f; flex: 1; }
.night-bar .seg-2 { background: #0f2540; flex: 1; }
.night-bar .seg-3 { background: #0a1628; flex: 1; }

/* ---- Seasonal Hours ---- */
.seasonal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.seasonal-item {
  padding: 10px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  text-align: center;
}

.seasonal-item .val {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold);
}

.seasonal-item .lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Date Picker Dark Theme ---- */
input[type="date"] {
  color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
}

/* Prayer angle badge */
.prayer-angle {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}

/* ---- Loading States ---- */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--bg-card-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: opacity 0.6s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-ring {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ---- Toast Notifications ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  animation: slide-in 0.3s ease;
  max-width: 320px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- Date Navigation ---- */
.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.date-nav input[type="date"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
}

.date-nav input[type="date"]:focus {
  border-color: var(--accent);
}

/* ---- Animations ---- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fade-up 0.5s ease forwards;
  opacity: 0;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* Prayer row stagger animation */
.prayer-table tr {
  animation: fade-up 0.4s ease forwards;
  opacity: 0;
}

.prayer-table tr:nth-child(1) { animation-delay: 0.05s; }
.prayer-table tr:nth-child(2) { animation-delay: 0.1s; }
.prayer-table tr:nth-child(3) { animation-delay: 0.15s; }
.prayer-table tr:nth-child(4) { animation-delay: 0.2s; }
.prayer-table tr:nth-child(5) { animation-delay: 0.25s; }
.prayer-table tr:nth-child(6) { animation-delay: 0.3s; }
.prayer-table tr:nth-child(7) { animation-delay: 0.35s; }
.prayer-table tr:nth-child(8) { animation-delay: 0.4s; }
.prayer-table tr:nth-child(9) { animation-delay: 0.45s; }
.prayer-table tr:nth-child(10) { animation-delay: 0.5s; }
.prayer-table tr:nth-child(11) { animation-delay: 0.55s; }
.prayer-table tr:nth-child(12) { animation-delay: 0.6s; }
.prayer-table tr:nth-child(13) { animation-delay: 0.65s; }

/* Countdown timer */
.countdown {
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(59,130,246,0.04));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.countdown .next-prayer-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.countdown .next-prayer-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  margin: 4px 0 2px;
}

.countdown .next-prayer-time {
  font-size: 1.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.countdown .timer-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.countdown .timer {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: 0.02em;
}

/* Subtiles Highlight fuer das naechste Gebet in der Tabelle */
.prayer-table .prayer-next td {
  background: rgba(245, 158, 11, 0.06);
  border-left: 3px solid var(--gold);
}

.prayer-table .prayer-next .time {
  color: var(--gold);
}

/* ---- Preset buttons grid ---- */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.btn-preset {
  font-size: 0.75rem;
  padding: 8px 4px;
  text-align: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}
.btn-preset:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-preset.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ---- Favorites mini cards on home ---- */
.fav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin: 0 0 16px 0;
}
.fav-mini {
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}
.fav-mini:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.fav-mini .fm-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fav-mini .fm-next {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.fav-mini .fm-time {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* ---- Onboarding overlay ---- */
.onboard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}
.onboard-overlay.open { display: flex; }
.onboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  margin: 16px;
  box-shadow: var(--shadow-lg);
}
.onboard-card h3 {
  margin: 0 0 8px;
  color: var(--accent);
}
.onboard-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 8px 0;
  line-height: 1.55;
}
.onboard-card .btn {
  margin-top: 12px;
  margin-right: 6px;
}

/* ---- Print rules (Prayer Table aushang-tauglich) ---- */
@media print {
  body { background: white !important; color: black !important; }
  .header, .map-section, .location-bar, .date-nav, .countdown,
  .fav-cards, .info-stack, .scroll-top, .toast-container,
  .settings-panel, .favorites-panel, .settings-overlay,
  .onboard-overlay, .footer p:nth-child(n+3) { display: none !important; }
  .card, .hijri-banner { box-shadow: none !important; border: 1px solid #888 !important; background: white !important; }
  .card *, .hijri-banner * { color: black !important; }
  .prayer-table th { color: #444 !important; }
  .prayer-table .prayer-current td,
  .prayer-table .prayer-next td { background: #fff3d0 !important; border-left-color: #b88800 !important; }
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  margin-top: 24px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---- Responsive ---- */
@media (max-width: 767px) {
  .header h1 { font-size: 1.1rem; }
  .header .subtitle { display: none; }
  .card { padding: 14px; }
  .prayer-table td, .prayer-table th { padding: 8px; }
  .prayer-table .azimuth { display: none; }
  .location-bar { font-size: 0.78rem; }
  .toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { max-width: 100%; }
  .date-nav { flex-wrap: wrap; }
}

/* Scroll to top */
.scroll-top {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transform: translateY(16px);
  transition: all var(--transition);
  z-index: 50;
}

.scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Print styles */
@media print {
  body { background: #fff; color: #000; }
  .header-actions, .map-section, .settings-panel, .favorites-panel,
  .settings-overlay, .scroll-top, .toast-container, .search-bar { display: none !important; }
  .card { border: 1px solid #ddd; break-inside: avoid; }
  .prayer-table .time { color: #000; }
}
