/* ==========================================================================
   Fazaa Rescue PWA — mobile-first styles. EN default, RTL via [dir=rtl].
   Palette derived from the logo (B.6): red #d63a2f, green #2f9e44.
   ========================================================================== */
:root {
  --red: #d63a2f;
  --red-dark: #b02a20;
  --green: #2f9e44;
  --ink: #1c1917;
  --muted: #6b7280;
  --bg: #f7f5f2;
  --card: #ffffff;
  --line: #e5e1db;
  --warn: #b45309;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(28, 25, 23, .08), 0 4px 14px rgba(28, 25, 23, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Kufi Arabic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}
[dir="rtl"] body { font-family: "Noto Kufi Arabic", "Segoe UI", Roboto, -apple-system, sans-serif; }

/* ---------- header ---------- */
#topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  color: #fff;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo-chip {
  width: 44px; height: 44px; border-radius: 50%;
  background: #fff;                     /* white rounded container (B.6) */
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex: 0 0 44px;
}
.logo-chip img { width: 92%; height: 92%; object-fit: contain; }
.site-name { font-weight: 800; font-size: 17px; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-sub { font-size: 11.5px; opacity: .85; }
.top-actions { flex: 0 0 auto; }
#lang-toggle { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.35); }

/* ---------- buttons / forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 12px;
  padding: 13px 18px; font-size: 16px; font-weight: 700;
  cursor: pointer; text-decoration: none;
  background: var(--red); color: #fff;
  min-height: 48px; /* touch target */
  transition: transform .05s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--red); border: 1.5px solid var(--red); }
.btn.ghost { background: transparent; color: var(--red); border: 1.5px solid var(--line); }
.btn.green { background: var(--green); }
.btn.small { padding: 8px 12px; font-size: 14px; min-height: 38px; border-radius: 9px; }
.btn.block { width: 100%; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin: 10px 0;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 10px; font-size: 17px; }
.card h3 { margin: 14px 0 6px; font-size: 15px; }

label { display: block; font-size: 13.5px; font-weight: 700; color: var(--muted); margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; padding: 12px; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink);
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); border-color: transparent; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.err { color: var(--red); font-size: 13.5px; font-weight: 600; }
.ok { color: var(--green); font-size: 13.5px; font-weight: 600; }

/* ---------- layout ---------- */
#view { max-width: 560px; margin: 0 auto; padding: 12px 14px 40px; }
.section-title { font-size: 20px; font-weight: 800; margin: 14px 2px 4px; }
.hero { text-align: center; padding: 22px 8px 10px; }
.hero .logo-chip { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 12px; background: #fff; box-shadow: var(--shadow); display:flex; align-items:center; justify-content:center; }
.hero .logo-chip img { width: 92%; height: 92%; object-fit: contain; }
.emergency {
  margin: 12px auto; max-width: 420px;
  background: #fff4f2; border: 1.5px dashed var(--red); border-radius: 12px;
  padding: 10px 12px; font-size: 14px;
}
.emergency a { color: var(--red); font-weight: 800; text-decoration: none; white-space: nowrap; }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.menu-grid .btn { flex-direction: column; gap: 4px; padding: 18px 8px; font-size: 15px; }
.menu-grid .btn small { font-weight: 500; opacity: .85; font-size: 12px; }

/* ---------- map ---------- */
.map { width: 100%; height: 280px; border-radius: 12px; border: 1.5px solid var(--line); z-index: 0; }
.map.tall { height: 340px; }
.map-note { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- status timeline ---------- */
.timeline { list-style: none; margin: 12px 0 0; padding: 0; }
.timeline li {
  position: relative; padding: 0 0 14px 22px; font-size: 14px;
  border-left: 2px solid var(--line);
}
[dir="rtl"] .timeline li { border-left: none; border-right: 2px solid var(--line); padding: 0 22px 14px 0; }
.timeline li:last-child { border-color: transparent; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 3px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--green);
}
[dir="rtl"] .timeline li::before { left: auto; right: -6px; }
.timeline .t-time { color: var(--muted); font-size: 12px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.badge.red { background: #fdecea; color: var(--red); }
.badge.green { background: #e8f5ec; color: var(--green); }
.badge.amber { background: #fdf1e2; color: var(--warn); }
.badge.gray { background: #f1f0ed; color: var(--muted); }

.status-strip { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip {
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: #f1f0ed; color: var(--muted); border: 1px solid var(--line);
}
.chip.active { background: var(--green); color: #fff; border-color: var(--green); }

/* ---------- star rating ---------- */
.stars { display: flex; gap: 4px; font-size: 30px; }
.stars button { background: none; border: none; cursor: pointer; font-size: 30px; color: #d6d3d1; padding: 2px; }
.stars button.on { color: #f59e0b; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: #1c1917; color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; z-index: 2000; max-width: 92vw;
  box-shadow: var(--shadow);
}
.toast.error { background: var(--red); }
.toast.hidden { display: none; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.tabs .btn { flex: 1 0 auto; padding: 9px 14px; font-size: 14px; min-height: 40px; }
table.report { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.report th, table.report td { text-align: start; padding: 7px 6px; border-bottom: 1px solid var(--line); }
table.report th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row .grow { flex: 1; min-width: 0; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }

/* dark mode support (header logo always on white chip) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161412; --card: #211e1a; --ink: #f3f0ea;
    --line: #3a352e; --muted: #a8a29e;
  }
  input, select, textarea { background: #2a2621; color: var(--ink); border-color: #3a352e; }
  .chip { background: #2a2621; color: #d6d3d1; }
  .emergency { background: #33130f; }
}

/* small screens */
@media (max-width: 380px) {
  .menu-grid { grid-template-columns: 1fr; }
  .site-name { font-size: 15px; }
}
