/* ══════════════════════════════════════════════════════════════════════════
   DIRA · GOVERNMENT EMERGENCY SYSTEM · v7
   Design Language: Official Bahraini Emergency Authority
   Authoritative · Institutional · Precise
══════════════════════════════════════════════════════════════════════════ */

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── DESIGN TOKENS ── */
:root {
  /* Official Light Theme */
  --bg:              #F0F3F7;
  --bg2:             #FFFFFF;
  --bg3:             #E6EAF2;
  --bg4:             #D8DEE9;
  --border:          #C8D0DE;
  --border-strong:   #9AAABF;
  --text:            #0A1628;
  --text-muted:      #4E5F78;
  --text-faint:      #8293A8;

  /* Bahrain Official Colors */
  --red:             #CE1126;   /* Flag red exact */
  --red-dark:        #A30D1D;
  --red-dim:         rgba(206, 17, 38, 0.07);
  --red-band:        rgba(206, 17, 38, 0.12);
  --navy:            #1B3A6B;
  --navy-light:      #2D5499;
  --navy-dim:        rgba(27, 58, 107, 0.08);

  --green:           #1A6E3C;
  --green-dim:       rgba(26, 110, 60, 0.09);
  --amber:           #965C00;
  --amber-dim:       rgba(150, 92, 0, 0.09);
  --blue:            #1B3A6B;
  --blue-dim:        rgba(27, 58, 107, 0.09);

  /* Typography */
  --font-head:       'Cairo', sans-serif;
  --font-ui:         'Cairo', sans-serif;
  --font-body:       'Cairo', sans-serif;
  --font-mono:       'IBM Plex Mono', monospace;

  --r:               2px;
  --r-md:            4px;
  --shadow-sm:       0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --shadow:          0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --glass-bg:        rgba(255, 255, 255, 0.7);
  --glass-border:    rgba(255, 255, 255, 0.3);
  --nav-height:      58px;
}

/* SHADOW / NIGHT MODE */
.shadow-mode {
  --bg:              #030D1A;
  --bg2:             #081525;
  --bg3:             #0E1F35;
  --bg4:             #162840;
  --border:          #1C3050;
  --border-strong:   #2A4468;
  --text:            #D8E4F0;
  --text-muted:      #6688AA;
  --text-faint:      #3D5470;
  --red-dim:         rgba(206, 17, 38, 0.14);
  --red-band:        rgba(206, 17, 38, 0.2);
  --navy:            #4070B8;
  --navy-light:      #5585CC;
  --navy-dim:        rgba(64, 112, 184, 0.14);
  --shadow-sm:       none;
  --shadow:          none;
}

/* RTL */
[dir="rtl"] {
  --font-head: 'Noto Kufi Arabic', sans-serif;
  --font-body: 'Cairo', sans-serif;
  --font-ui:   'Cairo', sans-serif;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  font-family: 'Cairo', sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  min-height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.3s, color 0.3s;
}

a  { text-decoration: none; color: inherit; }
button { font-family: var(--font-body); }
input, textarea { font-family: var(--font-body); }
h1, h2, h3, h4, h5, h6 { font-weight: 700; }
button, .icon-btn, .nav-item, .tab, .phase-btn, .manual-btn, .action-btn, a {
  transition: all 0.3s ease-in-out;
}

/* ── SPLASH ─────────────────────────────────────────────────────────────── */
/* Keep splash exactly as-is per user request */
.splash {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.55s ease, visibility 0.55s ease;
}
.splash.out { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-inner { text-align: center; padding: 24px; }

.splash-logo {
  width: 120px; height: 120px;
  object-fit: contain; border-radius: 50%;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 30px var(--red-dim));
  animation: pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 20px var(--red-dim)); }
  50%       { filter: drop-shadow(0 0 50px rgba(206,17,38,0.35)); }
}

.splash-title {
  font-family: var(--font-head);
  font-size: 80px; letter-spacing: 14px;
  line-height: 1; color: var(--text);
}
.splash-sub {
  color: var(--text-muted); font-size: 12px;
  letter-spacing: 3px; text-transform: uppercase;
  margin: 10px 0 32px;
}
.splash-bar {
  width: 200px; height: 3px;
  background: var(--bg3); border-radius: 99px;
  margin: 0 auto; overflow: hidden;
}
.splash-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--red), #E8364A);
  border-radius: 99px;
  animation: fill-bar 2.2s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes fill-bar { to { width: 100%; } }

