/* ══════════════════════════════════════════════════════
   SafarCircle — Mobile-First App Styles
   Palette:
     Primary:    #1B5E87  (deep teal)
     Gold:       #D4A853
     Accent:     #2E8B57  (green)
     Background: #0A0E1A
     Surface:    #141824
     Card:       #1E2435
     Border:     #2A3352
     Text:       #F0F4FF
     Muted:      #7A8BA8
══════════════════════════════════════════════════════ */

/* ─── Reset & Base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:    #1B5E87;
  --primary-lt: #2577AB;
  --gold:       #D4A853;
  --gold-dk:    #B8872E;
  --accent:     #2E8B57;
  --bg:         #0A0E1A;
  --surface:    #141824;
  --card:       #1E2435;
  --border:     #2A3352;
  --text:       #F0F4FF;
  --muted:      #7A8BA8;
  --danger:     #E74C3C;
  --success:    #27AE60;
  --radius:     14px;
  --radius-sm:  8px;
  --nav-h:      70px;
  --top-h:      56px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-total-h: calc(var(--nav-h) + var(--safe-bottom));
  --shadow:     0 4px 24px rgba(0,0,0,0.45);
  --transition: 0.2s ease;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: 'Amiri', serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  margin: 0;
  padding: 0;
}

/* ─── Islamic Geometric Pattern ─────────────────────── */
.geo-pattern {
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(60deg, transparent, transparent 20px, rgba(212,168,83,0.04) 20px, rgba(212,168,83,0.04) 21px),
    repeating-linear-gradient(-60deg, transparent, transparent 20px, rgba(212,168,83,0.04) 20px, rgba(212,168,83,0.04) 21px),
    repeating-linear-gradient(0deg, transparent, transparent 20px, rgba(27,94,135,0.06) 20px, rgba(27,94,135,0.06) 21px);
  pointer-events: none;
}

/* ─── Screen System ─────────────────────────────────── */
.screen {
  position: fixed; inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
  z-index: 10;
  overflow: hidden;
}
#screen-splash,
#screen-login,
#screen-register,
#screen-forgot-password {
  z-index: 100;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
.screen.screen-active { display: flex; }

/* ─── SPLASH ────────────────────────────────────────── */
.splash-bg {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(160deg, #0D1526 0%, #0A0E1A 50%, #091220 100%);
}

.splash-content {
  text-align: center;
  padding: 2rem;
  z-index: 2;
}
.splash-logo { margin-bottom: 1.2rem;
  animation: scLogoReveal 0.9s cubic-bezier(0.22,1,0.36,1) 0.05s both; }
.splash-title {
  font-family: 'Amiri', serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.02em;
  text-shadow: 0 0 40px rgba(212,168,83,0.3);
  animation: scSlideUp 0.65s cubic-bezier(0.22,1,0.36,1) 0.65s both;
}
.arabic-sub {
  font-family: 'Amiri', serif;
  font-size: 1.2rem;
  color: var(--primary-lt);
  margin: 0.4rem 0;
  animation: scFadeUp 0.5s ease 1.05s both;
}
.splash-sub { color: var(--muted); font-size: 0.9rem; margin-top: 0.3rem;
  animation: scFadeUp 0.5s ease 1.25s both; }

.onboarding {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, var(--surface) 70%, transparent);
  padding: 1.5rem 1.5rem 2.5rem;
  z-index: 3;
  animation: scPanelReveal 0.75s cubic-bezier(0.22,1,0.36,1) 0.2s both;
}

/* ── Splash / intro keyframes ──────────────────────── */
@keyframes scLogoReveal {
  0%   { opacity: 0; transform: scale(0.55) translateY(8px); }
  75%  { transform: scale(1.04) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes scSlideUp {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scPanelReveal {
  from { opacity: 0; transform: translateY(110%); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Compass ring slow rotation (logo) ─────────────── */
@keyframes scCompassSpin { to { transform: rotate(360deg); } }
.sc-compass-ring {
  transform-origin: 48px 48px;
  animation: scCompassSpin 80s linear infinite;
}
.onboarding-slides { overflow: hidden; }
.onboarding-slide { display: none; }
.onboarding-slide.active { display: block; }
.slide-img {
  width: 100%; height: 200px;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  margin-bottom: 1.2rem;
  border: 1px solid var(--border);
}
.onboarding-slide h2 {
  font-size: 1.4rem; font-weight: 700;
  color: var(--text); margin-bottom: 0.5rem;
}
.onboarding-slide p { color: var(--muted); font-size: 0.9rem; line-height: 1.6; }

.onboarding-dots {
  display: flex; gap: 6px; justify-content: center;
  margin: 1rem 0 1.2rem;
}
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border);
  transition: background var(--transition), width var(--transition);
}
.dot.active { background: var(--gold); width: 20px; border-radius: 3px; }

/* ─── AUTH ──────────────────────────────────────────── */
.auth-wrap {
  flex: 1; display: flex; flex-direction: column;
  overflow-y: auto; padding-bottom: 2rem;
}
.auth-header {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.auth-logo { flex: 1; display: flex; align-items: center; }
.auth-logo svg { width: 38px; height: 38px; display: block; }
.auth-body { padding: 1.5rem 1.5rem; flex: 1; }
.auth-body h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.3rem; }

.step-progress {
  padding: 0.75rem 1.5rem 0;
  display: flex; align-items: center; gap: 0.75rem;
}
.step-bar {
  flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden;
}
.step-fill {
  height: 100%; background: var(--gold); border-radius: 2px;
  transition: width 0.4s ease;
  width: 33%;
}
.step-label { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }

.reg-step { }
.reg-step.hidden { display: none; }

.success-icon { margin: 2rem auto 1rem; width: 80px; height: 80px; }
.text-center { text-align: center; }
.text-center p { margin: 0.75rem 0 1.5rem; }

/* ─── FORMS ─────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.2rem; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.field input,
.field select,
.field textarea {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Amiri', serif;
  font-size: 0.95rem;
  padding: 0.75rem 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  -webkit-appearance: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,94,135,0.2);
}
.field textarea { resize: vertical; min-height: 80px; }
.field select { cursor: pointer; }

.field-row { display: flex; align-items: center; justify-content: space-between; }
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.input-eye { position: relative; }
.input-eye input { padding-right: 3rem; }
.eye-btn {
  position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 0.25rem;
}
.eye-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

.pwd-strength { margin-top: 0.4rem; display: flex; align-items: center; gap: 0.5rem; }
.pwd-bar { flex: 1; height: 3px; background: var(--border); border-radius: 2px; }
.pwd-fill { height: 100%; border-radius: 2px; transition: width 0.3s, background 0.3s; width: 0%; }
#pwdStrengthLabel { font-size: 0.75rem; color: var(--muted); }

.gender-select { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.gender-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 1rem;
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius);
  color: var(--muted); cursor: pointer; transition: all var(--transition);
  font-size: 0.88rem; font-weight: 600;
}
.gender-btn svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.gender-btn.selected { border-color: var(--gold); color: var(--gold); background: rgba(212,168,83,0.1); }

.check-label {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.88rem; color: var(--muted); cursor: pointer;
}
.check-label input[type="checkbox"] { accent-color: var(--gold); width: 16px; height: 16px; }
.check-field { display: flex; flex-wrap: wrap; gap: 1rem; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

.form-error {
  background: rgba(231,76,60,0.1);
  border: 1px solid rgba(231,76,60,0.3);
  border-radius: var(--radius-sm);
  color: #E74C3C;
  font-size: 0.85rem;
  padding: 0.6rem 0.9rem;
}
.form-success {
  background: rgba(39,174,96,0.1);
  border: 1px solid rgba(39,174,96,0.3);
  border-radius: var(--radius-sm);
  color: #27AE60;
  font-size: 0.85rem;
  padding: 0.6rem 0.9rem;
}

.auth-divider {
  display: flex; align-items: center; gap: 1rem; margin: 0.5rem 0;
  color: var(--muted); font-size: 0.82rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ─── FORM ELEMENTS — ensure Amiri everywhere ───────── */
input, select, textarea, button { font-family: 'Amiri', serif; }

/* ─── BUTTONS ───────────────────────────────────────── */
button { cursor: pointer; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-lt) 100%);
  border: none; border-radius: var(--radius-sm);
  color: white; font-size: 0.95rem; font-weight: 600;
  padding: 0.85rem 1.5rem;
  transition: all var(--transition);
  position: relative; overflow: hidden;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(0.98); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dk) 100%);
  border: none; border-radius: var(--radius-sm);
  color: #0A0E1A; font-size: 0.95rem; font-weight: 700;
  padding: 0.85rem 1.5rem;
  transition: all var(--transition);
}
.btn-gold:active { transform: scale(0.98); }

.btn-gold-sm {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dk) 100%);
  border: none; border-radius: 20px;
  color: #0A0E1A; font-size: 0.78rem; font-weight: 700;
  padding: 0.35rem 0.9rem;
  white-space: nowrap;
}

.btn-outline-sm {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  white-space: nowrap;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.95rem; font-weight: 500;
  padding: 0.85rem 1.5rem;
  transition: all var(--transition);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary-lt); }

.btn-ghost {
  background: transparent; border: none;
  color: var(--muted); font-size: 0.88rem;
  padding: 0.75rem;
  transition: color var(--transition);
}
.btn-ghost:hover { color: var(--text); }

.btn-danger {
  background: var(--danger); border: none; border-radius: var(--radius-sm);
  color: white; font-size: 0.95rem; font-weight: 600;
  padding: 0.85rem 1.5rem;
}

.btn-full { width: 100%; }
.btn-icon {
  background: none; border: none;
  color: var(--text); padding: 0.5rem;
  display: flex; align-items: center; justify-content: center;
}
.btn-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.link-btn {
  background: none; border: none;
  color: var(--gold); font-size: 0.85rem; font-weight: 500;
}
.link-btn:hover { text-decoration: underline; }

.btn-text { display: block; }
.btn-loader { display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; margin: auto; }
.loading .btn-text { display: none; }
.loading .btn-loader { display: block; }

/* ─── APP SHELL ─────────────────────────────────────── */
#screen-app {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  position: relative;
}

.top-bar {
  height: calc(var(--top-h) + var(--safe-top));
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--safe-top) 0.75rem 0;
  background: rgba(10,14,26,0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative; z-index: 20;
  flex-shrink: 0;
}
.top-left { display: flex; align-items: center; gap: 0.5rem; }
.top-logo { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.top-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 0.95rem; font-weight: 600; color: var(--text);
  pointer-events: none; white-space: nowrap;
}
.top-right { display: flex; align-items: center; gap: 0.25rem; }

.logo-text { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.gold { color: var(--gold); }

.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--danger); color: white;
  font-size: 0.6rem; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
}

