/* public/app/styles.css
   Color tokens aligned with public/index.html (web) so the iOS app and
   pleino.ca share one brand palette. Don't introduce new neutrals here. */
:root {
  --bg: #1C1F24;
  --surface: #2A2F36;
  --text: #EAE7E1;
  --muted: #B0B5BC;
  --border: #3A3F46;
  --accent: #F2A900;
  --success: #22C55E;
  --warning: #F2A900;
  --danger: #EF5350;
  --space: 16px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  /* App is dark-mode-first by design (verdict-machine, expected use in-car).
     color-scheme tells iOS Safari to render system controls (form widgets,
     scrollbars) on a dark canvas instead of forcing light defaults. */
  color-scheme: dark;
}
/* Tabular numerals for any runtime-changing number (price/L, total cost,
   savings, distance, time, age). Keeps columns anchored as values change —
   the playbook §iOS-Specific Additions calls this out as the difference
   between "polished" and "amateur" on a price-comparison app. */
.verdict-savings,
.station-meta,
.why-savings,
.why-meta,
.why-calc,
.freshness-warn,
.freshness-footer,
.low-savings-subtitle,
.proof-line,
.manual-city-banner-text {
  font-variant-numeric: tabular-nums;
}
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: env(safe-area-inset-top, 0) var(--space) 0;
  height: calc(56px + env(safe-area-inset-top, 0));
  background: var(--bg);
}
.app-logo { display: block; width: 32px; height: 32px; }
.app-header-actions { display: flex; gap: 12px; }
.settings-btn {
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 16px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}
#screen {
  padding: var(--space);
  padding-bottom: calc(var(--space) + env(safe-area-inset-bottom, 0));
}
.verdict {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 32px;
}
.verdict-hero { margin-bottom: 28px; }
.verdict-text { font-size: 28px; font-weight: 600; margin-bottom: 24px; color: var(--text); }
.verdict-savings { font-size: 64px; font-weight: 700; line-height: 1; color: var(--success); }
.verdict-savings.small { font-size: 48px; color: var(--muted); }
.verdict-text.dominant { font-size: 32px; font-weight: 700; line-height: 1.1; }
.loading-subtitle { font-size: 13px; color: var(--muted); margin-top: 8px; max-width: 280px; line-height: 1.4; }
.ptr-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translate(-50%, 0);
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1), opacity 180ms ease-out;
}
/* iOS-style activity spinner. Each spoke has a fixed opacity (--base); --p
   (0→1, set by the pull handlers) reveals the spokes in sequence so the
   spinner draws itself as you pull. .refreshing then rotates the whole SVG. */
.ptr-spoke { opacity: calc(var(--base) * clamp(0, calc(var(--p, 1) * 12 - var(--i)), 1)); }
.ptr-indicator.refreshing svg { animation: ptrSpin 0.9s linear infinite; }
@keyframes ptrSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.low-savings-subtitle { font-size: 15px; color: var(--muted); margin-top: 4px; }
.proof-line.muted { color: var(--muted); }
.station-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  margin-top: 16px;
  margin-bottom: -8px;
}
/* Compact recommendation card — logo inline with station info, single
   coherent object so the eye doesn't bounce between two visual centers. */
.station-block.compact {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 20px auto;
  max-width: 320px;
}
.station-block.compact .station-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.station-block.compact .station-name { font-size: 16px; }
.station-block.compact .station-address { font-size: 12px; }
.station-block.compact .station-meta { font-size: 12px; }
.verdict-savings-label { font-size: 14px; color: var(--muted); margin-top: 4px; }
.verdict.is-offline .verdict-savings { color: var(--muted); }
.refreshing-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  margin-left: 6px;
  vertical-align: middle;
  animation: refreshingPulse 1.2s ease-in-out infinite;
}
@keyframes refreshingPulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.4); }
}

.station-block {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.station-name { font-size: 18px; font-weight: 500; }
.station-address { font-size: 12px; color: var(--muted); max-width: 280px; }
.station-meta { font-size: 13px; color: var(--muted); }

/* Brand logo — favicon image or colored letter circle */
.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0;
  line-height: 1;
  overflow: hidden;
  margin-bottom: 8px;
}
.brand-logo-img { background: var(--surface); }
.brand-logo-img img {
  width: 100%; height: 100%;
  object-fit: contain;
  border-radius: 50%;
}
.brand-logo-sm { width: 28px; height: 28px; font-size: 11px; }

.proof-line { font-size: 15px; color: var(--muted); margin: 12px 0 24px; }

.cta {
  background: var(--success);
  color: var(--bg);
  border: 0;
  font-weight: 600;
  font-size: 16px;
  padding: 16px 24px;
  border-radius: 12px;
  width: 100%;
  max-width: 320px;
  cursor: pointer;
  margin-bottom: 16px;
}
.cta.primary { background: var(--success); }
.cta.secondary { background: transparent; border: 1px solid var(--muted); color: var(--text); }

.why-link {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px;
}