/* ── HIDDEN UTIL ─────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── APP SHELL ───────────────────────────────────────────────────────────── */
.app {
  display: flex; flex-direction: column;
  min-height: 100dvh;
  max-width: 600px; margin: 0 auto;
  background: var(--bg);
  overflow: visible;
  position: relative;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* ── HEADER ──────────────────────────────────────────────────────────────── */
.header {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  padding-right: 20px;
  height: 52px;
  background: var(--navy);
  border-bottom: 3px solid var(--red);
  z-index: 100;
  position: relative;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}
.header::-webkit-scrollbar {
  display: none;
}

.header-brand {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.header-logo {
  width: 28px; height: 28px;
  object-fit: contain; border-radius: 50%;
  opacity: 0.95;
}
.header-title {
  font-family: var(--font-head);
  font-size: clamp(1rem, 2vw, 1.25rem); letter-spacing: 2px;
  color: #FFFFFF; line-height: 1;
}

/* Official tagline next to title */
.header-brand::after {
  content: 'Emergency Navigation';
  font-family: var(--font-ui);
  font-size: 10px; font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  border-left: 1px solid rgba(255,255,255,0.2);
  padding-left: 10px;
  margin-left: 2px;
  line-height: 1;
}
[dir="rtl"] .header-brand::after {
  border-left: none;
  border-right: 1px solid rgba(255,255,255,0.2);
  padding-left: 0; margin-left: 0;
  padding-right: 10px; margin-right: 2px;
}

.header-controls { display: flex; align-items: center; gap: 6px; }

/* Status Badge */
.status-badge {
  display: none;
  align-items: center; gap: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 2px; padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 400;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.5px;
}
@media (min-width: 340px) { .status-badge { display: flex; } }

.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.4);
  animation: blink 1.2s ease infinite;
  flex-shrink: 0;
}
.status-badge.ready .status-dot   { background: #4ADE80; animation: none; }
.status-badge.ready #statusText   { color: #86EFAC; }
.status-badge.error .status-dot   { background: #FCA5A5; animation: none; }
.status-badge.error #statusText   { color: #FCA5A5; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.25} }

.icon-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  font-size: 13px; cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  transition: all .3s ease-in-out;
  font-family: var(--font-body);
}
.icon-btn i {
  font-size: 16px;
}
.lang-toggle {
  width: auto;
  min-width: 86px;
  padding: 0 10px;
  gap: 6px;
}
.lang-toggle #langCode {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.install-btn {
  width: auto;
  min-width: 64px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.theme-toggle {
  flex-shrink: 0;
  scroll-snap-align: end;
}
.theme-toggle {
  flex-shrink: 0;
  scroll-snap-align: end;
}
.theme-toggle {
  flex-shrink: 0;
  scroll-snap-align: end;
}
.icon-btn:hover { background: rgba(255,255,255,0.15); }
.icon-btn:active { opacity: 0.7; }
#langCode { font-family: var(--font-mono); font-size: 9px; font-weight: 600; margin-left: 1px; }

/* ── NAVIGATION BAR ──────────────────────────────────────────────────────── */
.main-nav {
  flex-shrink: 0;
  height: var(--nav-height);
  background: var(--glass-bg);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  z-index: 100;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow);
}