.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--border);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.avatar-sm svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 1.5; }
.avatar-sm img { width: 100%; height: 100%; object-fit: cover; }

/* ─── PANELS ────────────────────────────────────────── */
.app-main {
  flex: 1;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.panel.active { 
  display: flex;
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding: 1rem 1rem calc(var(--nav-total-h) + 4rem);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  position: relative;
  /* Improve touch scrolling */
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  scroll-padding-bottom: calc(var(--nav-total-h) + 2rem);
}

/* ─── MAP ───────────────────────────────────────────── */
#panel-map { background: #0D1626; }
#leafletMap { position: absolute; inset: 0; z-index: 1; }

.map-overlay-top {
  position: absolute; top: 0.75rem; left: 0.75rem; right: 0.75rem;
  z-index: 10; display: flex; flex-direction: column; gap: 0.5rem;
}
.map-search-wrap { position: relative; }
.map-search {
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(20,24,36,0.95); border: 1px solid var(--border);
  border-radius: 25px; padding: 0.5rem 1rem;
  backdrop-filter: blur(12px);
}
.map-search input {
  flex: 1; background: none; border: none; color: var(--text);
  font-size: 0.9rem; outline: none;
}
.search-icon { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2; flex-shrink: 0; }

.map-search-results {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  background: rgba(13, 22, 38, 0.98);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  max-height: 240px;
  overflow-y: auto;
  z-index: 15;
}
.map-search-result {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.map-search-result:last-child { border-bottom: 0; }
.map-search-result:hover { background: rgba(255,255,255,0.04); }
.map-search-result-title { display: block; font-size: 0.88rem; line-height: 1.35; }

.map-filters {
  display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none;
}
.map-filters::-webkit-scrollbar { display: none; }

.filter-pill {
  background: rgba(20,24,36,0.9); border: 1px solid var(--border);
  border-radius: 20px; color: var(--muted);
  font-size: 0.78rem; font-weight: 600;
  padding: 0.3rem 0.8rem; white-space: nowrap;
  transition: all var(--transition);
  backdrop-filter: blur(8px);
}
.filter-pill.active {
  background: var(--primary); border-color: var(--primary); color: white;
}

.map-fab {
  position: absolute; z-index: 10;
  border: none; border-radius: 50%;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}
.map-fab:active { transform: scale(0.93); }
.map-fab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; }
.fab-primary { background: var(--gold); color: #0A0E1A; bottom: calc(var(--nav-total-h) + 1rem); right: 1rem; }
.fab-secondary { background: var(--surface); border: 1px solid var(--border); color: var(--text); bottom: calc(var(--nav-total-h) + 4.5rem); right: 1rem; }

/* ─── RADIAL FAB MENU ───────────────────────────────── */
.fab-backdrop {
  position: fixed; inset: 0; z-index: 198;
  background: rgba(0,0,0,0); pointer-events: none;
  transition: background 0.25s;
}
.fab-backdrop.fab-backdrop-show {
  background: rgba(0,0,0,0.45); pointer-events: auto;
}

.fab-radial-wrap {
  position: fixed;
  bottom: calc(var(--nav-total-h) + 1rem);
  right: 1rem;
  width: 52px; height: 52px;
  z-index: 200;
}

/* Main toggle button sits inside the wrap */
.fab-radial-wrap .fab-toggle {
  position: absolute; inset: 0;
  width: 52px; height: 52px;
  z-index: 201;
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1);
}
.fab-radial-wrap.fab-open .fab-toggle {
  transform: rotate(45deg) scale(1.07);
}

/* Radial item base — collapsed at FAB center */
.fab-radial-item {
  position: absolute;
  top: 50%; left: 50%;
  width: 52px; height: 52px;
  margin-top: -26px; margin-left: -26px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px;
  cursor: pointer;
  transform: scale(0); opacity: 0;
  transition: transform 0.32s cubic-bezier(.34,1.56,.64,1),
              opacity 0.22s ease;
  pointer-events: none;
  z-index: 200;
}
.fab-radial-item .fri-emoji { font-size: 18px; line-height: 1; }
.fab-radial-item .fri-label {
  font-size: 7px; font-weight: 700;
  color: var(--muted); letter-spacing: 0.03em;
  text-transform: uppercase; line-height: 1;
}
.fab-radial-item:active { filter: brightness(0.9); }

/* Expanded positions — r=215px, 15° spacing, 90°→180° (7 items)
   chord = 2×215×sin(7.5°) = 56px  >  52px circle → 4px gap between edges */
.fab-radial-wrap.fab-open .fab-radial-item { transform: scale(1); opacity: 1; pointer-events: auto; }
.fab-radial-wrap.fab-open .fab-radial-item:nth-child(1) {
  transform: translate(0px, -215px) scale(1); transition-delay: 0.00s;
}
.fab-radial-wrap.fab-open .fab-radial-item:nth-child(2) {
  transform: translate(-56px, -208px) scale(1); transition-delay: 0.03s;
}
.fab-radial-wrap.fab-open .fab-radial-item:nth-child(3) {
  transform: translate(-108px, -186px) scale(1); transition-delay: 0.06s;
}
.fab-radial-wrap.fab-open .fab-radial-item:nth-child(4) {
  transform: translate(-152px, -152px) scale(1); transition-delay: 0.09s;
}
.fab-radial-wrap.fab-open .fab-radial-item:nth-child(5) {
  transform: translate(-186px, -108px) scale(1); transition-delay: 0.12s;
}
.fab-radial-wrap.fab-open .fab-radial-item:nth-child(6) {
  transform: translate(-208px, -56px) scale(1); transition-delay: 0.15s;
}
.fab-radial-wrap.fab-open .fab-radial-item:nth-child(7) {
  transform: translate(-215px, 0px) scale(1); transition-delay: 0.18s;
}

/* Custom (last) item gets gold tint */
.fab-radial-item.fri-custom { border-color: var(--gold); }
.fab-radial-item.fri-custom .fri-label { color: var(--gold); }

/* ─── QUICK CREATE BOTTOM SHEET ─────────────────────── */
.qc-modal {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: flex-end;
  background: rgba(0,0,0,0);
  transition: background 0.25s;
  pointer-events: none;
}
.qc-modal:not(.hidden) { pointer-events: auto; }
.qc-modal.qc-modal-show { background: rgba(0,0,0,0.5); }

.qc-sheet {
  width: 100%; max-width: 480px; margin: 0 auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 0 0 calc(var(--safe-bottom, 0px) + 1rem);
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(.32,1.25,.64,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.35);
  max-height: 92dvh;
  overflow-y: auto;
}
.qc-modal.qc-modal-show .qc-sheet { transform: translateY(0); }

/* drag handle */
.qc-sheet::before {
  content: '';
  display: block;
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 8px;
}

.qc-header {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 1.2rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.qc-cat-badge {
  background: var(--primary-lt); color: var(--primary);
  border-radius: 20px; padding: 4px 12px;
  font-size: 0.92rem; font-weight: 700;
  flex-shrink: 0;
}
.qc-header h3 {
  flex: 1; font-size: 1.05rem; font-weight: 700;
  color: var(--text); margin: 0;
}
.qc-close {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 50%; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; color: var(--muted); flex-shrink: 0;
}

.qc-body {
  padding: 1rem 1.2rem;
  display: flex; flex-direction: column; gap: 0.85rem;
}
.qc-body .field-label {
  font-size: 0.78rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
  display: block; margin-bottom: 5px;
}
.qc-body input[type="text"],
.qc-body input[type="datetime-local"] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  padding: 0.7rem 0.9rem;
  outline: none;
  -webkit-appearance: none;
  transition: border-color var(--transition);
}
.qc-body input:focus { border-color: var(--primary); }

/* Who joins pill row */
.qc-who-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.qc-who-btn {
  flex: 1 1 auto;
  padding: 0.5rem 0.7rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem; font-weight: 600;
  transition: all 0.18s;
}
.qc-who-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Max people stepper */
.qc-stepper {
  display: flex; align-items: center; gap: 1rem;
}
.qc-step-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--text); font-size: 1.3rem; font-weight: 400;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.qc-step-btn:active { background: var(--primary); color: #fff; border-color: var(--primary); }
#qcMaxVal { font-size: 1.2rem; font-weight: 700; color: var(--text); min-width: 2rem; text-align: center; }

.btn-full { width: 100%; }

/* ─── LEAFLET OVERRIDE ──────────────────────────────── */
.leaflet-popup-content-wrapper {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  box-shadow: var(--shadow);
}
.leaflet-popup-tip { background: var(--card); }
.leaflet-popup-content { margin: 0.75rem 1rem; }
.leaflet-control-zoom a {
  background: var(--card) !important; color: var(--text) !important;
  border-color: var(--border) !important;
}

/* ─── CARDS & LISTS ─────────────────────────────────── */
.card-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.75rem; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  cursor: pointer; transition: all var(--transition);
  position: relative; overflow: hidden;
}
.card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--primary);
  transform: scaleY(0); transform-origin: bottom;
  transition: transform var(--transition);
}
.card:active { transform: scale(0.98); background: #222840; }
.card:hover::before { transform: scaleY(1); }

.card-top { display: flex; align-items: flex-start; gap: 0.75rem; }
.card-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: rgba(27,94,135,0.2); border: 1px solid rgba(27,94,135,0.3);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 1.2rem;
}
.card-body { flex: 1; min-width: 0; }
.card-title { font-size: 0.95rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }

.badge {
  font-size: 0.7rem; font-weight: 600;
  padding: 0.15rem 0.5rem; border-radius: 20px;
  white-space: nowrap;
}
.badge-halal { background: rgba(46,139,87,0.2); color: #2E8B57; border: 1px solid rgba(46,139,87,0.3); }
.badge-prayer { background: rgba(27,94,135,0.2); color: var(--primary-lt); border: 1px solid rgba(27,94,135,0.3); }
.badge-women { background: rgba(180,60,150,0.15); color: #DA70D6; border: 1px solid rgba(180,60,150,0.2); }
.badge-gold { background: rgba(212,168,83,0.15); color: var(--gold); border: 1px solid rgba(212,168,83,0.2); }
.badge-danger { background: rgba(231,76,60,0.15); color: var(--danger); border: 1px solid rgba(231,76,60,0.2); }

.card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 0.75rem; }
.card-distance { font-size: 0.75rem; color: var(--gold); font-weight: 600; }
.card-time { font-size: 0.75rem; color: var(--muted); }

.message-group { margin-bottom: 1rem; }
.message-group-title {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0.25rem 0 0.5rem;
}

.salah-location {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}
.salah-location-label {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
}
.salah-location-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.salah-location-row input {
  flex: 1 1 220px;
  background: rgba(20,24,36,0.95);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.85rem;
  padding: 0.7rem 0.95rem;
  outline: none;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  cursor: text;
  pointer-events: auto;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.salah-location-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,94,135,0.2);
}
.salah-location-row input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.salah-location-row input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

