/* ===== الألوان والمتغيرات (مشتركة بين كل الواجهات) ===== */
:root {
  --radius: 20px;
  --radius-sm: 14px;
  --font: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sheet-visible: 300px;
}



* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  overscroll-behavior: none;
  transition: background .3s, color .3s;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }

.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.filled { fill: currentColor; stroke: none; }

/* ===== أزرار ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border-radius: 16px;
  font-weight: 700; font-size: 16px;
  transition: transform .15s var(--ease), background .2s, opacity .2s, box-shadow .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 6px 16px color-mix(in srgb, var(--c-gold) 30%, transparent); }
.btn.primary:hover { background: var(--brand-strong); }
.btn.ghost { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: var(--c-white); }
.btn.danger-ghost { background: var(--danger-soft); color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { min-height: 42px; font-size: 14px; border-radius: 12px; padding: 0 16px; }
.btn:disabled { opacity: .45; pointer-events: none; box-shadow: none; }
.btn + .btn.block { margin-top: 8px; }

.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); flex: none; transition: background .2s; }
.icon-btn:active { background: var(--surface-3); }
.icon-btn.sm { width: 38px; height: 38px; }
.icon-btn.danger { color: var(--danger); background: var(--danger-soft); }
.link-btn { color: var(--brand-strong); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:disabled { color: var(--muted); font-weight: 500; }
[data-theme="dark"] .link-btn:not(:disabled) { color: var(--brand); }

.input {
  width: 100%; border: 1.5px solid var(--border); background: var(--surface-2);
  border-radius: 14px; padding: 12px 14px; outline: none; transition: border-color .2s, background .2s; resize: none;
}
.input:focus { border-color: var(--brand); background: var(--surface); }

.spinner { width: 18px; height: 18px; border: 2.5px solid color-mix(in srgb, var(--c-black) 20%, transparent); border-top-color: currentColor; border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: middle; }
.spinner.dark { width: 14px; height: 14px; border-color: var(--border); border-top-color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== التنبيهات ===== */
.toast-root { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast {
  background: var(--text); color: var(--surface); padding: 12px 16px; border-radius: 14px;
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-12px) scale(.98); transition: all .3s var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast-success { background: var(--success); color: var(--c-white); }
.toast-warn { background: var(--c-amber-deep); color: var(--c-white); }

/* ===== النوافذ المنبثقة ===== */
.modal-wrap { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-end; justify-content: center; }
.modal-scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--c-black) 45%, transparent); opacity: 0; transition: opacity .25s; }
.modal {
  position: relative; width: 100%; max-width: 480px; max-height: 88vh; overflow: auto;
  background: var(--surface); border-radius: 24px 24px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .3s var(--ease);
}
.modal-wrap.open .modal-scrim { opacity: 1; }
.modal-wrap.open .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { font-size: 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
@media (min-width: 600px) {
  .modal-wrap { align-items: center; }
  .modal { border-radius: 24px; transform: translateY(24px) scale(.97); opacity: 0; transition: all .25s var(--ease); }
  .modal-wrap.open .modal { opacity: 1; }
}

/* ---------- تعدد اللغات ---------- */
/* إخفاء لحظي حتى تُترجم الواجهة (أقصى حد ثانيتان — انظر i18n.js) */
html.i18n-loading body { visibility: hidden; }
html[lang="ckb"] { --font: 'Noto Sans Arabic', 'Cairo', system-ui, sans-serif; }
html[dir="ltr"] .ic-dir { transform: scaleX(-1); }

/* خلفية الخريطة قبل ما تحمّل المربعات: كحلي بالليل حتى ما يطلع وميض أبيض */
.leaflet-container { background: var(--surface-2); }
[data-theme="dark"] .leaflet-container { background: var(--c-navy-900); }

/* ---------- الموقع الدقيق ---------- */
/* دائرة دقة الـ GPS حول نقطة المستخدم */
.leaflet-interactive.acc-circle, .acc-circle { fill: var(--c-blue-user); fill-opacity: .14; stroke: var(--c-blue-user); stroke-opacity: .55; }
.coords { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; color: var(--muted); letter-spacing: .2px; }
.coords.block { display: block; }
.loc-help { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; margin: 8px 0 4px; line-height: 1.7; font-size: 13.5px; }
.loc-help ol { margin: 4px 0 10px; padding-inline-start: 20px; }
.loc-help ol:last-child { margin-bottom: 0; }
