/* SideTrip — chassis styles.
   Brand tokens are rewritten by `appfactory new`; everything else is structure. */

/* >>> tokens */
:root {
  --bg: #1B3A2E;
  --surface: #1b1b24;
  --text: #f2f2f7;
  --dim: #9a9aa8;
  --accent: #F4A261;
  --radius: 14px;
  --pad: 16px;
}
/* <<< tokens */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  /* --app-height is set ONLY while a field is focused (see index.html).
     Unset, this falls through to 100dvh, which is what we want the rest of
     the time because it survives rotation without stale pixel values. */
  height: var(--app-height, 100dvh);
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Never let a rubber-band scroll expose the page behind the app. */
  overscroll-behavior: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#appBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pad);
  padding: var(--pad);
  flex: 0 0 auto;
}

#appTitle { font-size: 1.15rem; margin: 0; font-weight: 650; }

.screen { flex: 1 1 auto; overflow-y: auto; padding: 0 var(--pad) var(--pad); }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--pad);
}
.card h2 { margin: 0 0 .5rem; font-size: 1.05rem; }
.card p { margin: 0 0 .75rem; }
.dim { color: var(--dim); }
code { background: rgba(255,255,255,.07); padding: .1em .4em; border-radius: 6px; font-size: .9em; }

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  line-height: 0;
}
.icon-btn:active { background: rgba(255,255,255,.08); }

/* --- sheets --------------------------------------------------------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  z-index: 40;
}
.sheet-backdrop[hidden] { display: none; }

.sheet {
  background: var(--surface);
  width: 100%;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: var(--pad);
  padding-bottom: calc(var(--pad) + env(safe-area-inset-bottom));
  max-height: 85%;
  overflow-y: auto;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 1.05rem; }
.sheet-foot { margin-top: var(--pad); display: flex; gap: .5rem; align-items: center; font-size: .85rem; }
.sheet-foot a { color: var(--dim); }
#appVersion { margin-left: auto; font-variant-numeric: tabular-nums; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.row:last-of-type { border-bottom: 0; }

/* --- floating pills ------------------------------------------------------- */
.pill {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
  z-index: 60;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.pill[hidden] { display: none; }

.update-toast { bottom: calc(18px + env(safe-area-inset-bottom)); background: var(--accent); color: #fff; }
.install-hint { bottom: calc(74px + env(safe-area-inset-bottom)); background: var(--surface); color: var(--text); }

#toast, #syncStatus {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: calc(12px + env(safe-area-inset-top));
  background: rgba(0,0,0,.85);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: .9rem;
  z-index: 70;
  pointer-events: none;
}
#toast[hidden], #syncStatus[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- SideTrip -------------------------------------------------------------- */

.screen { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.screen[hidden] { display: none; }

.text-input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
}
.text-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.chip {
  appearance: none;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-size: .92rem;
  min-height: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  color: var(--text);
  border-radius: 12px;
  padding: 14px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  min-height: 48px;
  cursor: pointer;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn-block { width: 100%; }

.search-card h2 { margin-bottom: 0; }

.drive-status { text-align: center; }
.drive-status h2 { margin: 4px 0 16px; font-size: 1.4rem; }

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width .6s linear;
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: .92rem;
}
.history-row:last-child { border-bottom: 0; }

.summary-stop {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.summary-stop:last-child { border-bottom: 0; }
.summary-stop .emoji { font-size: 1.4rem; }
.summary-empty { color: var(--dim); padding: 8px 0; }

/* --- detour alert ----------------------------------------------------------- */
.detour-alert {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 80;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  padding: var(--pad);
  padding-bottom: calc(var(--pad) + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 32px rgba(0,0,0,.5);
  animation: slide-up .25s ease-out;
}
.detour-alert[hidden] { display: none; }

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.detour-card { display: flex; gap: 14px; align-items: flex-start; }
.detour-emoji { font-size: 2.4rem; line-height: 1; }
.detour-body h3 { margin: 0 0 4px; font-size: 1.1rem; }
.detour-body p { margin: 0 0 4px; font-size: .92rem; }
.detour-meta { color: var(--accent) !important; font-weight: 600; font-size: .85rem !important; }

.detour-actions { display: flex; gap: 10px; margin-top: 14px; }
.detour-actions .btn { flex: 1; }

/* >>> addon-styles */
/* <<< addon-styles */
