/* ══════════════════════════════════════════════════════
   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; }
.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);
}
.arabic-sub {
  font-family: 'Amiri', serif;
  font-size: 1.2rem;
  color: var(--primary-lt);
  margin: 0.4rem 0;
}
.splash-sub { color: var(--muted); font-size: 0.9rem; margin-top: 0.3rem; }

.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;
}
.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; }
.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);
}

/* ─── BUTTONS ───────────────────────────────────────── */
button { cursor: pointer; font-family: 'Amiri', serif; }

.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; }

/* ─── 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 {
  width: 80px; height: 80px; border-radius: 50%;
  border: 3px solid var(--bg); background: var(--card);
  position: absolute; bottom: -40px; left: 1.25rem;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-size: 2rem;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.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; }

