:root {
  --brand: #10b981;
  --brand-dark: #1A4D2E;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #4b5563;
  --border: #e5e7eb;
  --danger: #b91c1c;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { overflow-x: hidden; } /* حماية إضافية من أي تمرير أفقي غير مقصود على شاشات صغيرة */

body {
  margin: 0;
  padding: 0;
  font-family: 'Tajawal', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%; /* يمنع تكبير النص التلقائي عند تدوير الجوال أفقيًا */
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; touch-action: manipulation; } /* يلغي تأخير الـ 300ms الافتراضي عند اللمس */

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh; /* يراعي شريط عنوان المتصفح المتحرك بالجوال (Safari/Chrome) بدل قفزة الطول عند التمرير */
  background: var(--card);
  box-shadow: 0 0 30px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--brand);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-header__brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.app-header__mark { font-size: 22px; }
.app-header__menu-btn { font-size: 22px; cursor: pointer; padding: 4px 8px; }

/* ===== Drawer ===== */
.drawer-toggle { position: absolute; opacity: 0; pointer-events: none; }
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30;
}
.drawer-side {
  position: fixed; top: 0; bottom: 0; right: -300px; width: 280px;
  background: #fff; z-index: 40; transition: right .25s ease;
  overflow-y: auto; padding: 20px 16px; box-shadow: -4px 0 20px rgba(0,0,0,.1);
}
#drawer-toggle:checked ~ .drawer-overlay { opacity: 1; pointer-events: auto; }
#drawer-toggle:checked ~ .drawer-side { right: 0; }

.drawer-side__nav { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.drawer-side__nav a { padding: 10px 8px; border-radius: 8px; font-weight: 600; }
.drawer-side__nav a:hover { background: var(--bg); }
.drawer-side__title { font-weight: 700; color: var(--muted); font-size: 13px; margin: 12px 0 6px; }
.drawer-side__countries { display: flex; flex-direction: column; gap: 2px; max-height: 45vh; overflow-y: auto; }
.drawer-side__countries a { padding: 8px; border-radius: 6px; font-size: 14px; }
.drawer-side__countries a:hover { background: var(--bg); }
.drawer-side__privacy { display: block; margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }

/* ===== Main / Footer dock ===== */
.app-main { flex: 1; padding: 16px 16px 90px; }

.app-footer {
  position: sticky; bottom: 0; background: #fff;
  border-top: 1px solid var(--border); z-index: 20;
}
.dock-nav { display: flex; }
.dock-nav__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 48px; /* حد أدنى مريح للمس بالإصبع (توصية Apple/Google) */
  padding: 8px 0; background: none; border: none; color: var(--text); font-size: 12px;
}
.dock-nav__item span { font-size: 20px; }

