/* ============ DROP · PWA STYLE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-bg: #0a0a14;
  --c-bg-2: #12122a;
  --c-card: rgba(20,22,38,.72);
  --c-card-hi: rgba(26,28,46,.85);
  --c-border: rgba(255,255,255,.07);
  --c-border-hi: rgba(255,255,255,.14);
  --c-text: #ecf0f7;
  --c-muted: rgba(236,240,247,.55);
  --c-faint: rgba(236,240,247,.32);
  --c-accent: #ff6b35;
  --c-accent-2: #ffb86b;
  --c-success: #00e0a4;
  --c-warning: #ffb86b;
  --c-danger: #ff5470;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bot: env(safe-area-inset-bottom, 0);
}

html, body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: 'Heebo', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overscroll-behavior-y: contain;
}
body {
  background:
    radial-gradient(800px 400px at 80% -10%, rgba(255,107,53,.12), transparent 60%),
    radial-gradient(700px 400px at -5% 110%, rgba(124,77,255,.10), transparent 60%),
    var(--c-bg);
  background-attachment: fixed;
  padding-top: calc(64px + var(--safe-top));
  padding-bottom: calc(78px + var(--safe-bot));
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ============ HEADER ============ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(64px + var(--safe-top));
  padding-top: var(--safe-top);
  padding-inline: 18px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(10,10,20,.78);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--c-border);
  z-index: 100;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo-pin {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent-2));
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 6px 18px rgba(255,107,53,.5);
  position: relative;
}
.logo-pin::after {
  content: '';
  position: absolute;
  inset: 8px;
  background: var(--c-bg);
  border-radius: 50%;
}
.brand-name {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.install-btn {
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent-2));
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255,107,53,.35);
  transition: transform .2s;
}
.install-btn:active { transform: scale(.96); }
.hidden { display: none !important; }

/* ============ MAIN VIEWS ============ */
main { padding: 18px; max-width: 560px; margin: 0 auto; }

.panel {
  animation: panel-in .35s cubic-bezier(.2,.9,.3,1.05);
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============ SAVE PANEL (no active parking) ============ */
.save-panel {
  text-align: center;
  padding-top: 20px;
}
.hero-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  line-height: 1.1;
}
.hero-title em {
  color: var(--c-accent);
  font-style: italic;
  font-weight: 800;
}
.hero-sub {
  color: var(--c-muted);
  font-size: 15px;
  margin-bottom: 38px;
}

.big-save {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px;
  width: 200px; height: 200px;
  margin: 0 auto 32px;
  border: none;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #ff8c5a 0%, #ff6b35 60%, #d94c1f 100%);
  color: #fff;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    0 0 0 0 rgba(255,107,53,.5),
    0 30px 80px -20px rgba(255,107,53,.65),
    inset 0 -8px 30px rgba(0,0,0,.25),
    inset 0 4px 20px rgba(255,255,255,.18);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .3s;
  animation: pulse-ring 2.6s ease-in-out infinite;
}
.big-save .big-save-icon {
  font-size: 56px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.25));
}
.big-save .big-save-label { letter-spacing: -0.01em; }
.big-save:active {
  transform: scale(.94);
  box-shadow:
    0 0 0 0 rgba(255,107,53,.5),
    0 10px 30px -10px rgba(255,107,53,.4),
    inset 0 -8px 30px rgba(0,0,0,.35),
    inset 0 4px 20px rgba(255,255,255,.12);
}
.big-save .big-save-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(255,107,53,.4);
  animation: ring-pulse 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes ring-pulse {
  0%   { transform: scale(1);   opacity: .8; }
  70%  { transform: scale(1.15); opacity: 0; }
  100% { transform: scale(1.15); opacity: 0; }
}
@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,107,53,.5), 0 30px 80px -20px rgba(255,107,53,.65), inset 0 -8px 30px rgba(0,0,0,.25), inset 0 4px 20px rgba(255,255,255,.18); }
  50%      { box-shadow: 0 0 0 12px rgba(255,107,53,.0),  0 30px 80px -20px rgba(255,107,53,.65), inset 0 -8px 30px rgba(0,0,0,.25), inset 0 4px 20px rgba(255,255,255,.18); }
}
.big-save.loading {
  pointer-events: none;
  background: radial-gradient(circle at 30% 25%, #6b7080, #2a2d40);
  animation: none;
}
.big-save.loading .big-save-icon::after {
  content: '';
  display: inline-block;
  width: 36px; height: 36px;
  border: 4px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.big-save.loading .big-save-icon { font-size: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.optional-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.opt-btn {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  padding: 10px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.opt-btn:hover, .opt-btn:focus { background: var(--c-card-hi); border-color: var(--c-border-hi); }
.opt-btn.active { background: rgba(255,107,53,.15); border-color: rgba(255,107,53,.4); color: var(--c-accent-2); }

/* ============ ACTIVE PARKING PANEL ============ */
.active-panel {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 22px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.active-panel::before {
  content: '';
  position: absolute;
  top: 0; right: 0; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(0,224,164,.15), transparent 70%);
  pointer-events: none;
}
.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  position: relative;
}
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--c-success);
  box-shadow: 0 0 12px var(--c-success);
  animation: dot-pulse 1.6s ease-in-out infinite;
}
@keyframes dot-pulse { 50% { opacity: .4; } }
.panel-title { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.time-elapsed {
  margin-inline-start: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--c-muted);
}

.map-mini {
  width: 100%;
  height: 180px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--c-bg-2);
  position: relative;
}
.leaflet-container { background: var(--c-bg-2) !important; }
.leaflet-tile-pane { filter: brightness(.65) saturate(.85) hue-rotate(-10deg); }