.nav-item {
  flex: 1;
  background: none; border: none;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.3s ease-in-out, background 0.3s ease-in-out;
  border-top: 2px solid transparent;
  font-size: 11px;
  position: relative;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active {
  color: var(--navy);
  border-top-color: var(--navy);
  background: var(--navy-dim);
}
.nav-sos.active {
  color: var(--red);
  border-top-color: var(--red);
  background: var(--red-dim);
}

.nav-icon { font-size: 18px; line-height: 1; color: #2C3E50; }
.nav-icon i { font-size: 1.1rem; }
.nav-sos .nav-icon { color: var(--red); }
.nav-label {
  font-family: var(--font-ui);
  font-size: clamp(0.55rem, 1.4vw, 0.68rem); font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
}

/* ── MAIN CONTENT ────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}

.view-section {
  position: relative;
  min-height: calc(100dvh - var(--nav-height) - 52px);
  display: flex; flex-direction: column;
  background: var(--bg);
}

/* ── DESKTOP RESTORATION ── */
@media (min-width: 1024px) {
  .app {
    height: 100dvh;
    overflow: hidden;
    border-radius: 8px;
    margin: 2vh auto;
    box-shadow: var(--shadow);
  }
  .view-section {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    min-height: 0;
  }
}

/* ── MAP VIEW ────────────────────────────────────────────────────────────── */
/* Section label strip */
.tabs {
  flex-shrink: 0;
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  z-index: 90;
}

.tab {
  flex: 1; padding: 12px 4px;
  background: none; border: none;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: clamp(0.72rem, 1.5vw, 0.82rem); font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tab i {
  color: #2C3E50;
  font-size: 1rem;
}
.tab.active i {
  color: var(--red);
}
.tab.active {
  color: var(--text);
  border-bottom-color: var(--red);
}

/* Phase Toggle */
.phase-toggle {
  display: flex;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  padding: 0;
}
.phase-btn {
  flex: 1; padding: 9px 12px;
  background: none;
  border: none; border-right: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 11px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer; transition: all .15s;
}
.phase-btn:last-child { border-right: none; }
.phase-btn.active {
  background: var(--navy);
  color: #fff;
}

/* Map */
.map-container {
  height: 240px; width: 100%; flex-shrink: 0;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

/* Location error */
.location-error {
  margin: 12px 16px;
  background: var(--red-dim);
  border: 1px solid var(--red-band);
  border-left: 3px solid var(--red);
  padding: 12px 14px;
  font-size: 13px; flex-shrink: 0;
}
.manual-row { display: flex; gap: 8px; margin-top: 10px; }
.manual-input {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.manual-input:focus { border-color: var(--navy); }
.manual-btn {
  background: var(--navy); color: white;
  border: none; border-radius: var(--r);
  padding: 0 16px;
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
}

/* Results list */
.results-list {
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 8px;
}

/* ── FACILITY CARDS ──────────────────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--border-strong);
  border-radius: 16px;
  padding: 0;
  display: flex; flex-direction: column;
  animation: slide-up .25s ease both;
  overflow: hidden;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  box-shadow: var(--shadow);
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-top {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
}

/* Rank column */
.card-rank {
  display: flex; align-items: center; justify-content: center;
  width: 44px; min-height: 54px;
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 600;
  color: var(--text-faint);
  background: var(--bg3);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.card-info {
  flex: 1; padding: 10px 12px;
}
.card-name-row {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px;
  margin-bottom: 3px;
}
.card-name {
  font-family: var(--font-ui);
  font-size: 15px; font-weight: 700;
  letter-spacing: 0.2px; line-height: 1.2;
  color: var(--text);
}
.card-address {
  font-family: var(--font-body);
  font-size: 11px; color: var(--text-muted);
  margin-top: 2px;
}

/* Badges */
.phase-badge, .type-badge {
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 5px;
  border-radius: var(--r);
  border: 1px solid;
}
.phase-1 {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(26, 110, 60, 0.2);
}
.phase-2 {
  background: var(--amber-dim);
  color: var(--amber);
  border-color: rgba(150, 92, 0, 0.2);
}
.type-badge {
  background: var(--navy-dim);
  color: var(--navy);
  border-color: rgba(27, 58, 107, 0.2);
}

/* Card meta row */
.card-meta {
  display: flex; align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.meta-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 400;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
}
.meta-chip:last-child { border-right: none; }
.chip-label {
  font-family: var(--font-ui);
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-faint);
}

/* Navigate button */
.navigate-btn {
  background: none;
  color: var(--navy);
  border: none;
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  cursor: pointer;
  display: flex; align-items: center; justify-content: flex-start; gap: 8px;
  transition: background .15s, color .15s;
  width: 100%;
}
.navigate-btn:hover {
  background: var(--navy-dim);
}
.navigate-btn::before {
  content: '▶';
  font-size: 9px;
  opacity: 0.6;
}

/* ── NEWS VIEW ───────────────────────────────────────────────────────────── */
.news-header-strip {
  display: flex; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.news-header-strip h2 {
  font-family: var(--font-ui);
  font-size: 14px; font-weight: 700;
  color: var(--text);
  letter-spacing: 2px; text-transform: uppercase;
  border-left: 3px solid var(--red);
  padding-left: 10px; line-height: 1;
}
[dir="rtl"] .news-header-strip h2 {
  border-left: none; border-right: 3px solid var(--red);
  padding-left: 0; padding-right: 10px;
}

.news-grid {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--border);
  padding: 0;
}

/* Section label inside grid */
.col-title {
  font-family: var(--font-ui);
  font-size: 10px; font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 2px;
  padding: 10px 16px 6px;
  background: var(--bg);
}

.news-col {
  display: flex; flex-direction: column; gap: 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
}

/* Live broadcast panels */
.news-panels-row {
  display: flex; flex-direction: column; gap: 0;
  background: var(--border);
}
@media (min-width: 480px) {
  .news-panels-row { flex-direction: row; }
}

.news-card.live-panel {
  flex: 1;
  background: var(--bg2);
  border: none;
  padding: 14px 16px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  border-left: 3px solid var(--red);
  transition: background .15s;
}
[dir="rtl"] .news-card.live-panel {
  border-left: none; border-right: 3px solid var(--red);
}
.news-card.live-panel:hover { background: var(--bg3); }

.card-row { display: flex; align-items: center; gap: 8px; }
.card-title {
  font-family: var(--font-ui);
  font-size: 14px; font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text);
}

.live-indicator {
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 600;
  color: var(--red);
  letter-spacing: 1px;
  animation: pulse-live 1.5s infinite;
  flex-shrink: 0;
}
@keyframes pulse-live { 0%,100%{opacity:1} 50%{opacity:0.4} }

.panel-desc {
  font-size: 12px; color: var(--text-muted);
  font-family: var(--font-body);
}
.panel-source {
  font-family: var(--font-mono);
  font-size: 9px; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-top: auto;
}

/* Intelligence grid panel */
.news-panel-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-top: 1px solid var(--glass-border);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.full-width-panel {
  width: 100%;
}

/* Intel cards - override inline styles */
#intelligence-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 0 !important;
  padding: 0 !important;
  background: var(--border);
}

.intel-card {
  background: var(--bg2) !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 14px 16px !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.intel-card h4 {
  font-family: var(--font-ui) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  color: var(--text) !important;
  margin-top: 0 !important;
  text-transform: uppercase;
}
.intel-card p {
  font-size: 11px !important;
  color: var(--text-muted) !important;
  height: auto !important;
  line-height: 1.4 !important;
}
.intel-card button {
  width: 100% !important;
  background: var(--navy) !important;
  color: white !important;
  border: none !important;
  padding: 8px 12px !important;
  border-radius: var(--r) !important;
  cursor: pointer !important;
  font-family: var(--font-ui) !important;
  font-size: 11px !important; font-weight: 700 !important;
  letter-spacing: 1px !important; text-transform: uppercase !important;
  transition: background .15s !important;
}
.intel-card button:hover { background: var(--navy-light) !important; }

/* Quick links */
.quick-links-row {
  display: flex; gap: 0; padding: 0;
  background: var(--border);
}

.quick-link-card {
  flex: 1;
  background: var(--bg2);
  border: none;
  padding: 12px 14px;
  font-family: var(--font-ui);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
  transition: background .15s, color .15s;
}
.quick-link-card:hover { background: var(--bg3); color: var(--navy); }
.link-icon { font-size: 14px; }

/* Press list */
.press-col {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding-bottom: 4px;
}

.press-section-label {
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 1.5px;
  padding: 10px 16px 6px;
}
.press-list { display: flex; flex-direction: column; }
.press-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px; font-weight: 600;
  border-bottom: 1px solid var(--border);
  transition: background .15s, color .15s;
}
.press-card:last-child { border-bottom: none; }
.press-card:hover { background: var(--bg3); color: var(--navy); }
.arrow {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--text-faint);
}

/* Official col */
.official-col {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding-bottom: 4px;
}

.news-footer {
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 9px; color: var(--text-faint);
  text-align: center;
  background: var(--bg);
  border-top: 1px solid var(--border);
  letter-spacing: 0.5px;
}

/* ── CONTACTS VIEW ───────────────────────────────────────────────────────── */
.contacts-container {
  padding: 0;
  display: flex; flex-direction: column;
  gap: 0;
}

.contact-column {
  border-bottom: 1px solid var(--border);
}
.contact-column h3 {
  font-family: var(--font-ui);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 2px;
  color: var(--text-faint);
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.contact-list { display: flex; flex-direction: column; }

.contact-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  transition: background .15s;
}
.contact-item:last-child { border-bottom: none; }
.contact-item:hover { background: var(--bg3); }
.contact-name {
  font-family: var(--font-body);
  font-weight: 600; font-size: 13px;
  color: var(--text);
}
.contact-action {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--navy);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg3);
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.contact-action:hover { background: var(--navy-dim); border-color: var(--navy); }
.contact-action.phone-action {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(26,110,60,0.2);
}

/* ── SOS VIEW ────────────────────────────────────────────────────────────── */
.sos-wrapper {
  padding: 24px 20px;
  display: flex; flex-direction: column; align-items: center;
  gap: 20px;
}

/* Emergency status bar at top */
.sos-wrapper::before {
  content: '— EMERGENCY ACTIVATION PANEL —';
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 2px;
  color: var(--text-faint);
  text-transform: uppercase;
  align-self: stretch; text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.sos-big-btn {
  width: 240px; height: 240px;
  border-radius: 50%;
  border: 6px solid rgba(206, 17, 38, 0.25);
  outline: 2px solid var(--border);
  outline-offset: 6px;
  background: var(--red);
  color: white;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.sos-big-btn:active { transform: scale(0.96); }
.sos-big-btn::before {
  content: 'PRESS AND HOLD';
  position: absolute;
  bottom: 28px;
  font-family: var(--font-mono);
  font-size: 8px; letter-spacing: 2px;
  opacity: 0.5;
}

.sos-icon { font-size: 56px; margin-bottom: 6px; }
.sos-label {
  font-family: var(--font-head);
  font-size: 32px; letter-spacing: 3px; line-height: 1;
}
.sos-sub { font-size: 9px; letter-spacing: 2px; opacity: 0.65; margin-top: 4px; font-family: var(--font-mono); }

.sos-status {
  display: flex; align-items: center; gap: 10px;
  background: var(--red); color: white;
  padding: 8px 20px;
  font-family: var(--font-mono);
  font-weight: 600; font-size: 12px; letter-spacing: 2px;
  animation: pulse-red 1s infinite;
  width: 100%; justify-content: center;
}
@keyframes pulse-red { 0%{opacity:1} 50%{opacity:0.75} }
.pulse-dot { width: 8px; height: 8px; background: white; border-radius: 50%; flex-shrink: 0; }

/* Checklist */
.checklist-container {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.checklist-container h3 {
  font-family: var(--font-ui);
  font-size: 11px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-faint);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.checklist-items { display: flex; flex-direction: column; }
.check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; cursor: pointer;
  transition: background .15s;
}
.check-item:last-child { border-bottom: none; }
.check-item:hover { background: var(--bg3); }
.check-item input {
  width: 16px; height: 16px;
  accent-color: var(--navy);
  flex-shrink: 0;
}
.check-item.checked span {
  text-decoration: line-through;
  color: var(--text-faint);
}

/* Survival Encyclopedia */
.survival-container {
  width: 100%;
}
.survival-container h3 {
  font-family: var(--font-ui);
  font-size: 11px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-faint);
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

/* Search bar */
.search-wrapper { padding: 10px 14px; background: var(--bg2); border-bottom: 1px solid var(--border); }
.search-wrapper .manual-input { width: 100%; }

/* Survival guide cards */
.survival-card {
  background: var(--bg2) !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  padding: 14px !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
  border-left: 3px solid var(--border-strong) !important;
}

.survival-head { margin-bottom: 10px !important; }
.survival-icon { font-size: 1.5rem !important; }
.survival-title {
  font-family: var(--font-ui) !important;
  font-size: 14px !important; font-weight: 700 !important;
  letter-spacing: 0.3px !important;
  color: var(--text) !important;
}
.survival-steps {
  font-size: 12px !important; line-height: 1.6 !important;
  color: var(--text-muted) !important;
}

/* Survival action button */
.action-btn {
  background: var(--navy) !important;
  color: white !important;
  border-radius: var(--r) !important;
  font-family: var(--font-ui) !important;
  font-size: 12px !important; font-weight: 700 !important;
  letter-spacing: 1px !important; text-transform: uppercase !important;
}
.action-btn:hover { background: var(--navy-light) !important; }

/* Tag badges */
.tag-badge {
  font-family: var(--font-mono) !important;
  font-size: 9px !important; font-weight: 600 !important;
  background: var(--bg3) !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border) !important;
  letter-spacing: 0.5px !important;
}

/* ── SOS STROBE ──────────────────────────────────────────────────────────── */
.sos-active body {
  animation: emergency-flash 0.1s infinite;
}
@keyframes emergency-flash {
  0%, 49%  { background-color: #CE1126; color: #ffffff; }
  50%, 100% { background-color: #ffffff; color: #CE1126; }
}

#sosOverlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(206, 17, 38, 0.2); /* Slight tint overlay */
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

#stopSosBtn {
  background: white; 
  color: #CE1126;
  border: 8px solid #CE1126;
  font-family: var(--font-head);
  font-size: 48px; 
  font-weight: 700; 
  letter-spacing: 4px;
  padding: 40px 60px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-transform: uppercase;
  animation: pulse-btn 1s infinite;
  max-width: 90%;
  text-align: center;
  line-height: 1.2;
}

@keyframes pulse-btn {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.sos-strobe { display: none; }

/* ── MODAL ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(3, 13, 26, 0.75);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-content {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-top: 4px solid var(--red);
  border-radius: 16px;
  padding: 0;
  max-width: 400px; width: 100%;
  overflow: hidden;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  box-shadow: var(--shadow);
}
.modal-content h3 {
  font-family: var(--font-ui);
  font-size: 16px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--text);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.modal-content p {
  font-size: 13px; line-height: 1.6;
  padding: 12px 20px 0;
  color: var(--text-muted);
}
.modal-content button {
  display: block;
  background: var(--navy); color: white;
  border: none; padding: 13px 24px;
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer; margin: 16px 20px 20px; width: calc(100% - 40px);
  transition: background .15s;
}
.modal-content button:hover { background: var(--navy-light); }

/* ── RESPONSIVE DESKTOP ──────────────────────────────────────────────────── */
@media (min-width: 1024px) {
  .app {
    max-width: 100%;
    height: 100vh;
    display: grid;
    grid-template-columns: 70px 380px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "nav header header"
      "nav content content";
  }

  .header { grid-area: header; }
  .main-nav {
    grid-area: nav;
    flex-direction: column;
    height: 100%;
    border-top: none;
    border-right: 1px solid var(--border);
    justify-content: flex-start;
    padding-top: 16px; gap: 0;
    background: var(--bg2);
  }
  .nav-item {
    height: 64px;
    border-top: none;
    border-right: 3px solid transparent;
    width: 100%;
  }
  .nav-item.active {
    border-right-color: var(--navy);
    border-top-color: transparent;
  }
  .nav-sos.active {
    border-right-color: var(--red);
    border-top-color: transparent;
  }
  .main-content { grid-area: content; display: block; position: relative; }

  #view-map {
    display: grid;
    grid-template-columns: 380px 1fr;
    grid-template-rows: auto auto auto 1fr;
    grid-template-areas:
      "tabs    map"
      "phase   map"
      "error   map"
      "list    map";
  }
  #view-map.active { display: grid; }
  #view-map .tabs       { grid-area: tabs; }
  #view-map .phase-toggle { grid-area: phase; }
  #view-map .location-error { grid-area: error; }
  #view-map .results-list   { grid-area: list; overflow-y: auto; border-right: 1px solid var(--border); }
  #view-map .map-container  { grid-area: map; height: 100% !important; border-bottom: none; }

  [dir="rtl"] .app {
    grid-template-columns: 1fr 380px 70px;
    grid-template-areas:
      "header header nav"
      "content content nav";
  }
  [dir="rtl"] .main-nav {
    border-right: none;
    border-left: 1px solid var(--border);
  }
  [dir="rtl"] .nav-item {
    border-right: none;
    border-left: 3px solid transparent;
  }
  [dir="rtl"] .nav-item.active { border-left-color: var(--navy); }
  [dir="rtl"] .nav-sos.active  { border-left-color: var(--red); }

  [dir="rtl"] #view-map {
    grid-template-columns: 1fr 380px;
    grid-template-areas:
      "map tabs"
      "map phase"
      "map error"
      "map list";
  }
  [dir="rtl"] #view-map .results-list { border-right: none; border-left: 1px solid var(--border); }
}

/* ── NEWS GRID RESPONSIVE ────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .news-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    align-items: start;
    background: var(--border);
    gap: 1px;
  }
  .news-panels-row { grid-column: 1 / -1; }
  .full-width-panel { grid-column: 1 / -1; }
  .official-col, .press-col { gap: 0; }
}

/* ── UTILITY ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); }

/* Video embed */
.video-embed { border-top: 1px solid var(--border); margin-top: 8px; }

/* ── PANEL HEADER ── */
.panel-header {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 12px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-muted);
}