/* ===== Shared bits ===== */
.badge {
  display: inline-block; background: rgba(255,255,255,.2); padding: 4px 12px;
  border-radius: 999px; font-size: 13px; margin-top: 8px;
}
.btn {
  display: inline-block; background: var(--brand); color: #fff; padding: 10px 18px;
  border-radius: 10px; font-weight: 700; border: none; text-align: center;
}
.btn--whatsapp { background: #075E54; } /* أخضر واتساب الفاتح (#25D366) فشل بتباين النص الأبيض عليه (1.98:1) — استبدلته بالتيل الداكن الرسمي لواتساب (7.67:1) */
.btn--ghost { background: transparent; color: var(--brand-dark); border: 1px solid var(--border); }
.muted-note { text-align: center; color: var(--muted); font-size: 12px; margin: 20px 0; }

/* ===== Hero card ===== */
.hero-card {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; border-radius: 16px; padding: 24px 16px; text-align: center; margin-bottom: 16px;
}
.hero-card__emoji { font-size: 34px; }
.hero-card h1 { margin: 4px 0; font-size: 22px; }
.hero-card__date { font-size: 13px; opacity: .9; }
/* .hero-card__loc أصبح <h1> دلاليًا بصفحتي المدينة/موقعي، لكن يبقى شكله كعنوان فرعي صغير كما كان */
h1.hero-card__loc, .hero-card__loc { margin: 0; font-weight: 700; font-size: 14px; opacity: .9; }
.hero-card__clock { font-size: 30px; font-weight: 800; letter-spacing: 1px; margin: 6px 0; }
.hero-card__next { font-size: 13px; opacity: .9; }
.hero-card__countdown { font-size: 26px; font-weight: 800; margin: 4px 0; }
.hero-card.is-soon { background: linear-gradient(135deg, var(--danger), #b91c1c); }
.hero-card__locate-btn { display: inline-block; margin-top: 14px; background: rgba(255,255,255,.2); }

/* ===== Country grid (home) ===== */
.country-grid { display: flex; flex-direction: column; gap: 12px; }
.country-card {
  display: block; border: 1px solid var(--border); border-radius: 14px; padding: 12px;
}
.country-card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.country-card__emoji { font-size: 26px; }
.country-card__name { font-weight: 700; }
.country-card__city { font-size: 12px; color: var(--muted); }
.country-card__chevron { margin-inline-start: auto; color: var(--muted); }
.prayer-row-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.prayer-row-mini__item { text-align: center; font-size: 12px; background: var(--bg); border-radius: 8px; padding: 6px 2px; }
.prayer-row-mini__item strong { display: block; font-size: 13px; }
.prayer-row-mini__item.is-main { background: #ecfdf5; color: var(--brand-dark); }

/* ===== Page head / lists ===== */
.page-head { text-align: center; margin-bottom: 16px; }
.page-head h1 { font-size: 20px; margin: 0 0 4px; }
.page-head__sub { color: var(--muted); font-size: 13px; }

.city-list { display: flex; flex-direction: column; gap: 2px; }
.city-list__row {
  display: flex; align-items: center; gap: 10px; padding: 12px 10px; border-radius: 10px;
}
.city-list__row:nth-child(odd) { background: var(--bg); }
.city-list__index { color: var(--muted); font-size: 12px; width: 20px; }
.city-list__name { font-weight: 600; flex: 1; }
.city-list__cta { color: var(--brand-dark); font-size: 12px; }

/* ===== Nav grid (city page) ===== */
.nav-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.nav-grid a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--bg); border-radius: 12px; padding: 12px 4px; font-size: 12px; font-weight: 600;
}
.nav-grid a span { font-size: 20px; }

/* ===== Prayer card ===== */
.prayer-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 16px; }
.prayer-card__row {
  display: flex; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.prayer-card__row:last-child { border-bottom: none; }

/* ===== وحدة إعلانية ثابتة ===== */
/* min-height محجوزة قبل تحميل الإعلان فعليًا — يمنع قفزة المحتوى (CLS) التي كانت تسببها Auto Ads */
.ad-slot { min-height: 250px; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; overflow: hidden; }
.ad-slot .adsbygoogle { width: 100%; }

/* ===== Madhab toggle (Asr) ===== */
.madhab-toggle { display: flex; gap: 8px; padding: 10px 16px 6px; }
.madhab-toggle__btn {
  flex: 1; min-height: 40px; border: 1px solid var(--border); background: var(--bg); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-family: inherit; white-space: nowrap;
}
.madhab-toggle__btn.is-active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.madhab-toggle__hint { margin: 0; padding: 0 16px 10px; font-size: 12px; color: var(--muted); text-align: center; }
.madhab-toggle-wrap.madhab-toggle--section { margin-bottom: 16px; background: var(--bg); border-radius: 14px; }
.madhab-toggle-wrap.madhab-toggle--section .madhab-toggle__hint { padding-top: 0; }

/* ===== Dua card ===== */
.dua-card { text-align: center; background: linear-gradient(135deg, #ecfdf5, #f3f4f6); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; }
.dua-card__label { font-size: 12px; font-weight: 700; color: var(--brand-dark); margin-bottom: 6px; }
.dua-card__text { margin: 0; font-size: 16px; line-height: 1.9; color: var(--text); }

/* ===== Qibla card ===== */
.qibla-card { text-align: center; background: var(--bg); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.qibla-card__title { font-weight: 700; margin-bottom: 10px; }
.qibla-card__compass { font-size: 40px; display: inline-block; }
.qibla-card__needle { display: inline-block; transition: transform .3s; }
.qibla-card__deg { margin-top: 8px; color: var(--muted); font-size: 13px; }

/* ===== Adhan modal ===== */
.adhan-modal { border: none; border-radius: 16px; padding: 0; max-width: 340px; }
.adhan-modal::backdrop { background: rgba(0,0,0,.5); }
.adhan-modal__box { padding: 24px; text-align: center; }
.adhan-modal__dua { color: var(--muted); font-size: 14px; line-height: 1.9; margin: 10px 0 16px; }

/* ===== Offers widget/carousel ===== */
.offers-widget { background: #fffbeb; border: 1px solid #fde68a; border-radius: 14px; padding: 12px; margin-bottom: 16px; overflow: hidden; }
.offers-widget__head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.offers-widget__countdown { color: var(--danger); font-variant-numeric: tabular-nums; }
.offers-widget__track { position: relative; height: 70px; overflow: hidden; }
.offers-widget__item {
  position: absolute; inset: 0; opacity: 0; animation: slideUpFade calc(var(--offer-count, 1) * 4s) infinite;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0;
}
@keyframes slideUpFade {
  0%, 3% { opacity: 0; transform: translateY(12px); }
  6%, 20% { opacity: 1; transform: translateY(0); }
  23%, 100% { opacity: 0; transform: translateY(-12px); }
}
.offers-widget__name { font-weight: 700; font-size: 13px; }
.offers-widget__spec { font-size: 11px; color: var(--muted); }
.offers-widget__price { text-align: left; font-size: 13px; white-space: nowrap; }
.offers-widget__price s { color: var(--muted); font-size: 11px; margin-inline-end: 4px; }
.offers-widget__actions { display: flex; gap: 8px; margin-top: 8px; }
.offers-widget__actions .btn { flex: 1; padding: 8px; font-size: 13px; }

/* ===== Calendars ===== */
.calendar-nav { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--brand-dark); }
.day-cards { display: flex; flex-direction: column; gap: 8px; }
.day-card { background: var(--bg); border-radius: 12px; padding: 10px 14px; }
.day-card.is-today { background: #ecfdf5; border: 1px solid var(--brand); }
.day-card__head { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.day-card__num { background: var(--brand-dark); color: #fff; border-radius: 8px; padding: 2px 8px; font-size: 12px; }
.day-card__weekday { font-size: 13px; }
.day-card__watermark { margin-inline-start: auto; font-size: 11px; color: var(--muted); opacity: .6; }
.day-card__sub { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.day-card__prayers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 8px; }
.day-card__prayers div { text-align: center; font-size: 12px; }
.day-card__prayers strong { display: block; font-size: 13px; }

/* ===== Imsakia ===== */
.ramadan-countdown { text-align: center; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.ramadan-countdown__label { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.ramadan-countdown__timer { font-size: 24px; font-weight: 800; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.download-box { background: #ecfdf5; border: 1px dashed var(--brand); border-radius: 12px; padding: 14px; text-align: center; margin-bottom: 16px; }
.download-box p { margin: 0 0 10px; font-size: 13px; }
.imsakia-days { display: flex; flex-direction: column; gap: 8px; }
.imsakia-day { background: var(--bg); border-radius: 12px; padding: 10px 14px; }
.imsakia-day summary { cursor: pointer; list-style: none; }
.imsakia-day summary::-webkit-details-marker { display: none; }
.imsakia-day__num { font-weight: 700; color: var(--brand-dark); }
.imsakia-day__weekday { font-size: 12px; color: var(--muted); margin-inline-start: 8px; }
.imsakia-day__main { display: flex; gap: 16px; margin-top: 8px; }
.imsakia-day__main div { flex: 1; text-align: center; background: #fff; border-radius: 8px; padding: 8px; }
.imsakia-day__main span { display: block; font-size: 12px; color: var(--muted); }
.imsakia-day__main strong { font-size: 15px; }
.imsakia-day__full { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.imsakia-day__full div { text-align: center; font-size: 12px; }
.imsakia-day__full strong { display: block; font-size: 13px; }

/* ===== Locate-me page ===== */
.locate-box { text-align: center; background: var(--bg); border-radius: 16px; padding: 32px 16px; }
.locate-box__icon { font-size: 40px; margin-bottom: 12px; }
.locate-box__status { min-height: 20px; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.locate-box__fallback { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--brand-dark); font-weight: 600; }

/* ===== Date conversion ===== */
.date-form { display: flex; flex-direction: column; gap: 10px; }
.date-form select, .date-form input {
  padding: 10px; border-radius: 10px; border: 1px solid var(--border); font-family: inherit; font-size: 14px;
}
.date-form__row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.result-box { margin-top: 16px; background: #ecfdf5; border-radius: 12px; padding: 16px; text-align: center; }
.result-box__value { font-size: 22px; font-weight: 800; color: var(--brand-dark); }
.result-box__formatted { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ===== Offers page ===== */
.offers-list { display: flex; flex-direction: column; gap: 10px; }
.offer-item { border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.offer-item__img { width: 100%; max-height: 160px; object-fit: contain; border-radius: 8px; margin-bottom: 8px; background: var(--bg); }
.offer-item.is-featured { border-color: var(--brand); background: #ecfdf5; }
.offer-item__name { font-weight: 700; }
.offer-item__spec { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.offer-item__price { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.offer-item__price s { color: var(--muted); font-size: 12px; }
.offer-item__price strong { font-size: 16px; color: var(--brand-dark); }
.offer-item__discount { background: var(--danger); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 6px; }

@media (min-width: 480px) {
  .app-footer, .app-header { max-width: 480px; margin: 0 auto; }
}
