/* Trip Log — style.css v1.0 */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

/* ── Tokens ── */
:root {
  --bg:        #0e1626;
  --surface:   #1d2c4d;
  --surface2:  #243358;
  --yellow:    #ffeb3b;
  --teal:      #8ec3b9;
  --muted:     #98a5be;
  --text:      #ffffff;
  --danger:    #ff5f57;

  --font-head: 'Barlow Condensed', sans-serif;
  --font-data: 'IBM Plex Mono', monospace;

  --tab-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── App Shell ── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-data);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ── Screens ── */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.screen.active { display: flex; }

/* ── Page Header ── */
.page-header {
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--surface2);
  flex-shrink: 0;
}

.page-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1;
}

.page-subtitle {
  font-family: var(--font-data);
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.04em;
}

/* ── Scrollable Content Area ── */
.screen-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
}

/* ── Tab Bar ── */
#tabbar {
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--surface2);
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  flex-shrink: 0;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
  padding: 8px 4px;
}

.tab.active { color: var(--yellow); }

.tab svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

/* ── Data Labels ── */
.label {
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.value {
  font-family: var(--font-data);
  font-size: 15px;
  color: var(--text);
}

.value.large {
  font-family: var(--font-head);
  font-size: 40px;
  font-weight: 700;
  color: var(--yellow);
  line-height: 1;
  letter-spacing: 0.02em;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: none;
  border-radius: 6px;
  padding: 14px 24px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
  width: 100%;
}
.btn:active { opacity: 0.75; }

.btn-primary   { background: var(--yellow); color: var(--bg); }
.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-ghost     { background: transparent; color: var(--muted); border: 1px solid var(--surface2); }

/* ── Track Screen specific ── */
#screen-track {
  position: relative;
}

#map {
  position: absolute;
  inset: 0;
  background: #e8e0d8;
}

.track-status {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  background: rgba(14, 22, 38, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10;
}

.track-controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  gap: 10px;
  z-index: 10;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.status-dot.active {
  background: var(--yellow);
  box-shadow: 0 0 0 0 rgba(255, 235, 59, 0.5);
  animation: pulse 2s infinite;
}
.status-dot.parked {
  background: var(--teal);
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,235,59,0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(255,235,59,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,235,59,0); }
}

.status-text {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}


/* ── Trips List ── */
.trip-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--surface2);
}
.trip-row:last-child { border-bottom: none; }

.trip-route {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.2;
}

.trip-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  font-family: var(--font-data);
}

.trip-km {
  font-family: var(--font-data);
  font-size: 18px;
  font-weight: 500;
  color: var(--yellow);
  text-align: right;
}

.trip-cost {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  margin-top: 3px;
}

/* ── Empty State ── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-text {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Settings rows ── */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--surface2);
}
.setting-row:last-child { border-bottom: none; }

.setting-label {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.setting-value {
  font-family: var(--font-data);
  font-size: 14px;
  color: var(--yellow);
}

/* ── Input ── */
input[type="text"],
input[type="number"] {
  background: var(--surface2);
  border: 1px solid var(--surface2);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-data);
  font-size: 16px; /* prevents zoom on iOS */
  padding: 12px 14px;
  width: 100%;
  outline: none;
  -webkit-appearance: none;
}
input:focus { border-color: var(--yellow); }

/* ── Modal / Bottom Sheet ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14,22,38,0.85);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-sheet {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 24px 20px calc(24px + var(--safe-bottom));
  width: 100%;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
}
.modal-overlay.open .modal-sheet {
  transform: translateY(0);
}

.modal-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 8px;
}

.modal-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
  font-family: var(--font-data);
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-cancel {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.btn-cancel:active { background: rgba(255,255,255,0.1); }
.btn-recenter {
  position: absolute;
  bottom: 90px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--surface2);
  color: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s, background 0.15s;
}
.btn-recenter:active {
  background: var(--surface2);
}
.btn-recenter svg {
  width: 20px;
  height: 20px;
}
.maplibregl-control-container { display: none !important; }
.maplibregl-canvas { outline: none; }