/* Rating */
.stars { color: var(--gold); font-size: 0.75rem; letter-spacing: 1px; }
.rating-text { font-size: 0.75rem; color: var(--muted); }

/* ─── SECTION HEADERS ───────────────────────────────── */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.section-head h2, .section-head h3 { font-size: 1.2rem; font-weight: 700; }

/* ─── FILTERS ───────────────────────────────────────── */
.filter-row {
  display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.25rem 0 0.5rem;
  scrollbar-width: none; margin-bottom: 0.5rem;
}
.filter-row::-webkit-scrollbar { display: none; }

.pill {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; color: var(--muted);
  font-size: 0.78rem; font-weight: 600;
  padding: 0.3rem 0.8rem; white-space: nowrap;
  transition: all var(--transition);
}
.pill.active { background: var(--primary); border-color: var(--primary); color: white; }

.filter-tags { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.4rem; scrollbar-width: none; }
.filter-tags::-webkit-scrollbar { display: none; }
.tag-btn {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; color: var(--muted);
  font-size: 0.72rem; padding: 0.25rem 0.65rem; white-space: nowrap;
  transition: all var(--transition);
}
.tag-btn.active { background: rgba(212,168,83,0.15); border-color: var(--gold); color: var(--gold); }

/* ─── SEARCH BAR ────────────────────────────────────── */
.search-bar-inline {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 25px; padding: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.search-bar-inline input {
  flex: 1; background: none; border: none; color: var(--text);
  font-size: 0.9rem; outline: none;
}
.search-icon-sm { width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 2; flex-shrink: 0; }

/* ─── SALAH ─────────────────────────────────────────── */
.salah-hero {
  background: linear-gradient(135deg, #0D1F35 0%, #0A0E1A 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  text-align: center;
  position: relative;
  z-index: 1;
}
.salah-date { font-size: 0.85rem; color: var(--muted); }
.salah-hijri { font-family: 'Amiri', serif; font-size: 1rem; color: var(--gold); margin: 0.25rem 0; }
.next-prayer-card {
  background: rgba(27,94,135,0.15); border: 1px solid rgba(27,94,135,0.3);
  border-radius: var(--radius-sm); padding: 1rem; margin-top: 1rem;
}
.next-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.next-name { font-size: 1.8rem; font-weight: 700; color: var(--gold); font-family: 'Amiri', serif; margin: 0.25rem 0; }
.next-time { font-size: 2.2rem; font-weight: 300; color: var(--text); }
.countdown { font-size: 0.85rem; color: var(--muted); margin-top: 0.3rem; }

.prayer-times-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
  margin-bottom: 1rem;
}
.prayer-time-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.75rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
}
.prayer-time-item.current { border-color: var(--gold); background: rgba(212,168,83,0.08); }
.prayer-name { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.prayer-time { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.prayer-time-item.current .prayer-time { color: var(--gold); }

.salah-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.salah-btn {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 0.75rem; font-size: 0.82rem; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  transition: all var(--transition);
}
.salah-btn:active { background: var(--surface); }
.salah-btn svg { width: 24px; height: 24px; stroke: var(--gold); fill: none; stroke-width: 1.5; }

/* ─── AI BANNER ─────────────────────────────────────── */
.ai-banner {
  display: flex; align-items: center; gap: 0.75rem;
  background: linear-gradient(135deg, rgba(27,94,135,0.2) 0%, rgba(46,139,87,0.1) 100%);
  border: 1px solid rgba(27,94,135,0.3);
  border-radius: var(--radius); padding: 0.875rem;
  margin-bottom: 1rem;
}
.ai-icon { width: 28px; height: 28px; stroke: var(--gold); fill: none; stroke-width: 1.5; flex-shrink: 0; }
.ai-banner-title { font-size: 0.88rem; font-weight: 700; color: var(--gold); }
.ai-banner-sub { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

/* ─── INTERESTS ─────────────────────────────────────── */
.interests-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 0.5rem; }
.interest-btn {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--muted);
  font-size: 0.72rem; padding: 0.5rem 0.25rem;
  text-align: center; transition: all var(--transition); line-height: 1.4;
}
.interest-btn.selected { border-color: var(--gold); color: var(--gold); background: rgba(212,168,83,0.1); }

/* ─── MATCHES ───────────────────────────────────────── */
.matches-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 0.75rem; }
.match-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; text-align: center;
  cursor: pointer; transition: all var(--transition);
}
.match-card:active { transform: scale(0.97); }
.match-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border);
  margin: 0 auto 0.5rem; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.match-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.match-style { font-size: 0.72rem; color: var(--muted); }
.match-score {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: rgba(212,168,83,0.1); border: 1px solid rgba(212,168,83,0.2);
  border-radius: 20px; padding: 0.15rem 0.5rem;
  font-size: 0.7rem; font-weight: 700; color: var(--gold);
  margin: 0.4rem 0;
}
.match-actions { display: flex; gap: 0.4rem; margin-top: 0.6rem; }
.match-actions button {
  flex: 1; padding: 0.4rem; border-radius: var(--radius-sm);
  font-size: 0.72rem; font-weight: 600; border: none;
}
.btn-connect { background: var(--primary); color: white; }
.btn-pass { background: var(--card); border: 1px solid var(--border); color: var(--muted); }

/* ─── CHAT ──────────────────────────────────────────── */
.chat-panel { flex-direction: column; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 1rem;
  display: flex; flex-direction: column; gap: 0.6rem;
  -webkit-overflow-scrolling: touch;
}
.msg-bubble {
  max-width: 75%; padding: 0.65rem 0.9rem;
  border-radius: var(--radius); font-size: 0.9rem; line-height: 1.5;
}
.msg-out {
  align-self: flex-end;
  background: var(--primary); color: white;
  border-bottom-right-radius: 4px;
}
.msg-in {
  align-self: flex-start;
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-time { font-size: 0.65rem; opacity: 0.6; margin-top: 0.2rem; }
.msg-sender { font-size: 0.7rem; color: var(--gold); font-weight: 600; margin-bottom: 2px; }

.chat-input-bar {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input-bar input {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  border-radius: 22px; color: var(--text); font-size: 0.9rem;
  padding: 0.6rem 1rem; outline: none;
}
.chat-input-bar input:focus { border-color: var(--primary); }
.send-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--primary); border: none; color: white;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.send-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ─── PROFILE ───────────────────────────────────────── */
.profile-cover {
  height: 140px; background: linear-gradient(135deg, var(--primary), #0D1F35);
  position: relative;
}
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
/* .profile-avatar is defined in the Profile section below */
.profile-info { padding: 3rem 1.25rem 1rem; }
.profile-name { font-size: 1.3rem; font-weight: 700; }
.profile-nationality { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.profile-bio { font-size: 0.88rem; color: var(--muted); margin-top: 0.75rem; line-height: 1.6; }
.profile-stats {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 0.5rem; margin-top: 1rem;
}
.stat-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.75rem;
  text-align: center;
}
.stat-val { font-size: 1.2rem; font-weight: 700; color: var(--gold); }
.stat-lbl { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }

.badges-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.verified-badge { display: flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; color: var(--primary-lt); }

/* ─── SAFETY ────────────────────────────────────────── */
.safety-hero { text-align: center; padding: 1.5rem 0 0.5rem; }
.safety-shield { width: 80px; height: 80px; margin: 0 auto 0.75rem; display: block; }
.safety-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 1rem 0; }
.safety-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 0.75rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  transition: all var(--transition);
}
.safety-card:active { transform: scale(0.97); }
.safety-card svg { width: 32px; height: 32px; stroke: var(--primary-lt); fill: none; stroke-width: 1.5; }
.safety-card span { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.safety-card small { font-size: 0.72rem; color: var(--muted); text-align: center; }
.safety-card.sos { border-color: rgba(231,76,60,0.3); background: rgba(231,76,60,0.05); }
.safety-card.sos svg { stroke: var(--danger); }
.safety-card.sos span { color: var(--danger); }

.active-checkin {
  background: rgba(46,139,87,0.1); border: 1px solid rgba(46,139,87,0.3);
  border-radius: var(--radius); padding: 1rem; margin-top: 0.5rem;
}
.checkin-bar { display: flex; align-items: center; gap: 0.75rem; }
.checkin-bar svg { width: 24px; height: 24px; stroke: var(--accent); fill: none; stroke-width: 2; flex-shrink: 0; }
.checkin-label { font-size: 0.82rem; font-weight: 600; color: var(--accent); }
.checkin-countdown { font-size: 0.78rem; color: var(--muted); }

/* ─── SETTINGS ──────────────────────────────────────── */
.settings-section { margin-bottom: 1.5rem; }
.settings-section h3 { font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; padding: 0.5rem 0; border-bottom: 1px solid var(--border); margin-bottom: 0.75rem; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.setting-info { display: flex; align-items: center; gap: 0.75rem; flex: 1; }
.setting-icon { font-size: 1.2rem; }
.setting-title { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.setting-sub { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.setting-link { width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border); color: var(--text); font-size: 0.9rem; padding: 0.875rem 0; display: block; transition: color var(--transition); }
.setting-link:hover { color: var(--gold); }
.setting-link.danger { color: var(--danger); }
.app-version { text-align: center; color: var(--muted); font-size: 0.75rem; margin-top: 2rem; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 13px;
  transition: background 0.2s;
}
.slider::before {
  content: ''; position: absolute;
  width: 20px; height: 20px; border-radius: 50%;
  background: white; bottom: 3px; left: 3px;
  transition: transform 0.2s;
}
.toggle input:checked + .slider { background: var(--gold); }
.toggle input:checked + .slider::before { transform: translateX(20px); }

/* ─── NOMAD HUB ─────────────────────────────────────── */
.nomad-hero { text-align: center; padding: 0.75rem 0 1rem; }
.nomad-features { display: grid; grid-template-columns: repeat(4,1fr); gap: 0.5rem; margin-bottom: 0.5rem; }
.nomad-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.75rem 0.25rem;
  text-align: center; cursor: pointer; transition: all var(--transition);
}
.nomad-card span { font-size: 1.4rem; display: block; margin-bottom: 0.3rem; }
.nomad-card p { font-size: 0.7rem; color: var(--muted); }
.nomad-card:active { background: var(--surface); }

/* ─── BOTTOM NAV ────────────────────────────────────── */
.bottom-nav {
  height: calc(var(--nav-h) + var(--safe-bottom));
  display: flex; align-items: stretch;
  background: rgba(14,18,28,0.98);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding-bottom: env(safe-area-inset-bottom);
  flex-shrink: 0;
  position: relative; z-index: 50;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; color: var(--muted);
  font-size: 0.62rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 0.4rem 0;
  transition: color var(--transition);
  position: relative;
}
.nav-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.nav-btn.active { color: var(--gold); }
.nav-btn.active svg { stroke: var(--gold); }

.salah-nav .salah-nav-inner {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary);
  border: 2px solid rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0;
  box-shadow: 0 3px 10px rgba(27,94,135,0.35);
}
.salah-nav .salah-nav-inner svg { width: 20px; height: 20px; stroke: #fff; fill: none; }

/* ─── MODALS ────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.5rem; width: 100%; max-width: 480px;
  animation: slideUp 0.25s ease;
}
.modal-box h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.modal-box p { font-size: 0.88rem; color: var(--muted); line-height: 1.6; margin-bottom: 1rem; }
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; }
.modal-actions button { flex: 1; }
.sos-modal { border-top: 3px solid var(--danger); }
.sos-warning { font-size: 2.5rem; text-align: center; margin-bottom: 0.75rem; }

/* ─── TOAST ─────────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--nav-total-h) + 1rem); left: 1rem; right: 1rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 0.88rem; padding: 0.75rem 1rem;
  z-index: 200; text-align: center;
  animation: slideUp 0.2s ease;
  box-shadow: var(--shadow);
}

/* ─── SCROLL TO TOP BUTTON ────────────────────────────── */
.scroll-top-btn {
  position: fixed;
  bottom: calc(var(--nav-total-h) + 1.5rem);
  right: 1rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  border: 1px solid var(--border);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 100;
  transition: transform 0.2s ease, opacity 0.2s ease;
  /* Ensure it's tappable on mobile */
  touch-action: manipulation;
}
.scroll-top-btn:hover {
  transform: translateY(-2px);
}
.scroll-top-btn:active {
  transform: translateY(0);
}
.scroll-top-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: currentColor;
}
.scroll-top-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}
.toast.success { border-color: rgba(39,174,96,0.4); background: rgba(39,174,96,0.1); color: var(--success); }
.toast.error { border-color: rgba(231,76,60,0.4); background: rgba(231,76,60,0.1); color: var(--danger); }

