/* ═══════════════════════════════════════
   TOKENS
═══════════════════════════════════════ */
:root {
  --bg:        #0a1628;
  --bg2:       #0f1e38;
  --surface:   #152542;
  --surface2:  #1c2f52;
  --gold:      #d4a94a;
  --gold-dim:  #b8902e;
  --teal:      #4da6ff;
  --green:     #00c49a;
  --red:       #ff5a6a;
  --text:      #f0f4ff;
  --muted:     rgba(240,244,255,0.5);
  --faint:     rgba(240,244,255,0.07);
  --border:    rgba(240,244,255,0.08);
  --font:      'Outfit', sans-serif;
  --arabic:    'Amiri', serif;
  --mono:      'JetBrains Mono', monospace;
  --radius-sm: 10px;
  --radius:    16px;
  --radius-lg: 24px;
  --shadow:    0 4px 24px rgba(0,0,0,0.3);
  --transition: 0.22s ease;
}

/* ═══════════════════════════════════════
   RESET
═══════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  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;
}

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }

/* ═══════════════════════════════════════
   SKIP LINK (accessibility)
═══════════════════════════════════════ */
.skip-link {
  position: absolute; top: -40px; left: 0;
  background: var(--gold); color: #000;
  padding: 8px 16px; font-weight: 700;
  z-index: 9999; border-radius: 0 0 8px 0;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ═══════════════════════════════════════
   CONTAINER
═══════════════════════════════════════ */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
}

/* ═══════════════════════════════════════
   NOISE OVERLAY
═══════════════════════════════════════ */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9998;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ═══════════════════════════════════════
   NAV
═══════════════════════════════════════ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,22,40,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 900px; margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
  height: 60px;
  display: flex; align-items: center; gap: 12px;
}

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

.logo-icon {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--gold), #e8c97a);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #0a1628;
}

.logo-text {
  font-size: 18px; font-weight: 800; letter-spacing: -0.3px;
}
.logo-accent { color: var(--gold); }

.nav-location {
  flex: 1; display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.nav-location-icon { flex-shrink: 0; }

.nav-actions { display: flex; gap: 6px; flex-shrink: 0; }
.nav-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--faint); border: 1px solid var(--border);
  color: var(--text); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.nav-btn:hover { background: rgba(255,255,255,0.1); }
.nav-btn.active { background: rgba(212,169,74,0.15); border-color: var(--gold); }

/* ═══════════════════════════════════════
   DATE HEADER
═══════════════════════════════════════ */
.date-header {
  padding: 16px 0 0;
  text-align: center;
}
.date-grid {
  display: flex; flex-direction: column; gap: 4px;
}
.date-gregorian {
  font-size: 15px; font-weight: 600; color: var(--muted);
}
.date-hijri {
  font-size: 20px; font-weight: 700; color: var(--gold);
  font-family: var(--arabic);
  direction: rtl;
}

/* ═══════════════════════════════════════
   TABS
═══════════════════════════════════════ */
.tabs-wrap {
  padding: 16px 0 0;
  position: sticky; top: 60px; z-index: 90;
  background: var(--bg);
}
.tabs {
  display: flex; gap: 4px;
  background: var(--faint); border-radius: 30px; padding: 4px;
  width: fit-content; margin: 0 auto;
}
.tab {
  padding: 8px 18px; border-radius: 26px;
  font-size: 13px; font-weight: 700;
  color: var(--muted); background: none; border: none;
  transition: all var(--transition); white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--text); color: var(--bg); }

/* ═══════════════════════════════════════
   PANELS
═══════════════════════════════════════ */
.panel { padding: 20px 0 32px; display: none; }
.panel.active { display: block; }

/* ═══════════════════════════════════════
   CITY SEARCH
═══════════════════════════════════════ */
.city-search-wrap { position: relative; margin-bottom: 16px; }

.city-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  transition: border-color var(--transition);
}
.city-search:focus-within { border-color: var(--gold); }

.search-icon { font-size: 16px; flex-shrink: 0; }
.city-search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font); font-size: 15px;
}
.city-search input::placeholder { color: var(--muted); }

.location-btn {
  background: none; border: none; font-size: 18px;
  padding: 4px; border-radius: 6px; flex-shrink: 0;
  transition: transform var(--transition);
}
.location-btn:hover { transform: scale(1.15); }

.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
  z-index: 50; display: none;
  box-shadow: var(--shadow);
}
.search-results.show { display: block; }
.search-result {
  padding: 12px 16px; cursor: pointer; font-size: 14px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--faint); }
.search-result-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ═══════════════════════════════════════
   OFFLINE BAR
═══════════════════════════════════════ */
.offline-bar {
  display: none; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: rgba(212,169,74,0.1); border: 1px solid rgba(212,169,74,0.2);
  color: var(--gold); font-size: 13px; font-weight: 600;
  margin-bottom: 16px;
}
.offline-bar.show { display: flex; }

/* ═══════════════════════════════════════
   LOADING / ERROR
═══════════════════════════════════════ */
.loading-wrap, .error-wrap {
  text-align: center; padding: 48px 20px;
  display: none; flex-direction: column;
  align-items: center; gap: 14px;
}
.loading-wrap.show, .error-wrap.show { display: flex; }

