/* Dawaei — emerald pharmacy identity, Arabic RTL, mobile-first, system fonts */
:root {
  --emerald-900: #064e3b;
  --emerald-700: #047857;
  --emerald-600: #059669;
  --emerald-50: #ecfdf5;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #d1fae5;
  --card: #ffffff;
  --bg: #f0fdf4;
  --amber: #b45309;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  padding-bottom: 32px;
}

/* ---------- header ---------- */
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, var(--emerald-900), var(--emerald-600));
  color: #fff;
}
.app-logo {
  width: 56px; height: 56px;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.app-title h1 { margin: 0; font-size: 28px; line-height: 1.2; }
.app-title p { margin: 2px 0 0; font-size: 13px; opacity: .92; }

/* ---------- install hint ---------- */
.install-hint {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 12px 0; padding: 10px 12px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius);
  font-size: 14px;
}
.install-hint span { flex: 1; }
.install-hint button {
  border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer;
  background: var(--emerald-600); color: #fff; font-weight: 700;
}
#installClose { background: transparent; color: var(--muted); font-size: 15px; }

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 6px;
  padding: 12px 12px 0;
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
}
.tab {
  flex: 1;
  padding: 11px 4px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  font-size: 15px; font-weight: 700;
  color: var(--emerald-900);
  cursor: pointer;
}
.tab.active { background: var(--emerald-700); color: #fff; border-color: var(--emerald-700); }

/* ---------- layout ---------- */
main { padding: 12px; max-width: 640px; margin: 0 auto; }
.section { display: none; }
.section.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(6, 78, 59, .05);
}
.card h2 { margin: 0 0 6px; font-size: 19px; }

.section-title {
  font-size: 18px; margin: 18px 2px 10px;
  display: flex; align-items: center; gap: 8px;
}
.window-chip {
  font-size: 12px; font-weight: 700; color: var(--emerald-700);
  background: var(--emerald-50); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 999px; direction: ltr;
}

.meta { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.source-note { margin-top: 14px; }
.duty-status { font-weight: 700; color: var(--emerald-700); margin: 8px 0 0; font-size: 14px; }

/* ---------- forms ---------- */
.field-label { display: block; font-weight: 700; font-size: 14px; margin: 10px 0 4px; }
.input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  font-size: 16px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
.input:focus { outline: 2px solid var(--emerald-600); outline-offset: 1px; }

.btn {
  display: inline-block;
  border: 0; border-radius: 10px;
  padding: 11px 18px;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  text-align: center;
}
.btn.primary { background: var(--emerald-700); color: #fff; width: 100%; margin-top: 14px; }
.btn.call { background: var(--emerald-600); color: #fff; }
.btn.dir { background: #fff; color: var(--emerald-700); border: 1px solid var(--emerald-600); }
.btn.small { padding: 7px 12px; font-size: 13px; width: auto; margin-top: 8px; }
.form-msg { font-size: 14px; margin: 8px 0 0; min-height: 1.2em; }
.form-msg.ok { color: var(--emerald-700); font-weight: 700; }
.form-msg.err { color: #b91c1c; font-weight: 700; }

/* ---------- pharmacy cards ---------- */
.pharmacy-list, .board-list { display: grid; gap: 10px; }
.pharmacy-card {
  background: #fff;
  border: 1px solid var(--line);
  border-inline-start: 5px solid var(--emerald-600);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.pharmacy-card.open { border-inline-start-color: #16a34a; background: #f0fdf4; }
.pharmacy-card h3 { margin: 0 0 2px; font-size: 16px; }
.pharmacy-card .commune { color: var(--emerald-700); font-weight: 700; font-size: 13px; }
.pharmacy-card .address { color: #334155; font-size: 14px; margin: 2px 0; }
.pharmacy-card .hours { color: var(--muted); font-size: 13px; direction: ltr; text-align: end; unicode-bidi: embed; }
.badge-open {
  display: inline-block; background: #16a34a; color: #fff;
  font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px;
  vertical-align: middle;
}
.card-actions { display: flex; gap: 8px; margin-top: 10px; }
.card-actions .btn { flex: 1; }
.empty-note {
  background: #fff; border: 1px dashed #a7f3d0; border-radius: var(--radius);
  padding: 14px; color: var(--muted); font-size: 14px; text-align: center;
}

/* ---------- uncovered ---------- */
.uncovered { text-align: center; padding: 24px 16px; }
.uncovered-icon { font-size: 40px; }
.uncovered h2 { color: var(--amber); }

/* ---------- ad slots ---------- */
.featured-slot, .banner-slot {
  border-radius: var(--radius);
  padding: 14px;
  margin: 12px 0;
  display: grid; gap: 2px;
  position: relative;
}
.featured-slot { background: linear-gradient(135deg, #fef3c7, #fde68a); border: 1px solid #f59e0b; }
.banner-slot { background: #e0f2fe; border: 1px solid #38bdf8; margin-top: 16px; }
.slot-tag {
  justify-self: start;
  font-size: 11px; font-weight: 800;
  background: rgba(0,0,0,.65); color: #fff;
  padding: 2px 8px; border-radius: 999px;
}
.slot-sub { font-size: 12px; color: #475569; }

/* ---------- board ---------- */
.board-card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.board-card h3 { margin: 0; font-size: 16px; }
.board-card .where { color: var(--emerald-700); font-weight: 700; font-size: 13px; }
.board-card .when { color: var(--muted); font-size: 12px; }
.response {
  background: var(--emerald-50); border-radius: 10px;
  padding: 8px 10px; margin-top: 8px; font-size: 14px;
}
.response strong { color: var(--emerald-900); }
.respond-form { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.respond-form .input { margin-bottom: 8px; }

/* ---------- popup ---------- */
/* The hidden attribute must always win over author display rules
   (the popup overlay uses display:flex, which otherwise overrides it). */
[hidden] { display: none !important; }

.popup-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(2, 44, 34, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.popup-card {
  background: #fff; border-radius: 20px;
  max-width: 340px; width: 100%;
  padding: 22px 18px 18px;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.popup-close {
  position: absolute; top: 10px; inset-inline-start: 10px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff;
  font-size: 16px; cursor: pointer; line-height: 1;
}
.popup-card .slot-tag { justify-self: center; }
.popup-emoji { font-size: 52px; margin: 8px 0 2px; }
.popup-card h3 { margin: 4px 0; font-size: 20px; }
.popup-card p { color: #334155; font-size: 14px; margin: 4px 0 6px; }

/* ---------- footer ---------- */
.app-footer {
  max-width: 640px; margin: 8px auto 0; padding: 0 16px;
  color: var(--muted); font-size: 12px; text-align: center;
}
