/* CrashReport — Premium Safety-First UI */
:root {
  --navy: #0B1F3A;
  --navy-mid: #122A4A;
  --blue: #2563EB;
  --blue-soft: #3B82F6;
  --amber: #F59E0B;
  --amber-soft: #FBBF24;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --success: #059669;
  --success-soft: #D1FAE5;
  --surface: #FFFFFF;
  --bg: #F4F6F9;
  --text: #0F172A;
  --muted: #64748B;
  --border: #E2E8F0;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 30px rgba(11, 31, 58, 0.08);
  --shadow-sm: 0 2px 10px rgba(11, 31, 58, 0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  background: #0B1F3A;
  color: var(--text);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100%;
  min-height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.04);
}

/* ========== Header ========== */
.app-header {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 55%, #1a3a66 100%);
  color: white;
  padding: 16px 18px 14px;
  padding-top: max(16px, env(safe-area-inset-top));
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.app-header h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lang-btn, .icon-btn {
  background: rgba(255,255,255,0.14);
  border: none;
  color: white;
  padding: 7px 12px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.lang-btn:active, .icon-btn:active { background: rgba(255,255,255,0.24); }
.icon-btn { width: 38px; height: 38px; padding: 0; border-radius: 11px; }

.progress-bar {
  height: 3px;
  background: rgba(255,255,255,0.18);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--amber-soft));
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.step-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}
.step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.28);
  transition: all 0.25s;
}
.step-dot.active {
  background: var(--amber-soft);
  width: 18px;
  border-radius: 4px;
}
.step-dot.done { background: rgba(255,255,255,0.7); }

/* ========== Home Hero ========== */
.home-hero {
  background: linear-gradient(165deg, var(--navy) 0%, #15355c 50%, #1e4a7a 100%);
  color: white;
  padding: 36px 24px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.home-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(59,130,246,0.25), transparent 55%);
  pointer-events: none;
}
.home-hero .icon-wrap {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.home-hero .icon-wrap img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}
.home-hero h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  position: relative;
  z-index: 1;
}
.home-hero h1 span.accent { color: #60A5FA; }
.home-hero p {
  margin-top: 8px;
  font-size: 14px;
  opacity: 0.82;
  line-height: 1.45;
  position: relative;
  z-index: 1;
}

/* ========== Content ========== */
.content {
  padding: 20px 18px;
  padding-bottom: calc(28px + var(--safe-bottom));
  flex: 1;
  overflow-x: hidden;
  max-width: 100%;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(226, 232, 240, 0.9);
  margin-bottom: 12px;
}

.feature-list { padding: 16px 18px 0; }
.feature-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.feature-item:last-child { border-bottom: none; }
.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, #EFF6FF, #DBEAFE);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ========== Forms ========== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}
.form-input, .form-textarea, select.form-input {
  width: 100%;
  padding: 14px 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.form-textarea { min-height: 96px; resize: vertical; line-height: 1.45; }

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 18px;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.12s, background 0.15s;
  letter-spacing: -0.01em;
}
.btn:active { transform: scale(0.985); opacity: 0.92; }
.btn-primary {
  background: linear-gradient(180deg, var(--blue-soft) 0%, var(--blue) 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}
.btn-secondary {
  background: #E8EEF7;
  color: var(--navy);
}
.btn-outline {
  background: var(--surface);
  color: var(--navy);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-danger {
  background: linear-gradient(180deg, #EF4444 0%, var(--danger) 100%);
  color: white;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.3);
}
.btn-lg { padding: 17px 20px; font-size: 17px; border-radius: 16px; }
.btn-sm { padding: 10px 14px; font-size: 14px; width: auto; }

/* ========== Photos ========== */
.photo-action-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 4px 0 8px;
}
.photo-action-row .photo-btn { flex: 1; font-size: 14px; padding: 12px; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 12px;
  max-width: 100%;
}
.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: #E2E8F0;
  border: 1px solid var(--border);
  max-height: 110px;
}
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.photo-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  color: white;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-count {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.photo-thumb {
  aspect-ratio: 1;
  border-radius: 12px;
  object-fit: cover;
  width: 100%;
  background: #E2E8F0;
}
.photo-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.photo-actions .btn { flex: 1; font-size: 14px; padding: 12px; }

/* Lightbox preview */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(11, 31, 58, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
}
.lightbox img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.lightbox .lightbox-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 22px;
  background: rgba(255,255,255,0.2);
  color: white;
  font-size: 22px;
  cursor: pointer;
}
.lightbox .lightbox-caption {
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
}

/* Map */
.map-wrap {
  margin-top: 10px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #e2e8f0;
}
.map-wrap iframe {
  width: 100%;
  height: 180px;
  border: 0;
  display: block;
}
.gps-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: #1d4ed8;
  background: #eff6ff;
  padding: 4px 10px;
  border-radius: 8px;
}
.bottom-bar {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  padding-bottom: calc(14px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  z-index: 40;
  flex-shrink: 0;
}
#step-content {
  padding-bottom: 8px;
  overflow-x: hidden;
}
.btn-icon {
  width: 48px;
  min-width: 48px;
  padding: 0;
  flex-shrink: 0;
}