/* ─── FULL LOADER ───────────────────────────────────── */
.full-loader {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(10,14,26,0.85); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.loader-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border); border-top-color: var(--gold);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* ─── SKELETON ──────────────────────────────────────── */
.skeleton-list {
  display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.75rem;
}
.skeleton-list::before,
.skeleton-list::after,
.skeleton-list > * {
  content: '';
  height: 80px; border-radius: var(--radius);
  background: linear-gradient(90deg, var(--card) 25%, var(--surface) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  display: block;
}
.skeleton-list::before { height: 80px; }
.skeleton-list::after { height: 80px; }

/* ─── DETAIL SCREENS ────────────────────────────────── */
.detail-hero {
  height: 200px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--primary), #0D1F35);
  flex-shrink: 0;
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(10,14,26,0.9) 0%, transparent 50%);
}
.detail-hero-text { position: absolute; bottom: 1rem; left: 1rem; right: 1rem; }
.detail-hero-text h2 { font-size: 1.3rem; font-weight: 700; color: white; }

.detail-body { padding: 1rem 1rem calc(var(--nav-total-h) + 1rem); }
.detail-section { margin-bottom: 1.25rem; }
.detail-section h3 { font-size: 0.82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.detail-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; padding: 0.3rem 0; }
.detail-row svg { width: 16px; height: 16px; stroke: var(--gold); fill: none; stroke-width: 2; flex-shrink: 0; }