.parking-info { margin-bottom: 18px; }
.address {
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.distance {
  font-size: 13px;
  color: var(--c-muted);
}

.parking-actions {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent-2));
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 12px 30px -6px rgba(255,107,53,.5);
  transition: transform .15s, box-shadow .25s;
}
.btn-primary:active { transform: scale(.97); }
.btn-secondary {
  background: var(--c-card-hi);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  padding: 14px;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.btn-secondary:hover { background: rgba(255,255,255,.06); }

.extras { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.extra-row {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,.03);
  border-radius: 12px;
  font-size: 13px;
  color: var(--c-muted);
}
.extra-row.show { display: flex; }
.extra-row .label { min-width: 60px; color: var(--c-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; }
.extra-row .photo-thumb {
  width: 50px; height: 50px;
  border-radius: 10px;
  object-fit: cover;
}
.extra-row .timer-countdown {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--c-warning);
  font-weight: 700;
}

.btn-danger {
  width: 100%;
  background: rgba(255,84,112,.10);
  color: var(--c-danger);
  border: 1px solid rgba(255,84,112,.25);
  padding: 13px;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
}
.btn-danger:hover { background: rgba(255,84,112,.18); }

/* ============ HISTORY ============ */
.history-panel h2,
.settings-panel h2 {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 26px;
  margin-bottom: 20px;
}
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 12px;
  align-items: center;
}
.history-item .thumb {
  width: 50px; height: 50px;
  border-radius: 12px;
  background: rgba(255,107,53,.12);
  display: grid; place-items: center;
  font-size: 22px;
  overflow: hidden;
}
.history-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.history-item .info .when {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}
.history-item .info .where {
  color: var(--c-muted);
  font-size: 12px;
}
.history-item .info .duration {
  color: var(--c-faint);
  font-size: 11px;
  margin-top: 2px;
  font-family: 'IBM Plex Mono', monospace;
}
.history-item .actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.history-item .actions button {
  background: transparent;
  border: 1px solid var(--c-border);
  color: var(--c-muted);
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.history-item .actions button:hover { background: rgba(255,255,255,.04); color: var(--c-text); }

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--c-muted);
}
.empty-state .ico { font-size: 48px; margin-bottom: 16px; }

/* ============ SETTINGS ============ */
.settings-list {
  list-style: none;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  overflow: hidden;
}
.settings-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-top: 1px solid var(--c-border);
  font-size: 14px;
}
.settings-list li:first-child { border-top: 0; }
.settings-list li strong { font-weight: 600; }
.settings-list li span { color: var(--c-muted); font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
.btn-link, .btn-danger-link {
  background: none;
  border: none;
  color: var(--c-text);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  width: 100%;
  text-align: right;
}
.btn-danger-link { color: var(--c-danger); }

/* ============ BOTTOM NAV ============ */
.bottom-nav {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(12px + var(--safe-bot));
  height: 64px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px;
  background: rgba(20,22,38,.85);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--c-border);
  border-radius: 22px;
  z-index: 50;
  box-shadow: 0 18px 50px rgba(0,0,0,.4);
}
.nav-btn {
  background: transparent;
  border: none;
  color: var(--c-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 16px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.nav-btn span:first-child { font-size: 20px; }
.nav-btn.active {
  background: rgba(255,107,53,.18);
  color: var(--c-accent-2);
}

/* ============ MODALS ============ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(8,8,16,.78);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: modal-in .25s ease;
}
@keyframes modal-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--c-card-hi);
  border: 1px solid var(--c-border-hi);
  border-radius: 22px;
  padding: 28px 24px 24px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.modal-card h3 {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.modal-card p {
  color: var(--c-muted);
  font-size: 13px;
  margin-bottom: 20px;
}
.modal-input,
.modal-card textarea {
  width: 100%;
  background: var(--c-bg-2);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  padding: 12px 14px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  margin-bottom: 14px;
  resize: vertical;
}
.modal-input:focus,
.modal-card textarea:focus { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.timer-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.timer-preset {
  background: var(--c-bg-2);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  padding: 14px 4px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.timer-preset:hover { background: rgba(255,255,255,.05); }
.timer-preset.active { background: rgba(255,107,53,.18); border-color: rgba(255,107,53,.5); color: var(--c-accent-2); }

/* Voice modal */
.voice-pulse {
  width: 100px; height: 100px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--c-danger) 30%, rgba(255,84,112,.4) 60%, transparent 80%);
  display: grid; place-items: center;
  font-size: 40px;
  animation: voice-record 1.4s ease-in-out infinite;
}
@keyframes voice-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,84,112,.5); }
  50%      { box-shadow: 0 0 0 22px rgba(255,84,112,0); }
}
.voice-transcript {
  min-height: 60px;
  padding: 12px;
  background: var(--c-bg-2);
  border-radius: 12px;
  font-size: 14px;
  text-align: right;
  margin-bottom: 14px;
  color: var(--c-muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(90px + var(--safe-bot));
  left: 50%;
  transform: translateX(-50%);
  background: var(--c-card-hi);
  border: 1px solid var(--c-border-hi);
  color: var(--c-text);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 300;
  box-shadow: 0 18px 40px rgba(0,0,0,.5);
  animation: toast-in .25s cubic-bezier(.2,.9,.3,1.05);
}
.toast.error { color: var(--c-danger); border-color: rgba(255,84,112,.4); }
.toast.success { color: var(--c-success); border-color: rgba(0,224,164,.4); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
