/* SOS Platform - Ultra-light Mobile-First CSS (Optimized for iPhone 13 / iOS Safari) */
:root {
  --bg-primary: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  --police-color: #ef4444;
  --police-bg: rgba(239, 68, 68, 0.12);
  --police-border: rgba(239, 68, 68, 0.4);

  --medical-color: #0ea5e9;
  --medical-bg: rgba(14, 165, 233, 0.12);
  --medical-border: rgba(14, 165, 233, 0.4);

  --rescue-color: #8b5cf6;
  --rescue-bg: rgba(139, 92, 246, 0.12);
  --rescue-border: rgba(139, 92, 246, 0.4);
}

body.oled-mode {
  --bg-primary: #000000;
  --bg-card: #0a0a0a;
  --border-color: #222222;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.4;
  padding-bottom: calc(75px + env(safe-area-inset-bottom, 16px));
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 440px;
  margin: 0 auto;
  padding: 8px 12px;
}

/* Header - Ultra compact 1 row (with iOS Safe Area Top Inset) */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(4px + env(safe-area-inset-top, 0px)) 0 8px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.brand-logo {
  font-size: 20px;
  line-height: 1;
}

.brand-title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.3px;
  white-space: nowrap;
  background: linear-gradient(135deg, #ef4444, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 10px;
  background: #334155;
  color: #38bdf8;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
  white-space: nowrap;
}

/* Quick Tools Bar */
.quick-tools {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.tool-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 4px 6px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
}

.tool-btn.active {
  background: #ef4444;
  color: #fff;
  border-color: #dc2626;
}