/* ─── TRIP ITINERARY ────────────────────────────────── */
.itinerary-day {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.875rem; margin-bottom: 0.5rem;
}
.day-label { font-size: 0.75rem; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.day-item { display: flex; gap: 0.75rem; padding: 0.25rem 0; font-size: 0.85rem; }
.day-time { color: var(--muted); min-width: 3.5rem; flex-shrink: 0; }
.day-activity { color: var(--text); }

/* ─── UTILITIES ─────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--muted); font-size: 0.88rem; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.text-gold { color: var(--gold); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* ─── ANIMATIONS ────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}
@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ════════════════════════════════════════════════════
   THEME SYSTEM — Light theme override
   The default `:root` palette is dark. When
   `data-theme="light"` is set on <html>, we swap to a
   warm, paper-like palette while keeping accent colors.
   ════════════════════════════════════════════════════ */
:root[data-theme="light"] {
  --bg:         #F5F7FB;
  --surface:    #FFFFFF;
  --card:       #FFFFFF;
  --border:     #E4E9F2;
  --text:       #1A2235;
  --muted:      #6C7A93;
  --primary:    #1B5E87;
  --primary-lt: #2577AB;
  --gold:       #B8872E;
  --shadow:     0 4px 24px rgba(20,30,60,0.08);
}
:root[data-theme="light"] .geo-pattern {
  background-image:
    repeating-linear-gradient(60deg, transparent, transparent 20px, rgba(27,94,135,0.04) 20px, rgba(27,94,135,0.04) 21px),
    repeating-linear-gradient(-60deg, transparent, transparent 20px, rgba(27,94,135,0.04) 20px, rgba(27,94,135,0.04) 21px);
}
:root[data-theme="light"] .splash-bg {
  background: linear-gradient(160deg, #F0F5FB 0%, #FFFFFF 50%, #F7F9FC 100%);
}
:root[data-theme="light"] .splash-title { text-shadow: 0 0 30px rgba(27,94,135,0.15); }
:root[data-theme="light"] .leaflet-tile { filter: none !important; }
:root[data-theme="light"] .map-container { background: #E4E9F2; }
:root[data-theme="light"] input,
:root[data-theme="light"] textarea,
:root[data-theme="light"] select {
  background: #FFFFFF !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}
:root[data-theme="light"] .bottom-nav,
:root[data-theme="light"] .top-bar,
:root[data-theme="light"] .panel,
:root[data-theme="light"] .modal-content { background: var(--surface); }

/* Smooth theme transitions on key elements */
html { transition: background-color .25s ease, color .25s ease; }
body, .panel, .top-bar, .bottom-nav, .card, .modal-content,
.conversation-item, .chat-input-bar, .chat-messages, .message-bubble {
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

/* ─── Theme toggle button ───────────────────────────── */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center; justify-content: center;
  cursor: pointer;
  margin-right: 8px;
  font-size: 1.05rem;
  transition: background var(--transition), transform var(--transition);
}
.theme-toggle:hover { background: var(--card); transform: rotate(15deg); }
.theme-toggle:active { transform: rotate(0deg) scale(.92); }

/* ════════════════════════════════════════════════════
   MESSAGING — Group chat enhancements
   ════════════════════════════════════════════════════ */

/* Tabs row at top of messages panel */
.msg-tabs {
  display: flex;
  gap: 6px;
  padding: 0 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.msg-tab {
  flex: 1;
  padding: 0.6rem 0.5rem;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.msg-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* Action row: new group + join by code */
.msg-actions {
  display: flex; gap: 8px;
  padding: 0 1rem 0.5rem;
}
.msg-actions .btn {
  flex: 1;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
}

/* Category filter pills */
.cat-pills {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding: 0.25rem 1rem 0.75rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-pills::-webkit-scrollbar { display: none; }
.cat-pill {
  flex-shrink: 0;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.cat-pill:hover { color: var(--text); border-color: var(--gold); }
.cat-pill.active {
  background: var(--gold);
  color: #1A1208;
  border-color: var(--gold);
  font-weight: 600;
}

/* Group avatar (initials circle) */
.group-avatar {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.group-avatar.cat-travel  { background: linear-gradient(135deg,#1B5E87,#2577AB); }
.group-avatar.cat-food    { background: linear-gradient(135deg,#E67E22,#D35400); }
.group-avatar.cat-prayer  { background: linear-gradient(135deg,#2E8B57,#1B6A3F); }
.group-avatar.cat-social  { background: linear-gradient(135deg,#9B59B6,#7D3C98); }
.group-avatar.cat-support { background: linear-gradient(135deg,#3498DB,#2874A6); }
.group-avatar.cat-study   { background: linear-gradient(135deg,#16A085,#117A65); }

/* Category badge on conversation rows */
.cat-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(212,168,83,0.15);
  color: var(--gold);
  margin-left: 6px;
  font-weight: 600;
  text-transform: capitalize;
}

/* Conversation row — improved layout */
.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.conversation-item:hover { background: var(--card); }
.conv-body { flex: 1; min-width: 0; }
.conv-title-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 2px;
}
.conv-name {
  font-weight: 600;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1;
}
.conv-time { font-size: 0.72rem; color: var(--muted); flex-shrink: 0; }
.conv-last {
  font-size: 0.85rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-unread {
  background: var(--gold);
  color: #1A1208;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px; height: 20px;
  border-radius: 999px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center; justify-content: center;
  margin-left: 8px;
}

/* Group discovery card */
.group-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.9rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 1rem 0.75rem;
  transition: transform var(--transition), border-color var(--transition);
}
.group-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.group-card .meta { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.group-card .btn { padding: 0.4rem 0.85rem; font-size: 0.82rem; }

/* Chat header (when in a group) */
.chat-header-info {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0; cursor: pointer;
}
.chat-header-info .group-avatar { width: 36px; height: 36px; font-size: 0.85rem; border-radius: 10px; }
.chat-header-info .name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header-info .sub  { font-size: 0.72rem; color: var(--muted); }

/* Group info panel */
.group-info-header {
  text-align: center;
  padding: 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}
.group-info-header .group-avatar {
  width: 84px; height: 84px;
  border-radius: 24px;
  font-size: 2rem;
  margin: 0 auto 0.75rem;
}
.group-info-header h2 { margin: 0 0 4px; font-size: 1.4rem; }
.group-info-header .desc { color: var(--muted); font-size: 0.92rem; margin: 0.25rem 0; }
.invite-code-box {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card);
  border: 1px dashed var(--gold);
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  margin-top: 0.75rem;
  font-family: monospace;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  color: var(--gold);
}
.invite-code-box button {
  background: transparent; border: 0; color: var(--gold);
  cursor: pointer; padding: 2px 4px;
}

.member-list { padding: 0.5rem 0; }
.member-item {
  display: flex; align-items: center; gap: 10px;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}
.member-item .avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--card);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--gold); font-weight: 700;
  flex-shrink: 0;
}
.member-item .name { flex: 1; color: var(--text); font-weight: 500; }
.member-item .role-badge {
  font-size: 0.7rem; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px;
  background: var(--card); color: var(--muted);
  letter-spacing: 0.05em;
}
.member-item .role-badge.owner { background: var(--gold); color: #1A1208; }
.member-item .role-badge.admin { background: var(--primary); color: #fff; }
.member-item .remove-btn {
  background: transparent; border: 0;
  color: var(--danger); cursor: pointer;
  padding: 4px 8px; font-size: 0.85rem;
}

/* Empty / loading helpers reuse existing .empty-state */

/* Map enhancements */
.map-fab-cluster {
  position: absolute; bottom: 100px; right: 16px;
  z-index: 500;
  display: flex; flex-direction: column; gap: 8px;
}
.map-fab-cluster button {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: transform var(--transition);
}
.map-fab-cluster button:hover { transform: scale(1.08); }
.map-fab-cluster button:active { transform: scale(.95); }

.marker-cluster-small  { background-color: rgba(27,94,135,0.5); }
.marker-cluster-small div  { background-color: rgba(27,94,135,0.85); color: #fff; }
.marker-cluster-medium { background-color: rgba(212,168,83,0.55); }
.marker-cluster-medium div { background-color: rgba(212,168,83,0.9); color: #1A1208; }
.marker-cluster-large  { background-color: rgba(46,139,87,0.55); }
.marker-cluster-large div  { background-color: rgba(46,139,87,0.9); color: #fff; }

/* ─── Responsive — tablet & desktop ─────────────────── */
@media (min-width: 768px) {
  .screen { max-width: 100%; }
  .panel  { padding-left: max(1rem, calc((100vw - 720px) / 2));
            padding-right: max(1rem, calc((100vw - 720px) / 2)); }
  .top-bar { padding-left: max(1rem, calc((100vw - 720px) / 2));
             padding-right: max(1rem, calc((100vw - 720px) / 2)); }
  .bottom-nav { max-width: 720px; left: 50%; transform: translateX(-50%); border-radius: 18px 18px 0 0; }
}
@media (min-width: 1100px) {
  .panel { padding-left: max(1rem, calc((100vw - 980px) / 2));
           padding-right: max(1rem, calc((100vw - 980px) / 2)); }
}



/* ════════════════════════════════════════════════════════════════════
   AUDIT FIXES — Missing utility button classes
   The HTML uses `class="btn btn-primary"`, `btn-block`, `btn-secondary`
   which were undefined. These add the missing baseline.
   ════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  line-height: 1.2;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-lt) 100%);
  color: #fff;
  border-color: transparent;
}
.btn.btn-secondary {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
.btn.btn-secondary:hover { border-color: var(--gold); color: var(--gold); }

.btn-block { width: 100%; display: flex; }

/* ════════════════════════════════════════════════════════════════════
   AUDIT FIXES — COMPREHENSIVE LIGHT-THEME OVERRIDES
   The original light theme only covered ~5 selectors. Many surfaces
   used hardcoded rgba(10,14,26,..) colors that ignored CSS vars,
   making the light mode unreadable. These overrides fix every panel,
   bar, card, modal, badge, and pill so light mode is fully usable.
   ════════════════════════════════════════════════════════════════════ */

/* Body & scrollbar */
:root[data-theme="light"] body { background: var(--bg); color: var(--text); }
:root[data-theme="light"] ::-webkit-scrollbar { width: 8px; height: 8px; }
:root[data-theme="light"] ::-webkit-scrollbar-track { background: transparent; }
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: #C7D2E0; border-radius: 4px; }
:root[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #A8B5C8; }

/* App shell */
:root[data-theme="light"] #screen-app { background: var(--bg); }

/* Top bar (was hardcoded rgba(10,14,26,0.95)) */
:root[data-theme="light"] .top-bar {
  background: rgba(255,255,255,0.95) !important;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
:root[data-theme="light"] .top-logo,
:root[data-theme="light"] .top-title,
:root[data-theme="light"] .logo-text { color: var(--text); }
:root[data-theme="light"] .avatar-sm { background: #EEF2F8; border-color: var(--border); }
:root[data-theme="light"] .avatar-sm svg { stroke: var(--muted); }

/* Bottom nav (was hardcoded rgba(14,18,28,0.98)) */
:root[data-theme="light"] .bottom-nav {
  background: rgba(255,255,255,0.98) !important;
  border-top: 1px solid var(--border);
}
:root[data-theme="light"] .nav-btn { color: #94A3B8; }
:root[data-theme="light"] .nav-btn.active { color: var(--primary); }
:root[data-theme="light"] .nav-btn.active svg { stroke: var(--primary); }
:root[data-theme="light"] .salah-nav .salah-nav-inner {
  background: var(--primary);
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 3px 10px rgba(27,94,135,0.3);
}

/* Cards & lists */
:root[data-theme="light"] .card,
:root[data-theme="light"] .group-card,
:root[data-theme="light"] .match-card,
:root[data-theme="light"] .safety-card,
:root[data-theme="light"] .stat-item,
:root[data-theme="light"] .nomad-card,
:root[data-theme="light"] .prayer-time-item,
:root[data-theme="light"] .itinerary-day,
:root[data-theme="light"] .interest-btn,
:root[data-theme="light"] .salah-btn,
:root[data-theme="light"] .pill,
:root[data-theme="light"] .tag-btn,
:root[data-theme="light"] .filter-pill,
:root[data-theme="light"] .cat-pill {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}
:root[data-theme="light"] .card:active { background: #EEF2F8; }
:root[data-theme="light"] .card-title { color: var(--text); }
:root[data-theme="light"] .card-sub,
:root[data-theme="light"] .card-time,
:root[data-theme="light"] .match-style,
:root[data-theme="light"] .stat-lbl,
:root[data-theme="light"] .nomad-card p,
:root[data-theme="light"] .prayer-name,
:root[data-theme="light"] .day-time,
:root[data-theme="light"] .countdown,
:root[data-theme="light"] .salah-date,
:root[data-theme="light"] .text-muted,
:root[data-theme="light"] .conv-time,
:root[data-theme="light"] .conv-last,
:root[data-theme="light"] .group-card .meta { color: var(--muted); }
:root[data-theme="light"] .card-icon {
  background: rgba(27,94,135,0.1);
  border: 1px solid rgba(27,94,135,0.18);
}

/* Map filter & search overlays */
:root[data-theme="light"] .map-search,
:root[data-theme="light"] .map-search-results {
  background: rgba(255,255,255,0.98) !important;
  border-color: var(--border);
  color: var(--text);
}
:root[data-theme="light"] .map-search input { color: var(--text); }
:root[data-theme="light"] .map-search-result { color: var(--text); border-bottom-color: rgba(0,0,0,0.05); }
:root[data-theme="light"] .map-search-result:hover { background: rgba(27,94,135,0.06); }
:root[data-theme="light"] .filter-pill {
  background: rgba(255,255,255,0.95) !important;
}
:root[data-theme="light"] .filter-pill.active { background: var(--primary) !important; color: #fff; }
:root[data-theme="light"] .fab-secondary { background: var(--surface); }

/* Salah panel */
:root[data-theme="light"] .salah-hero {
  background: linear-gradient(135deg, #EEF5FB 0%, #FFFFFF 100%);
  border-color: var(--border);
}
:root[data-theme="light"] .next-prayer-card {
  background: rgba(27,94,135,0.08);
  border-color: rgba(27,94,135,0.2);
}
:root[data-theme="light"] .next-time { color: var(--text); }
:root[data-theme="light"] .next-label { color: var(--muted); }
:root[data-theme="light"] .prayer-time { color: var(--text); }
:root[data-theme="light"] .salah-location-row input {
  background: #FFFFFF !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
:root[data-theme="light"] .salah-btn svg { stroke: var(--primary); }

/* Chat */
:root[data-theme="light"] .chat-input-bar {
  background: var(--surface);
  border-top-color: var(--border);
}
:root[data-theme="light"] .chat-input-bar input {
  background: #F5F7FB;
  color: var(--text);
  border-color: var(--border);
}
:root[data-theme="light"] .msg-in {
  background: #FFFFFF;
  color: var(--text);
  border-color: var(--border);
}
:root[data-theme="light"] .msg-out {
  background: var(--primary);
  color: #fff;
}

/* Conversations */
:root[data-theme="light"] .conversation-item { border-bottom-color: var(--border); }
:root[data-theme="light"] .conversation-item:hover { background: #EEF2F8; }
:root[data-theme="light"] .conv-name { color: var(--text); }

/* Messages tabs */
:root[data-theme="light"] .msg-tabs { border-bottom-color: var(--border); }
:root[data-theme="light"] .msg-tab { color: var(--muted); }
:root[data-theme="light"] .msg-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Group cards & members */
:root[data-theme="light"] .group-info-header { border-bottom-color: var(--border); }
:root[data-theme="light"] .invite-code-box { background: rgba(184,135,46,0.06); }
:root[data-theme="light"] .member-item { border-bottom-color: var(--border); }
:root[data-theme="light"] .member-item .name { color: var(--text); }
:root[data-theme="light"] .member-item .avatar { background: #EEF2F8; }
:root[data-theme="light"] .member-item .role-badge { background: #EEF2F8; color: var(--muted); }
:root[data-theme="light"] .member-item .role-badge.owner { background: var(--gold); color: #FFFFFF; }
:root[data-theme="light"] .member-item .role-badge.admin { background: var(--primary); color: #FFFFFF; }
:root[data-theme="light"] .cat-badge { background: rgba(184,135,46,0.12); color: var(--gold); }

/* Profile */
:root[data-theme="light"] .profile-cover {
  background: linear-gradient(135deg, var(--primary) 0%, #2577AB 100%);
}
:root[data-theme="light"] .profile-avatar {
  background: #FFFFFF;
  border-color: var(--bg);
}
:root[data-theme="light"] .profile-name { color: var(--text); }
:root[data-theme="light"] .profile-bio,
:root[data-theme="light"] .profile-nationality { color: var(--muted); }

/* Settings */
:root[data-theme="light"] .settings-section h3 { color: var(--muted); border-bottom-color: var(--border); }
:root[data-theme="light"] .setting-row { border-bottom-color: var(--border); }
:root[data-theme="light"] .setting-title { color: var(--text); }
:root[data-theme="light"] .setting-sub { color: var(--muted); }
:root[data-theme="light"] .setting-link { color: var(--text); border-bottom-color: var(--border); }
:root[data-theme="light"] .setting-link:hover { color: var(--primary); }
:root[data-theme="light"] .setting-link.danger { color: var(--danger); }
:root[data-theme="light"] .toggle .slider { background: #C7D2E0; }
:root[data-theme="light"] .toggle .slider::before { background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }

/* Modals */
:root[data-theme="light"] .modal-overlay {
  background: rgba(20,30,60,0.45);
}
:root[data-theme="light"] .modal-box {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: 0 -8px 36px rgba(20,30,60,0.18);
}
:root[data-theme="light"] .modal-box h3 { color: var(--text); }
:root[data-theme="light"] .modal-box p { color: var(--muted); }
:root[data-theme="light"] .full-loader {
  background: rgba(245,247,251,0.85);
}
:root[data-theme="light"] .loader-spinner {
  border-color: var(--border);
  border-top-color: var(--primary);
}

/* Toast */
:root[data-theme="light"] .toast {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
}
:root[data-theme="light"] .toast.success {
  background: rgba(46,139,87,0.12);
  border-color: rgba(46,139,87,0.4);
  color: #1F6E3F;
}
:root[data-theme="light"] .toast.error {
  background: rgba(231,76,60,0.12);
  border-color: rgba(231,76,60,0.4);
  color: #B83227;
}

/* Scroll-top FAB */
:root[data-theme="light"] .scroll-top-btn {
  background: var(--primary);
  color: #FFFFFF;
  border-color: rgba(27,94,135,0.4);
}

/* Leaflet popups */
:root[data-theme="light"] .leaflet-popup-content-wrapper,
:root[data-theme="light"] .leaflet-popup-tip {
  background: var(--surface);
  color: var(--text);
}
:root[data-theme="light"] .leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* Map panel background (was hardcoded #0D1626 navy) */
:root[data-theme="light"] #panel-map { background: #D9E8F2; }

/* Detail hero (place/meetup/trip headers) */
:root[data-theme="light"] .detail-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #2577AB 100%) !important;
}
/* Lighten the dark bottom-fade overlay that sits on top of the hero */
:root[data-theme="light"] .detail-hero-overlay {
  background: linear-gradient(to top, rgba(0,0,0,0.18) 0%, transparent 55%);
}

/* Badges — keep colored but darker accent on light bg */
:root[data-theme="light"] .badge-halal  { background: rgba(46,139,87,0.12); color: #1F6E3F; border-color: rgba(46,139,87,0.3); }
:root[data-theme="light"] .badge-prayer { background: rgba(27,94,135,0.12); color: var(--primary); border-color: rgba(27,94,135,0.3); }
:root[data-theme="light"] .badge-women  { background: rgba(180,60,150,0.12); color: #8E2980; border-color: rgba(180,60,150,0.3); }
:root[data-theme="light"] .badge-gold   { background: rgba(184,135,46,0.12); color: var(--gold); border-color: rgba(184,135,46,0.3); }
:root[data-theme="light"] .badge-danger { background: rgba(231,76,60,0.12); color: var(--danger); border-color: rgba(231,76,60,0.3); }

/* Pills active state */
:root[data-theme="light"] .pill.active,
:root[data-theme="light"] .cat-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Map cluster markers */
:root[data-theme="light"] .map-fab-cluster button {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

/* Buttons in light mode get a subtle border so they're visible on white */
:root[data-theme="light"] .btn-outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
:root[data-theme="light"] .btn-icon { color: var(--text); }
:root[data-theme="light"] .btn-icon svg { stroke: var(--text); }
:root[data-theme="light"] .btn-ghost { color: var(--muted); }
:root[data-theme="light"] .btn-ghost:hover { color: var(--text); }
:root[data-theme="light"] .theme-toggle { background: var(--surface); border-color: var(--border); color: var(--text); }

/* AI Banner */
:root[data-theme="light"] .ai-banner {
  background: linear-gradient(135deg, rgba(27,94,135,0.1) 0%, rgba(46,139,87,0.06) 100%);
  border-color: rgba(27,94,135,0.25);
}
:root[data-theme="light"] .ai-banner-title { color: var(--primary); }

/* Search bar inline */
:root[data-theme="light"] .search-bar-inline { background: var(--surface); border-color: var(--border); }
:root[data-theme="light"] .search-bar-inline input { color: var(--text); }

/* Empty state */
:root[data-theme="light"] .empty-state { color: var(--muted); }

/* Skeleton */
:root[data-theme="light"] .skeleton-list > *,
:root[data-theme="light"] .skeleton-list::before,
:root[data-theme="light"] .skeleton-list::after {
  background: linear-gradient(90deg, #EEF2F8 25%, #FFFFFF 50%, #EEF2F8 75%);
  background-size: 200% 100%;
}

/* Match buttons in light */
:root[data-theme="light"] .btn-connect { background: var(--primary); color: #fff; }
:root[data-theme="light"] .btn-pass { background: var(--surface); border-color: var(--border); color: var(--muted); }

/* Active check-in */
:root[data-theme="light"] .active-checkin {
  background: rgba(46,139,87,0.08);
  border-color: rgba(46,139,87,0.3);
}

/* Smoother scrollbars track for nicer light look */
:root[data-theme="light"] .panel-scroll { scrollbar-color: #C7D2E0 transparent; }

/* ══════════════════════════════════════════════════════
   APP LOADER (boot screen)
══════════════════════════════════════════════════════ */
#screen-loader .app-loader {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.8rem;
  background: radial-gradient(circle at 50% 30%, #143352 0%, #0A0E1A 70%);
  color: #F0F4FF;
  z-index: 100;
}
.app-loader-logo { width: 88px; height: 88px; animation: scLoaderPulse 1.8s ease-in-out infinite; }
.app-loader-logo svg { width: 100%; height: 100%; display: block; }
.app-loader-name { font-family: 'Amiri', serif; font-size: 1.7rem; letter-spacing: 0.5px; }
.app-loader-name .gold { color: #D4A853; }
.app-loader-tag { color: #D4A853; opacity: 0.85; font-size: 1.1rem; }
.app-loader-spinner { display: flex; gap: 0.4rem; margin-top: 0.6rem; }
.app-loader-spinner span {
  width: 8px; height: 8px; border-radius: 50%; background: #D4A853;
  animation: scLoaderDot 1.3s ease-in-out infinite;
}
.app-loader-spinner span:nth-child(2) { animation-delay: 0.15s; }
.app-loader-spinner span:nth-child(3) { animation-delay: 0.3s; }
@keyframes scLoaderPulse {
  0%,100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(212,168,83,0)); }
  50%     { transform: scale(1.06); filter: drop-shadow(0 0 12px rgba(212,168,83,0.55)); }
}
@keyframes scLoaderDot {
  0%,80%,100% { opacity: 0.3; transform: translateY(0); }
  40%         { opacity: 1;   transform: translateY(-4px); }
}

/* ══════════════════════════════════════════════════════
   T&Cs checkbox on register
══════════════════════════════════════════════════════ */
.tnc-field { margin-top: 0.6rem; }
.tnc-check {
  display: flex; align-items: flex-start; gap: 0.6rem;
  cursor: pointer; line-height: 1.4;
  font-size: 0.85rem; color: var(--text);
}
.tnc-check input[type="checkbox"] {
  position: absolute; opacity: 0; pointer-events: none;
}
.tnc-box {
  flex: 0 0 20px; width: 20px; height: 20px; margin-top: 2px;
  border: 2px solid var(--border); border-radius: 5px;
  background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.tnc-check input:checked ~ .tnc-box {
  background: var(--gold); border-color: var(--gold);
}
.tnc-check input:checked ~ .tnc-box::after {
  content: ''; width: 6px; height: 11px;
  border: solid #0A0E1A; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) translate(-1px,-1px);
}
.tnc-text a { color: var(--gold); text-decoration: underline; }
.tnc-text { flex: 1; }

/* ══════════════════════════════════════════════════════
   Terms modal
══════════════════════════════════════════════════════ */
.terms-modal { max-width: 560px; width: 100%; max-height: 86vh; display: flex; flex-direction: column; }
.terms-version { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.6rem; }
.terms-scroll {
  overflow-y: auto; flex: 1; padding-right: 0.6rem;
  font-size: 0.88rem; line-height: 1.55; color: var(--text);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding-top: 0.6rem; padding-bottom: 0.6rem;
  margin-bottom: 0.8rem;
}
.terms-scroll h4 { color: var(--gold); margin-top: 0.9rem; margin-bottom: 0.3rem; font-size: 0.95rem; }
.terms-scroll ul { padding-left: 1.2rem; margin: 0.4rem 0; }
.terms-scroll li { margin-bottom: 0.2rem; }
.modal-close {
  position: absolute; top: 0.6rem; right: 0.8rem;
  background: none; border: none; color: var(--muted);
  font-size: 1.8rem; cursor: pointer; line-height: 1;
}

/* ══════════════════════════════════════════════════════
   Admin panel
══════════════════════════════════════════════════════ */
.admin-hero {
  background: linear-gradient(135deg, #1B5E87 0%, #0F3F5F 100%);
  color: #fff; padding: 1.25rem 1rem; border-radius: var(--radius);
  margin: 1rem 1rem 0.6rem;
}
.admin-hero-title { font-family: 'Amiri', serif; font-size: 1.4rem; }
.admin-hero-sub { color: rgba(255,255,255,0.78); font-size: 0.85rem; }
.admin-stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem; padding: 0 1rem;
}
.admin-stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.8rem;
}
.admin-stat .v { font-size: 1.3rem; font-weight: 700; color: var(--gold); }
.admin-stat .l { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.admin-filters {
  display: flex; gap: 0.4rem; padding: 0 1rem; flex-wrap: wrap;
}
.admin-filters input, .admin-filters select {
  flex: 1 1 100px; min-width: 0;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem; font-size: 0.85rem;
}
.admin-list { padding: 0.6rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.admin-user-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.7rem 0.8rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name { font-weight: 600; font-size: 0.9rem; }
.admin-user-meta { font-size: 0.75rem; color: var(--muted); }
.admin-user-meta .pill {
  display: inline-block; padding: 1px 6px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  margin-right: 4px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.4px;
}
.admin-user-meta .pill.banned { background: rgba(231,76,60,0.15); color: #FF7B6B; border-color: rgba(231,76,60,0.4); }
.admin-user-meta .pill.pending { background: rgba(212,168,83,0.15); color: var(--gold); border-color: rgba(212,168,83,0.4); }
.admin-user-meta .pill.active { background: rgba(46,139,87,0.15); color: #6BD491; border-color: rgba(46,139,87,0.4); }
.admin-user-meta .pill.superadmin { background: rgba(212,168,83,0.2); color: var(--gold); border-color: var(--gold); }
.admin-user-actions { display: flex; gap: 0.3rem; }
.admin-user-actions button {
  padding: 0.35rem 0.6rem; font-size: 0.75rem;
  border-radius: 6px; cursor: pointer; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.admin-user-actions .btn-ban { background: rgba(231,76,60,0.18); color: #FF7B6B; border-color: rgba(231,76,60,0.4); }
.admin-user-actions .btn-unban { background: rgba(46,139,87,0.18); color: #6BD491; border-color: rgba(46,139,87,0.4); }
.admin-audit {
  padding: 0 1rem 2rem; display: flex; flex-direction: column; gap: 0.4rem;
}
.admin-audit-row {
  font-size: 0.78rem; color: var(--muted);
  padding: 0.45rem 0.6rem; border-left: 2px solid var(--gold);
  background: var(--surface); border-radius: 0 6px 6px 0;
}
.admin-audit-row strong { color: var(--text); }

/* Admin link on profile */
.profile-admin-link {
  display: block; margin-top: 0.5rem; padding: 0.7rem 1rem;
  background: linear-gradient(135deg, #1B5E87, #2577AB);
  color: #fff; border-radius: var(--radius-sm);
  text-align: center; font-weight: 600;
  border: 1px solid var(--gold);
}

/* ══════════════════════════════════════════════════════
   MAP FIXES — zoom control middle-right; FAB stacking;
   pin scaling; dark tile readability
══════════════════════════════════════════════════════ */
/* Move Leaflet zoom buttons from default top-left/top-right to vertical middle on right */
.leaflet-top.leaflet-right {
  top: 50%;
  transform: translateY(-50%);
  right: 0;
}
.leaflet-top.leaflet-right .leaflet-control-zoom {
  margin-right: 12px;
  margin-top: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  border-radius: 12px;
  overflow: hidden;
}
.leaflet-control-zoom a {
  width: 38px !important; height: 38px !important;
  line-height: 38px !important; font-size: 18px !important;
  font-weight: 600;
}

/* Place locate FAB just above the create-meetup FAB; tighter stack */
.fab-primary   { bottom: calc(var(--nav-total-h) + 1rem) !important; }
.fab-secondary { bottom: calc(var(--nav-total-h) + 4.6rem) !important; }

/* Make dark tile labels easier to read */
:root:not([data-theme="light"]) .leaflet-tile-pane .leaflet-tile {
  filter: brightness(1.08) contrast(1.18) saturate(0.95);
}

/* Crisper marker icon transitions when zooming */
.leaflet-marker-icon { transition: transform 120ms ease-out; }

/* Map search wrap alignment fix (was overflowing white frame) */
.map-search-wrap { margin: 0 !important; width: 100%; }
.map-search-wrap input { width: 100%; box-sizing: border-box; }


/* ------------------------------------------------
   POLISH PASS � explore button, search frame, theme refinement
   ------------------------------------------------ */
/* Explore (center) nav button: lower z-index of blue puck so it never overlays modals/dropdowns */
.salah-nav { z-index: 1 !important; }
.salah-nav .salah-nav-inner {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark, #134764));
  box-shadow: 0 2px 8px rgba(27,94,135,0.30);
}
.nav-btn.salah-nav.active .salah-nav-inner {
  background: linear-gradient(135deg, var(--gold), #b88b3a);
  box-shadow: 0 3px 12px rgba(212,168,83,0.40);
}
.nav-btn.salah-nav.active .salah-nav-inner svg { stroke: #fff; }
.nav-btn.salah-nav.active { color: var(--gold); }

/* Ensure top logo stays above any panel content */
#topLogo, #topLogoSvg { position: relative; z-index: 60; pointer-events: none; }
.top-bar { z-index: 55; position: sticky; top: 0; }

/* Search box wrap: transparent so the inner pill is the only visible box */
.map-search-wrap {
  margin: 0 !important;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  display: block;
}

/* -- Light theme refinement -- */
:root[data-theme="light"] {
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --bg: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #1B5E87;
  --primary-dark: #134764;
  --gold: #C9962B;
  --shadow-card: 0 4px 20px rgba(15,23,42,0.06), 0 1px 3px rgba(15,23,42,0.04);
}
:root[data-theme="light"] body { background: var(--bg); color: var(--text); }
:root[data-theme="light"] .card,
:root[data-theme="light"] .modal-box,
:root[data-theme="light"] .panel-card { box-shadow: var(--shadow-card); border-color: var(--border); }
:root[data-theme="light"] .bottom-nav { background: rgba(255,255,255,0.92); }

/* -- Dark theme refinement (rich navy + warm gold) -- */
:root:not([data-theme="light"]) {
  --surface: #0f1a26;
  --surface-2: #14253a;
  --bg: #0a121c;
  --text: #e7eef6;
  --text-muted: #94a3b8;
  --muted: #94a3b8;
  --border: #1f3147;
  --primary: #2c7aa8;
  --primary-dark: #1B5E87;
  --gold: #D4A853;
  --shadow-card: 0 8px 28px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.03) inset;
}
:root:not([data-theme="light"]) body { background: var(--bg); color: var(--text); }
:root:not([data-theme="light"]) .card,
:root:not([data-theme="light"]) .modal-box,
:root:not([data-theme="light"]) .panel-card { box-shadow: var(--shadow-card); border-color: var(--border); }

/* Map dark-mode contrast bump (text labels readable on cartocdn dark_all) */
:root:not([data-theme="light"]) .leaflet-control-attribution {
  background: rgba(15,23,42,0.65) !important; color: #cbd5e1 !important;
}
:root:not([data-theme="light"]) .leaflet-control-attribution a { color: #94a3b8 !important; }

/* Leaflet popup polish � both themes */
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.30); }
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; line-height: 1.45; }
:root[data-theme="light"] .leaflet-popup-content-wrapper { background: #fff; color: #0f172a; }
:root:not([data-theme="light"]) .leaflet-popup-content-wrapper { background: #14253a; color: #e7eef6; }
:root:not([data-theme="light"]) .leaflet-popup-tip { background: #14253a; }

/* Salah method label affordance */
.salah-method-label:hover { color: var(--gold) !important; text-decoration: underline; }

/* -- Multi-choice quick flow chip buttons -- */
.sc-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.sc-chip {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer;
  font-size: 13px; font-weight: 600; transition: all .15s;
}
.sc-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-card); }
.sc-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Avatar / cover edit hint inside profile */
.editable-photo { position: relative; cursor: pointer; }
.editable-photo::after {
  content: "?"; position: absolute; bottom: 6px; right: 6px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; pointer-events: none;
}

/* Registration disclaimer block */
.tnc-disclaimer {
  margin: 10px 0 0;
  padding: 12px 14px;
  background: rgba(212,168,83,0.08);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
}
.tnc-disclaimer strong { color: var(--gold); }

/* ════════════════════════════════════════════════════════
   COMPREHENSIVE UI POLISH — 2025 refresh
════════════════════════════════════════════════════════ */

/* ── Loader: redesigned ring animation ───────────────── */
.app-loader {
  background: linear-gradient(165deg, #0A1628 0%, #0E2040 50%, #0A1628 100%);
}
.app-loader-logo {
  width: 110px; height: 110px;
  animation: loaderLogoPulse 2.4s ease-in-out infinite;
}
@keyframes loaderLogoPulse {
  0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 10px rgba(212,168,83,0.35)); }
  50%       { transform: scale(1.06); filter: drop-shadow(0 0 24px rgba(212,168,83,0.65)); }
}
.app-loader-name .gold { color: #D4A853; }
/* Elegant spinning compass ring */
.app-loader-ring {
  width: 52px; height: 52px;
  border: 2.5px solid rgba(212,168,83,0.18);
  border-top-color: #D4A853;
  border-radius: 50%;
  animation: loaderSpin 1s linear infinite;
  position: relative; margin-top: 1.5rem;
}
.app-loader-ring-inner {
  position: absolute; inset: 6px;
  border: 1.5px solid rgba(27,94,135,0.25);
  border-bottom-color: #1B5E87;
  border-radius: 50%;
  animation: loaderSpin 0.7s linear infinite reverse;
}
@keyframes loaderSpin { to { transform: rotate(360deg); } }
/* Hide the old dot spinner if still present */
.app-loader-spinner { display: none; }

/* ── Salah method indicator button ───────────────────── */
.salah-method-wrap {
  margin: 0.4rem 0 0.6rem;
  display: flex; justify-content: center;
}
.salah-method-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 18px; border-radius: 999px;
  background: rgba(212,168,83,0.12); border: 1.5px solid rgba(212,168,83,0.35);
  color: #D4A853; font-size: 0.78rem; font-weight: 700; cursor: pointer;
  transition: background 0.2s, border-color 0.2s; letter-spacing: 0.03em;
  font-family: inherit;
}
.salah-method-btn:hover { background: rgba(212,168,83,0.22); border-color: #D4A853; }
.salah-method-btn svg { flex-shrink: 0; opacity: 0.75; stroke: currentColor; fill: none; stroke-width: 2; }

/* ── Salah inline prefs row ─────────────────────────── */
.salah-prefs-row {
  display: flex; gap: 0.75rem; padding: 0.75rem 1rem;
  background: rgba(212,168,83,0.07); border-radius: 12px;
  margin: 0.5rem 0 0.75rem; flex-wrap: wrap;
}
.salah-pref-field { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 4px; }
.salah-pref-label { font-size: 0.7rem; font-weight: 700; color: #D4A853; text-transform: uppercase; letter-spacing: 0.06em; }
.salah-pref-select {
  width: 100%; padding: 7px 10px; border-radius: 8px;
  border: 1.5px solid rgba(212,168,83,0.35);
  background: rgba(10,14,26,0.7); color: var(--text);
  font-size: 0.82rem; font-family: inherit; cursor: pointer;
  -webkit-appearance: auto; appearance: auto;
}
.salah-pref-select:focus { outline: none; border-color: #D4A853; }
:root[data-theme="light"] .salah-pref-select { background: #fff; color: #0f172a; }

/* ── Edit Profile: sticky panel header ───────────────── */
.ep-panel-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ep-panel-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

/* ── Edit Profile: media pickers ────────────────────── */
.ep-media-row {
  position: relative; margin: 0 -1rem 2.5rem;
}
.ep-cover-wrap {
  width: 100%; height: 130px;
  background: linear-gradient(135deg, #0A2E47, #1B5E87);
  overflow: hidden; cursor: pointer; position: relative;
  display: flex; align-items: flex-end; justify-content: flex-end;
}
.ep-cover-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  transition: filter 0.2s;
}
.ep-cover-wrap:hover .ep-cover-bg { filter: brightness(0.72); }
.ep-cover-label {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; margin: 8px;
  background: rgba(0,0,0,0.52); color: #fff; border-radius: 8px;
  font-size: 0.78rem; font-weight: 600; backdrop-filter: blur(4px);
}
.ep-cover-label svg { stroke: #fff; fill: none; stroke-width: 2; }
.ep-avatar-wrap {
  position: absolute; left: 1.25rem; bottom: -38px;
  width: 78px; height: 78px;
  border-radius: 50%; cursor: pointer; z-index: 10;
  border: 3px solid var(--bg);
}
.ep-avatar {
  width: 100%; height: 100%; border-radius: 50%;
  background: linear-gradient(135deg, #1B5E87, #0A2E47);
  display: flex; align-items: center; justify-content: center;
  background-size: cover; background-position: center; overflow: hidden;
}
.ep-avatar svg { width: 40px; height: 40px; fill: rgba(255,255,255,0.45); }
.ep-avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.18s;
}
.ep-avatar-overlay svg { stroke: #fff; fill: none; stroke-width: 2; }
.ep-avatar-wrap:hover .ep-avatar-overlay { opacity: 1; }
/* Spacer so avatar overlap doesn't hide first form field */
.ep-media-row ~ .form { padding-top: 46px; }

/* ── Map: CartoDB DarkMatter needs no CSS filter ─────── */
:root:not([data-theme="light"]) .leaflet-tile-pane .leaflet-tile {
  filter: none;
}
/* Readable map attribution in dark mode */
:root:not([data-theme="light"]) .leaflet-control-attribution {
  background: rgba(10,20,38,0.80) !important; color: #94a3b8 !important; font-size: 10px;
}
:root:not([data-theme="light"]) .leaflet-control-attribution a { color: #64a5d0 !important; }

/* Leaflet zoom control dark polish */
:root:not([data-theme="light"]) .leaflet-control-zoom a {
  background: rgba(12,24,48,0.92) !important;
  color: #D4A853 !important;
  border-color: rgba(212,168,83,0.25) !important;
}
:root:not([data-theme="light"]) .leaflet-control-zoom a:hover {
  background: rgba(27,94,135,0.9) !important; color: #fff !important;
}

/* Leaflet popup dark polish */
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: 0 12px 36px rgba(0,0,0,0.35); }
.leaflet-popup-content { margin: 12px 16px; font-size: 13px; line-height: 1.5; }
:root[data-theme="light"] .leaflet-popup-content-wrapper { background: #fff; color: #0f172a; }
:root:not([data-theme="light"]) .leaflet-popup-content-wrapper { background: #0f2236; color: #e2eaf5; border: 1px solid rgba(255,255,255,0.08); }
:root:not([data-theme="light"]) .leaflet-popup-tip { background: #0f2236; }

/* ── Cards: richer depth ─────────────────────────────── */
.card { border-radius: 16px; transition: box-shadow 0.2s, transform 0.15s; }
.card:active { transform: scale(0.985); }
:root[data-theme="light"] .card {
  box-shadow: 0 2px 14px rgba(10,30,60,0.07), 0 0 0 1px rgba(0,0,0,0.04);
}

/* ── Settings link items ─────────────────────────────── */
.setting-link {
  display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font-size: 0.88rem; font-weight: 500; cursor: pointer;
  margin-bottom: 6px; transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.setting-link:hover { background: var(--surface-3); border-color: var(--primary); }
.setting-link.danger { color: #e74c3c; border-color: rgba(231,76,60,0.22); }
.setting-link.danger:hover { background: rgba(231,76,60,0.07); border-color: #e74c3c; }

/* ── Settings section header ─────────────────────────── */
.settings-section { margin-bottom: 1.25rem; }
.settings-section h3 {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted); margin-bottom: 8px; padding: 0 4px;
}

/* ── Profile cover banner ────────────────────────────── */
.profile-cover {
  height: 145px;
  background: linear-gradient(135deg, #071a2e 0%, #1B5E87 55%, #0E4A78 100%);
  position: relative; overflow: visible;
}
.profile-cover::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 60%, rgba(212,168,83,0.12) 0%, transparent 70%);
}
.profile-avatar {
  position: absolute; bottom: -36px; left: 1.25rem;
  width: 74px; height: 74px; border-radius: 50%;
  border: 3px solid var(--bg);
  background: linear-gradient(135deg, #1B5E87, #071a2e);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; overflow: hidden;
  background-size: cover; background-position: center; z-index: 2;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.profile-info { padding: 2.75rem 1.25rem 1.25rem; }
.profile-name { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; }
.profile-nationality { font-size: 0.82rem; color: var(--text-muted); margin: 0.1rem 0 0.5rem; }
.profile-bio { font-size: 0.87rem; line-height: 1.6; color: var(--text-muted); margin-bottom: 0.75rem; }
.profile-stats {
  display: flex; gap: 0; justify-content: space-around; text-align: center;
  padding: 0.9rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.stat-item { flex: 1; }
.stat-val { font-size: 1.5rem; font-weight: 800; color: var(--gold); }
.stat-lbl { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Profile admin link button ───────────────────────── */
.profile-admin-link {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  background: linear-gradient(135deg, #1B5E87, #2577AB);
  color: #fff; padding: 12px 16px; border-radius: 12px;
  text-decoration: none; font-weight: 700; font-size: 0.88rem; margin-top: 0.6rem;
  border: 1px solid rgba(255,255,255,0.12); transition: filter 0.2s;
}
.profile-admin-link:hover { filter: brightness(1.12); }

/* ── Notification swipe-to-act ────────────────────────────── */
.notif-card {
  position: relative; overflow: hidden;
  cursor: grab; user-select: none;
}
.notif-card-inner {
  position: relative; z-index: 1;
  background: var(--card);
  will-change: transform;
}
.notif-swipe-hint {
  position: absolute; top: 0; bottom: 0;
  display: flex; align-items: center;
  font-size: 0.82rem; font-weight: 700;
  padding: 0 1.25rem; opacity: 0;
  transition: opacity 0.15s; z-index: 0;
  pointer-events: none;
}
.notif-swipe-read   { left: 0; background: rgba(46,139,87,0.85); color: #fff; border-radius: var(--radius) 0 0 var(--radius); }
.notif-swipe-delete { right: 0; background: rgba(231,76,60,0.85); color: #fff; border-radius: 0 var(--radius) var(--radius) 0; }
.notif-hinting-read   .notif-swipe-read   { opacity: 1; }
.notif-hinting-delete .notif-swipe-delete { opacity: 1; }

/* ── Map filter pill active state ────────────────────── */
.filter-pill.active {
  background: linear-gradient(135deg, var(--primary), #2577AB) !important;
  border-color: transparent !important; color: #fff !important;
  box-shadow: 0 3px 12px rgba(27,94,135,0.40);
}

/* ── Quick-create chip buttons ───────────────────────── */
.sc-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.sc-chip {
  padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer;
  font-size: 13px; font-weight: 600; transition: all 0.15s; font-family: inherit;
}
.sc-chip:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.2); }
.sc-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Dark mode form inputs ───────────────────────────── */
:root:not([data-theme="light"]) input,
:root:not([data-theme="light"]) textarea,
:root:not([data-theme="light"]) select {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.1); color: var(--text);
}
:root:not([data-theme="light"]) input:focus,
:root:not([data-theme="light"]) textarea:focus,
:root:not([data-theme="light"]) select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,94,135,0.22);
}

/* ── Button shimmer effect ───────────────────────────── */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: translateX(-100%); transition: transform 0.4s ease;
}
.btn-primary:hover::after { transform: translateX(100%); }

/* ── Improved toast ─────────────────────────────────── */
.toast { border-radius: 12px; font-weight: 600; backdrop-filter: blur(10px); box-shadow: 0 8px 28px rgba(0,0,0,0.28); }

/* ── Empty state ────────────────────────────────────── */
.empty-state { text-align: center; padding: 2.5rem 1.5rem; }
.empty-icon { font-size: 3rem; margin-bottom: 0.75rem; opacity: 0.6; }
.empty-msg { font-weight: 700; font-size: 1rem; margin-bottom: 0.25rem; }
.empty-sub { color: var(--text-muted); font-size: 0.85rem; }

/* ── Salah actions ───────────────────────────────────── */
.salah-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 1rem 0; }
.salah-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px; border-radius: 14px; border: 1.5px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer;
  font-size: 0.82rem; font-weight: 600; font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.salah-btn svg { width: 22px; height: 22px; stroke: var(--gold); fill: none; stroke-width: 2; }
.salah-btn:hover { background: var(--surface-3); border-color: var(--primary); transform: translateY(-1px); }

/* ══════════════════════════════════════════════════════════════
   FINAL POLISH — Explore button, search box, dark map
══════════════════════════════════════════════════════════════ */

/* ── Explore (centre nav) button: gold puck in BOTH themes when active ── */
/* Light mode specificity fix — override :root[theme="light"] .nav-btn.active */
:root[data-theme="light"] .nav-btn.salah-nav.active .salah-nav-inner {
  background: linear-gradient(135deg, #D4A853, #b88b3a) !important;
  box-shadow: 0 4px 14px rgba(212,168,83,0.40) !important;
  border-color: rgba(255,255,255,0.25) !important;
}
:root[data-theme="light"] .nav-btn.salah-nav.active { color: #D4A853 !important; }

/* Dark mode: ensure gold gradient active puck (already correct, belt-and-braces) */
:root:not([data-theme="light"]) .nav-btn.salah-nav.active .salah-nav-inner {
  background: linear-gradient(135deg, #D4A853, #b88b3a) !important;
  box-shadow: 0 4px 14px rgba(212,168,83,0.45) !important;
}
:root:not([data-theme="light"]) .nav-btn.salah-nav.active { color: #D4A853 !important; }

/* Inactive explore puck: keep primary-blue circle (not active) */
:root[data-theme="light"] .nav-btn.salah-nav:not(.active) .salah-nav-inner {
  background: var(--primary) !important;
}

/* ── Top-bar logo: ensure always visible on root panels ── */
/* (JS sets display:block for root panels; this guards against flicker) */
#screen-app .top-bar #topLogo { visibility: visible; }

/* ── Search bar: tighter, never overflows under FABs ──── */
.map-overlay-top {
  /* ensure FABs on right don't overlap search on small screens */
  padding-right: 0 !important;
}
/* Light mode search pill */
:root[data-theme="light"] .map-search {
  background: rgba(255,255,255,0.96) !important;
  box-shadow: 0 2px 12px rgba(10,30,60,0.12) !important;
}
/* Dark mode search pill */
:root:not([data-theme="light"]) .map-search {
  background: rgba(10,20,38,0.90) !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.40) !important;
}

/* ── Dark map: slightly brighten road labels ── */
:root:not([data-theme="light"]) #panel-map { background: #060d18; }
:root:not([data-theme="light"]) .leaflet-tile-pane { filter: brightness(0.97) contrast(1.04); }

/* ── Grey tile artefact fix: bg matches dark tile base colour ── */
:root:not([data-theme="light"]) #leafletMap { background: #1a1a2e; }
:root[data-theme="light"]       #leafletMap { background: #e8ecf0; }

/* ── Filter pills: slightly larger touch target ── */
.filter-pill {
  padding: 0.32rem 0.9rem;
  font-size: 0.72rem;
  font-weight: 600;
}