.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--faint);
  border-top-color: var(--gold);
  animation: spin 0.75s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-wrap p, .error-wrap p { color: var(--muted); font-size: 14px; }
.error-icon { font-size: 40px; }
.retry-btn {
  padding: 10px 24px; border-radius: 30px;
  background: var(--faint); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font);
  font-size: 14px; font-weight: 600;
  transition: background var(--transition);
}
.retry-btn:hover { background: rgba(255,255,255,0.1); }

/* ═══════════════════════════════════════
   METHOD INFO
═══════════════════════════════════════ */
.method-info {
  text-align: center; margin-top: 16px;
  font-size: 12px; color: rgba(255,255,255,0.25);
  font-family: var(--mono);
}

/* ═══════════════════════════════════════
   SEO SECTION
═══════════════════════════════════════ */
.seo-section {
  padding: clamp(32px,5vw,64px) 0;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.seo-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.seo-card h2 {
  font-size: 17px; font-weight: 700; margin-bottom: 10px; color: var(--gold);
}
.seo-card p { font-size: 14px; color: var(--muted); line-height: 1.7; margin-bottom: 8px; }
.seo-card ul { padding-left: 16px; list-style: disc; }
.seo-card li { font-size: 14px; color: var(--muted); margin-bottom: 5px; }
.seo-card li strong { color: var(--text); }

/* FAQ */
.faq-title {
  font-size: 24px; font-weight: 800; margin-bottom: 20px;
  letter-spacing: -0.3px;
}
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.faq-q {
  padding: 16px 20px; font-size: 15px; font-weight: 600; cursor: pointer;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
  transition: background var(--transition);
}
.faq-q:hover { background: var(--faint); }
.faq-q::after { content: '▾'; color: var(--gold); font-size: 14px; flex-shrink: 0; }
details[open] .faq-q::after { content: '▴'; }
.faq-a {
  padding: 0 20px 16px;
  font-size: 14px; color: var(--muted); line-height: 1.7;
}

/* ═══════════════════════════════════════
   FOOTER
═══════════════════════════════════════ */
.footer {
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: clamp(32px,5vw,56px) 0 0;
}
.footer-inner {
  display: flex; gap: 40px; flex-wrap: wrap;
  padding-bottom: 40px; border-bottom: 1px solid var(--border);
}
.footer-brand { flex: 1; min-width: 240px; }
.footer-logo { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.footer-logo span { color: var(--gold); }
.footer-tagline { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.footer-powered { font-size: 12px; color: rgba(255,255,255,0.25); }
.footer-powered a { color: var(--gold); }

.footer-links-wrap { display: flex; gap: 40px; flex-wrap: wrap; }
.footer-col h3 { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 12px; }
.footer-col ul { display: flex; flex-direction: column; gap: 8px; }
.footer-col a { font-size: 14px; color: var(--muted); transition: color var(--transition); }
.footer-col a:hover { color: var(--text); text-decoration: none; }

.footer-bottom {
  padding: 16px 0; text-align: center;
  font-size: 12px; color: rgba(255,255,255,0.2);
}

/* ═══════════════════════════════════════
   MODALS
═══════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(6px);
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.overlay.show { opacity: 1; pointer-events: all; }

.modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -48%) scale(0.97);
  width: min(600px, 94vw); max-height: 82dvh;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); z-index: 201;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34,1.1,0.64,1);
}
.modal.show { opacity: 1; pointer-events: all; transform: translate(-50%,-50%) scale(1); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-header h2 { font-size: 18px; font-weight: 800; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--faint); border: 1px solid var(--border);
  color: var(--text); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.1); }
.modal-body { overflow-y: auto; padding: 22px; flex: 1; }
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--faint); border-radius: 2px; }
.modal-body h3 { font-size: 14px; font-weight: 700; color: var(--text); margin: 18px 0 6px; }
.modal-body h3:first-child { margin-top: 0; }
.modal-body p { font-size: 13px; color: var(--muted); margin-bottom: 8px; line-height: 1.7; }
.modal-body ul { padding-left: 16px; list-style: disc; }
.modal-body li { font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* Settings */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 14px; font-weight: 600; }
.setting-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.setting-select {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font); font-size: 13px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  outline: none; cursor: pointer;
}
.setting-toggle {
  width: 44px; height: 24px; border-radius: 12px;
  background: var(--faint); border: none; position: relative;
  transition: background var(--transition); cursor: pointer;
}
.setting-toggle.on { background: var(--gold); }
.setting-toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform var(--transition);
}
.setting-toggle.on::after { transform: translateX(20px); }

/* ═══════════════════════════════════════
   TOAST
═══════════════════════════════════════ */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); padding: 10px 24px; border-radius: 30px;
  font-size: 13px; font-weight: 600; z-index: 9997;
  transition: transform 0.35s cubic-bezier(0.34,1.3,0.64,1), opacity 0.35s;
  opacity: 0; pointer-events: none; white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 600px) {
  .seo-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: 24px; }
  .tabs { flex-wrap: wrap; justify-content: center; }
  .tab { font-size: 12px; padding: 7px 14px; }
}