/* Location Banner - Streamlined 2-Row Layout */
.location-banner {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 8px 10px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.location-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.location-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.loc-pin {
  font-size: 16px;
  flex-shrink: 0;
}

.location-value {
  font-size: 14px;
  font-weight: 800;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.location-distance {
  font-size: 11px;
  color: #38bdf8;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.location-coords {
  font-size: 11px;
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 1px 0;
}

.location-actions {
  display: flex;
  gap: 6px;
  width: 100%;
  padding-top: 4px;
  border-top: 1px solid rgba(51, 65, 85, 0.6);
}

.loc-btn {
  background: #0f172a;
  border: 1px solid #475569;
  color: #f8fafc;
  padding: 5px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
}

.loc-btn-primary {
  background: #0284c7;
  border-color: #0284c7;
}

/* Sleek Province Selector Bar */
.province-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 4px 8px;
}

.province-bar label {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 700;
  white-space: nowrap;
}

.province-bar select {
  flex: 1;
  background: transparent;
  color: #f8fafc;
  border: none;
  font-size: 12px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

/* 3 Main Action Cards - Compact Height for Mobile Screens */
.cards-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.action-card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 10px 12px;
  border: 1.5px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.action-card.police {
  border-color: var(--police-border);
  background: linear-gradient(180deg, var(--police-bg) 0%, var(--bg-card) 70%);
}

.action-card.medical {
  border-color: var(--medical-border);
  background: linear-gradient(180deg, var(--medical-bg) 0%, var(--bg-card) 70%);
}

.action-card.rescue {
  border-color: var(--rescue-border);
  background: linear-gradient(180deg, var(--rescue-bg) 0%, var(--bg-card) 70%);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.card-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.police .card-icon { background: rgba(239, 68, 68, 0.25); }
.medical .card-icon { background: rgba(14, 165, 233, 0.25); }
.rescue .card-icon { background: rgba(139, 92, 246, 0.25); }

.card-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.police .card-title { color: #f87171; }
.medical .card-title { color: #38bdf8; }
.rescue .card-title { color: #a78bfa; }

.line-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #cbd5e1;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Contact Display Box */
.contact-box {
  background: #0f172a;
  border-radius: 10px;
  padding: 6px 10px;
  margin-bottom: 8px;
  border: 1px solid #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.contact-info-col {
  min-width: 0;
  flex: 1;
}

.contact-name {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-phone-display {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.2;
}

/* Dual Action Buttons */
.card-buttons {
  display: flex;
  gap: 6px;
  width: 100%;
}

.btn-action {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 6px;
  min-height: 44px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.1s ease;
}

.btn-action:active {
  transform: scale(0.97);
}

.btn-call {
  color: #ffffff;
}

.police .btn-call { background: #dc2626; box-shadow: 0 3px 10px rgba(220, 38, 38, 0.4); }
.medical .btn-call { background: #0284c7; box-shadow: 0 3px 10px rgba(2, 132, 199, 0.4); }
.rescue .btn-call { background: #7c3aed; box-shadow: 0 3px 10px rgba(124, 58, 237, 0.4); }

.btn-sms {
  background: #1e293b;
  border: 1px solid #475569;
  color: #f1f5f9;
}

/* Fallback Switch Banner */
.fallback-banner {
  margin-top: 6px;
  padding: 5px 8px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  border: 1px dashed #475569;
}

.fallback-text {
  color: #fbbf24;
  font-weight: 700;
  font-size: 11px;
}

.btn-switch-line {
  background: #334155;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  max-width: 68%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bottom Emergency Utilities Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 440px;
  margin: 0 auto;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #334155;
  border-left: 1px solid #334155;
  border-right: 1px solid #334155;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  display: flex;
  justify-content: space-around;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 8px)) 10px;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.nav-item.active {
  color: #ef4444;
}

.nav-icon {
  font-size: 18px;
  line-height: 1;
}

/* Telemetry Feedback Sheet & Mobile Bottom Sheets */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 2000;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: none;
}

.modal-sheet {
  background: #1e293b;
  border-radius: 20px 20px 0 0;
  border-top: 2px solid #475569;
  width: 100%;
  max-width: 440px;
  max-height: 85dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 16px 14px calc(24px + env(safe-area-inset-bottom, 12px)) 14px;
  animation: slideUp 0.25s ease-out;
  transform: translateZ(0);
}

body.modal-open {
  position: fixed;
  width: 100%;
  overflow: hidden;
  touch-action: none;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-title {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
}

.sheet-desc {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 12px;
}

.feedback-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-feedback {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #334155;
  background: #0f172a;
  color: #f1f5f9;
  cursor: pointer;
  text-align: left;
}

.btn-feedback.success { border-color: #10b981; color: #34d399; }
.btn-feedback.busy { border-color: #f59e0b; color: #fbbf24; }
.btn-feedback.wrong { border-color: #ef4444; color: #f87171; }

/* Strobe Screen for Night Distress */
#strobe-screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: #fff;
  cursor: pointer;
}

/* Offline badge */
.offline-indicator {
  display: none;
  background: #f59e0b;
  color: #000;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  padding: 3px;
}

body.is-offline .offline-indicator {
  display: block;
}

/* Bystander Action & Modal */
.loc-btn-bystander {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #000;
  font-weight: 800;
  border: 1px solid #facc15;
}

.bystander-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000000;
  z-index: 10000;
  display: none;
  flex-direction: column;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(20px + env(safe-area-inset-bottom, 0px)) 16px;
  overflow-y: auto;
  box-sizing: border-box;
}

.bystander-box {
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 3px solid #eab308;
  border-radius: 16px;
  padding: 16px;
  background: #0a0a0a;
  animation: pulseBorder 2s infinite alternate;
}

@keyframes pulseBorder {
  0% { border-color: #eab308; box-shadow: 0 0 15px rgba(234, 179, 8, 0.4); }
  100% { border-color: #ef4444; box-shadow: 0 0 25px rgba(239, 68, 68, 0.6); }
}

.bystander-headline {
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  color: #facc15;
  line-height: 1.25;
  text-transform: uppercase;
}

.bystander-headline-sub {
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: #f87171;
  margin-top: 2px;
}

.bystander-info-card {
  background: #18181b;
  border: 1.5px solid #27272a;
  border-radius: 10px;
  padding: 12px;
}

.bystander-label {
  font-size: 11px;
  color: #a1a1aa;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.bystander-value {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  word-break: break-word;
}

.bystander-call-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 10px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 900;
  text-decoration: none;
  text-align: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.bystander-btn-115 {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
}

.bystander-btn-113 {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
}

.bystander-btn-ward {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #ffffff;
}

.bystander-close-btn {
  width: 100%;
  padding: 10px;
  background: #27272a;
  color: #e4e4e7;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 4px;
}

/* Legal Disclaimer Modal */
.disclaimer-text {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.disclaimer-section-title {
  font-size: 13px;
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 2px;
}

/* ============================================================ */
/* EMERGENCY READINESS SCORE & FIRST AID EXPANSION STYLES      */
/* ============================================================ */

/* Readiness Widget Card */
.readiness-card {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1.5px solid #334155;
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.readiness-card:active {
  transform: scale(0.98);
}

.readiness-left {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.readiness-svg {
  width: 44px;
  height: 44px;
  transform: rotate(-90deg);
}

.circle-bg {
  fill: none;
  stroke: #334155;
  stroke-width: 3.5;
}

.circle-bar {
  fill: none;
  stroke: #10b981;
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dasharray 0.4s ease;
}

.readiness-percent-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 900;
  color: #f1f5f9;
}

.readiness-info {
  flex: 1;
  min-width: 0;
}

.readiness-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}

.readiness-badge {
  font-size: 10.5px;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: 0.3px;
}

.readiness-status {
  font-size: 10px;
  font-weight: 700;
  color: #fbbf24;
}

.readiness-desc {
  font-size: 11.5px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.readiness-arrow {
  color: #64748b;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}

/* Checklist items in Readiness Modal */
.readiness-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checklist-item {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.checklist-item.done {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.05);
}

.chk-status {
  font-size: 18px;
  flex-shrink: 0;
}

.chk-content {
  flex: 1;
  min-width: 0;
}

.chk-title {
  font-size: 12px;
  font-weight: 800;
  color: #f8fafc;
}

.checklist-item.done .chk-title {
  color: #34d399;
}

.chk-sub {
  font-size: 10.5px;
  color: #94a3b8;
}

.chk-btn {
  background: #334155;
  color: #fff;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.checklist-item.done .chk-btn {
  background: transparent;
  color: #34d399;
  border: 1px solid #10b981;
  cursor: default;
}

/* First Aid Tabs */
.fa-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

.fa-tab-btn {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.fa-tab-btn.active {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}