/* ========== Wizard bottom ========== */
.wizard-footer {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  padding-bottom: calc(14px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  z-index: 40;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: white;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 200;
  max-width: 90%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== Premium badge ========== */
.premium-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.4);
}

/* ========== Safety card ========== */
.safety-card {
  background: linear-gradient(145deg, #FFF7ED, #FFEDD5);
  border: 1px solid #FED7AA;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

/* ========== Animations ========== */
.fade-in {
  animation: fadeIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== Review summary ========== */
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.summary-row:last-child { border-bottom: none; }
.summary-label { color: var(--muted); }
.summary-value { font-weight: 600; color: var(--text); text-align: right; max-width: 60%; }

/* Scrollbar subtle */
::-webkit-scrollbar { width: 0; height: 0; }


/* Hide native file inputs — use custom buttons only */
.hidden-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Review rows: label | value with gap */
.review-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.review-row:last-child { border-bottom: none; }
.review-row .label {
  color: var(--muted);
  flex-shrink: 0;
  max-width: 42%;
  font-weight: 500;
}
.review-row .value {
  font-weight: 600;
  color: var(--text);
  text-align: right;
  word-break: break-word;
  flex: 1;
}

.review-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}


#accident-map, #profile-leaflet-map {
  width: 100%;
  height: 220px;
  z-index: 1;
  background: #e2e8f0;
}
.map-wrap .leaflet-container {
  font: inherit;
}
.address-badge {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #0f172a;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 500;
}
.address-badge.pending {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #64748b;
}


/* === Accessibility / senior-friendly === */
.btn {
  min-height: 48px;
  font-size: 17px !important;
  font-weight: 600;
}
.btn-lg {
  min-height: 56px;
  font-size: 18px !important;
  padding: 18px 20px;
}
.btn-sm {
  min-height: 44px;
  font-size: 15px !important;
}
.lang-btn, .icon-btn, [data-action="toggle-lang"] {
  min-width: 48px !important;
  min-height: 48px !important;
  font-size: 15px !important;
  padding: 10px 14px !important;
}
.form-label {
  font-size: 15px !important;
  font-weight: 600;
  margin-bottom: 8px;
}
.form-input, .form-textarea, select.form-input {
  font-size: 17px !important;
  min-height: 48px;
  padding: 12px 14px;
}
.form-textarea {
  min-height: 100px;
}
.photo-action-row .photo-btn {
  min-height: 52px;
  font-size: 16px !important;
}
#accident-map {
  height: 260px;
}
.address-badge {
  font-size: 15px !important;
  line-height: 1.5;
  padding: 12px 14px;
}
.bottom-bar .btn {
  min-height: 52px;
}
.home-hero p {
  font-size: 15px;
}