.freshness-footer {
  margin-top: 32px;
  font-size: 11px;
  color: var(--muted);
}
.calc-for-pill {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
}
.calc-for-pill:active { color: var(--text); }

.state-stub {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

/* Loading state — Pleino animated logomark.
   Animation rules ported from brand/animation/pleino-loading.css */
.verdict.loading { gap: 24px; padding-top: 96px; }
.pleino-loading { display: block; }
.pleino-loading .route {
  stroke-dasharray: 92;
  stroke-dashoffset: 92;
  animation: pleino-draw 1.4s ease-out infinite;
}
.pleino-loading .dot {
  opacity: 0;
  transform-origin: 25px 30px;
  animation: pleino-dot 1.4s ease-out infinite;
}
@keyframes pleino-draw {
  0%   { stroke-dashoffset: 92; }
  70%  { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; }
}
@keyframes pleino-dot {
  0%, 65% { opacity: 0; transform: scale(0); }
  80%     { opacity: 1; transform: scale(1.15); }
  100%    { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .pleino-loading .route, .pleino-loading .dot { animation: none; }
  .pleino-loading .route { stroke-dashoffset: 0; }
  .pleino-loading .dot   { opacity: 1; transform: none; }
}

.verdict-text.muted { color: var(--muted); }
.verdict.stale .station-name { color: var(--muted); }
.freshness-warn { color: var(--warning); font-size: 13px; margin: 12px 0 24px; }
.explanation { color: var(--muted); font-size: 14px; max-width: 320px; line-height: 1.5; margin-bottom: 24px; }

.offline-banner {
  color: var(--warning);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.why-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 200ms ease-out;
}
.why-sheet {
  /* Material — sits above a dimmed overlay. backdrop-filter gives the
     "above content" cue iOS users expect from sheet UI. Fallback to opaque
     surface where backdrop-filter is unsupported. Playbook §iOS-Specific
     Additions: pick the thinnest material that holds 4.5:1 text contrast. */
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  width: 100%;
  max-width: 520px;
  border-radius: 24px 24px 0 0;
  padding: 28px 24px calc(24px + env(safe-area-inset-bottom, 0));
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 240ms cubic-bezier(0.32, 0.72, 0, 1);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .why-sheet { background: var(--surface); }
}
.why-sheet::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--muted);
  opacity: 0.5;
}
.why-sheet-close {
  position: absolute; top: 12px; right: 12px;
  background: transparent; border: 0; color: var(--muted); font-size: 24px;
  cursor: pointer; padding: 8px 12px;
}
.why-sheet-title { font-size: 20px; margin: 0 0 24px; }
.why-block { margin-bottom: 20px; }
.why-block.savings .why-savings { font-size: 32px; color: var(--success); font-weight: 700; }
.why-label { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.06em; margin-bottom: 8px; }
.why-station { font-size: 16px; font-weight: 500; }
.why-meta { font-size: 13px; color: var(--muted); }
.why-calc-caption { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }
.why-calc { width: 100%; border-collapse: collapse; }
.why-calc td { padding: 6px 0; font-size: 14px; }
.why-calc td:nth-child(2) { text-align: right; color: var(--muted); }
.why-calc tr.total td { border-top: 1px solid var(--border); padding-top: 12px; font-weight: 600; color: var(--text); }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(100%) } to { transform: translateY(0) } }

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-of-type { border-bottom: 0; }
.setting-label { font-size: 16px; }
.setting-row select {
  background: transparent;
  color: var(--text);
  border: 0;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
  text-align: right;
  padding: 8px 22px 8px 8px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'%3E%3Cpath fill='none' stroke='%23B0B5BC' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M2 4l3-2.5L8 4M2 10l3 2.5L8 10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
}

.setting-action {
  background: transparent;
  color: var(--accent, #4CAF50);
  border: 0;
  font: inherit;
  font-size: 14px;
  padding: 6px 0;
  cursor: pointer;
}
.setting-action:active { opacity: 0.6; }
.setting-value {
  font-size: 14px;
  color: var(--muted, #B0B5BC);
  font-variant-numeric: tabular-nums;
}

.city-picker-sheet { padding-bottom: 24px; }
.city-picker-hint { font-size: 13px; color: var(--muted, #B0B5BC); margin: 0 0 12px; }
.city-picker-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 60vh;
  overflow-y: auto;
}
.city-row {
  background: transparent;
  color: var(--text);
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 14px 4px;
  text-align: left;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.city-row:last-child { border-bottom: 0; }
.city-row:active { background: var(--surface, rgba(255,255,255,0.04)); }

.vehicle-class-sheet { padding-bottom: 24px; }
.vehicle-class-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.vehicle-row {
  background: transparent;
  color: var(--text);
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 14px 4px;
  text-align: left;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.vehicle-row:last-child { border-bottom: 0; }
.vehicle-row:active { background: var(--surface, rgba(255,255,255,0.04)); }
.vehicle-row.is-selected { color: var(--accent, #4CAF50); }
.vehicle-class-note {
  font-size: 12px;
  color: var(--muted, #B0B5BC);
  margin: 12px 0 0;
  line-height: 1.4;
}

.manual-city-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface, rgba(255,255,255,0.04));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 0 0 16px;
  font-size: 13px;
}
.manual-city-banner-text { color: var(--muted, #B0B5BC); }
.manual-city-banner-clear {
  background: transparent;
  color: var(--accent, #4CAF50);
  border: 0;
  font: inherit;
  font-size: 13px;
  padding: 0;
  cursor: pointer;
}
.manual-city-banner-clear:active { opacity: 0.6; }

.fuel-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 16px;
}

/* Share-card failure toast (sub-spec #1) */
.share-toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0) + 24px);
  transform: translateX(-50%);
  z-index: 9999;
  padding: 12px 18px;
  background: var(--background, #1C1F24);
  color: var(--foreground, #EAE7E1);
  border: 1px solid var(--border, #3A3F46);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  max-width: calc(100vw - 32px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Share-card button (sub-spec #1) */
.share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 12px 20px;
  background: transparent;
  color: var(--foreground, #EAE7E1);
  border: 1px solid var(--border, #3A3F46);
  border-radius: 22px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.share-button:active {
  background: var(--border, #3A3F46);
}

/* First-run analytics disclosure modal.
   Class names avoid 'consent-*'/'cookie-*' — content blockers cosmetically
   hide cookie-banner selectors, which display:none'd this modal and hung
   app boot. See components/consentModal.js. */
.firstrun-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: flex-end; justify-content: center;
  /* Solid Pleino backdrop, not a black scrim: this modal shows on first
     launch BEFORE boot(), so there is no app content behind it — a
     translucent-black scrim just reads as pure black. Matches the
     .welcome-overlay backdrop that immediately precedes it. */
  background: var(--bg, #1C1F24);
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.firstrun-card {
  background: var(--surface, #2A2F36);
  border: 1px solid var(--border, #3A3F46);
  border-radius: 16px;
  padding: 24px 20px;
  max-width: 420px; width: 100%;
}
.firstrun-header { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.firstrun-icon {
  flex: none; width: 40px; height: 40px; border-radius: 10px;
  padding: 4px; box-sizing: border-box;
  background: var(--bg, #1C1F24); border: 1px solid var(--border, #3A3F46);
}
.firstrun-heading { min-width: 0; }
.firstrun-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent, #F2A900); margin: 0 0 2px;
}
.firstrun-title { font-size: 18px; font-weight: 700; margin: 0; }
.firstrun-body { font-size: 14px; line-height: 1.5; color: var(--text-dim, #8A8F96); margin: 0 0 12px; }
.firstrun-actions { display: flex; gap: 12px; margin-top: 8px; }
.firstrun-btn {
  flex: 1; padding: 14px 12px; border-radius: 12px; font-size: 16px;
  font-weight: 600; cursor: pointer; border: 1px solid var(--border, #3A3F46);
}
.firstrun-btn-decline { background: transparent; color: var(--text, #EAE7E1); }
.firstrun-btn-accept { background: var(--accent, #F2A900); color: #1C1F24; border-color: var(--accent, #F2A900); }

/* First-launch welcome screen — installs the total-cost model before the
   first verdict. Spec: 2026-05-16-pleino-welcome-screen-design.md. Sibling
   of .firstrun-* but a full-bleed intro screen, not a bottom sheet. */
.welcome-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg, #1C1F24);
  padding: 24px;
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.welcome-card {
  max-width: 420px; width: 100%;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.welcome-brand { margin-bottom: 20px; }
.welcome-headline {
  font-size: 24px; font-weight: 700; line-height: 1.25;
  margin: 0 0 24px; color: var(--text, #EAE7E1);
}
.welcome-icons {
  display: flex; justify-content: center; gap: 24px;
  margin-bottom: 20px;
}
.welcome-icon {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--accent, #F2A900);
}
.welcome-icon-label {
  font-size: 12px; font-weight: 600; color: var(--muted, #B0B5BC);
}
.welcome-subhead {
  font-size: 15px; line-height: 1.5; color: var(--text, #EAE7E1);
  margin: 0 0 12px;
}
.welcome-trust {
  font-size: 12px; color: var(--muted, #B0B5BC); margin: 0 0 28px;
}
.welcome-cta {
  width: 100%; padding: 14px; border-radius: 12px;
  font-size: 16px; font-weight: 700; cursor: pointer;
  background: var(--accent, #F2A900); color: #1C1F24;
  border: 1px solid var(--accent, #F2A900);
}

/* Desktop: a centered dialog instead of the mobile bottom-sheet. The
   mobile-first rules above stay the default; this only fires >=768px. */
@media (min-width: 768px) {
  .firstrun-overlay { align-items: center; padding-bottom: 16px; }
  .firstrun-card { max-width: 520px; padding: 32px 28px; }
  .firstrun-title { font-size: 22px; }
  .firstrun-body { font-size: 15px; }
}
