/* Soft Glass Bento — light, frosted translucent panels on a pastel wash, violet accent. */
:root {
  --grad: linear-gradient(135deg, #eef2ff 0%, #f6f0ff 45%, #ecfeff 100%);
  --panel: rgba(255, 255, 255, 0.55);   /* frosted sidebar */
  --surface: rgba(255, 255, 255, 0.62);  /* inputs, pills, tiles */
  --card: rgba(255, 255, 255, 0.86);      /* dropdowns, markers */
  --text: #1e2438;
  --muted: #5f6b86;
  --line: rgba(255, 255, 255, 0.85);      /* bright glass edge */
  --hair: rgba(30, 36, 56, 0.10);         /* faint separating hairline */
  --accent: #7c3aed;
  --accent-text: #ffffff;
  --accent-soft: rgba(124, 58, 237, 0.14);
  --shadow-sm: 0 1px 2px rgba(30, 36, 56, 0.06), 0 6px 16px -10px rgba(30, 36, 56, 0.30);
  --shadow-md: 0 8px 26px -14px rgba(30, 36, 56, 0.45);
  --blur: blur(14px) saturate(1.25);
  --r-in: 12px;   /* inputs / pills / buttons */
  --r-card: 16px; /* tiles / timeline / dropdowns */
  --k-clear: #f2a900;
  --k-cloud: #8a94a6;
  --k-fog: #a99bb8;
  --k-rain: #2b7bd8;
  --k-snow: #3cc4e6;
  --k-storm: #7b3fe4;
  --k-none: #b0b7c3;
  color-scheme: light;
}

* { box-sizing: border-box; }
/* Author `display` rules on .check/.modes beat the UA [hidden] rule, so make hiding explicit. */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; background: var(--grad); background-attachment: fixed; color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#panel {
  width: 340px; flex-shrink: 0; overflow: hidden;
  background: var(--panel); border-right: 1px solid var(--line);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: inset 1px 0 0 rgba(255,255,255,.5), 1px 0 24px -12px rgba(30,36,56,.25);
  display: flex; flex-direction: column;
}
/* Scrolls; the action bar below stays pinned so the button never leaves view. */
#panelScroll {
  flex: 1; min-height: 0; overflow-y: auto; padding: 14px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
#actionBar {
  flex: none; padding: 10px 14px; border-top: 1px solid var(--hair);
  display: flex; flex-direction: column; gap: 6px;
}
h1 { display: flex; align-items: center; gap: 8px; font-family: Sora, Inter, sans-serif; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.logo { width: 27px; height: 27px; flex: 0 0 auto; }
.logo .pin { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.logo .sun { fill: var(--k-clear); }
.logo .ray { stroke: var(--k-clear); stroke-width: 2.2; stroke-linecap: round; }
.wm-a { color: var(--accent); }
.wm-b { color: var(--text); }
.motto { margin: 4px 0 0; font-family: 'Sora', sans-serif; font-size: 13px; font-weight: 600; color: var(--accent); letter-spacing: .01em; }
.sub { margin: 2px 0 0; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

form { display: flex; flex-direction: column; gap: 8px; position: relative; }
.field { display: flex; flex-direction: column; gap: 3px; position: relative; }
.field > label, details summary { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.row { display: flex; gap: 6px; }
.row input { flex: 1; }
input[type="text"], input:not([type]), input[type="number"], input[type="date"], input[type="datetime-local"] {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-in);
  background: var(--surface); color: var(--text); font: inherit; box-shadow: var(--shadow-sm);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.depart input[type="date"], .depart select { font-family: Inter, system-ui, sans-serif; }
input::placeholder { color: var(--muted); }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button { font: inherit; cursor: pointer; }
#locate, .wp-del {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: var(--r-in); padding: 0 10px; box-shadow: var(--shadow-sm);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.wp-del:hover { color: #d1242f; border-color: #d1242f; }

/* Intermediate stops */
#waypoints { display: flex; flex-direction: column; gap: 8px; }
#waypoints:empty { display: none; }
.wp-main { position: relative; }
.wp-row .row { display: flex; gap: 6px; }
.wp-row .row input { flex: 1; }
.wp-stay { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.wp-stay input[type="number"] { width: 52px; padding: 4px 7px; flex: 0 0 auto; }
.wp-actions { display: flex; gap: 6px; }
.wp-actions button {
  flex: 1; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: var(--r-in); padding: 7px 8px; font-size: 12px; font-weight: 600; box-shadow: var(--shadow-sm);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.wp-actions button:hover { border-color: var(--accent); color: var(--accent); }
#addStop { flex: 2; }
#addStop[hidden] + #swap { flex: 1; }

.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 1000; margin: 4px 0 0; padding: 4px 0;
  list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: 0 12px 32px -8px rgba(30,36,56,.35); max-height: 260px; overflow-y: auto;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.suggest:empty { display: none; }
.suggest li { padding: 7px 10px; cursor: pointer; }
.suggest li small { color: var(--muted); display: block; }
.suggest li:hover, .suggest li.active { background: var(--accent-soft); }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

/* Compact inline segmented pill (units toggle) */
.field-inline { flex-direction: row; align-items: center; justify-content: space-between; }
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 4px 12px; border-radius: 999px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.seg input:checked + span { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.modes input { position: absolute; opacity: 0; pointer-events: none; }
.modes span {
  display: block; text-align: center; padding: 7px 4px; border: 1px solid var(--line);
  border-radius: var(--r-in); background: var(--surface); box-shadow: var(--shadow-sm);
  cursor: pointer; user-select: none;
}
.modes input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.modes input:focus-visible + span { outline: 2px solid var(--accent); }

details {
  border: 1px solid var(--line); border-radius: var(--r-card); padding: 8px 11px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
details[open] summary { margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 13px; }
.check.breaks { flex-wrap: nowrap; white-space: nowrap; gap: 5px; }
.check.breaks label { color: var(--text); }
.check.breaks span { color: var(--muted); }
.check.breaks input[type="number"] { width: 46px; padding: 5px 6px; flex: 0 0 auto; }

/* Departure picker: date + hour : minute + AM/PM */
.depart { display: flex; gap: 6px; align-items: center; }
.depart input[type="date"] { flex: 1; min-width: 0; }
.depart select {
  padding: 7px 4px; border: 1px solid var(--line); border-radius: var(--r-in);
  background: var(--surface); color: var(--text); font: inherit; box-shadow: var(--shadow-sm);
}
.depart select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.depart .colon { color: var(--muted); font-weight: 700; }

.action-row { display: flex; gap: 8px; }
#go {
  flex: 1; padding: 10px; border: 0; border-radius: var(--r-in); background: var(--accent); color: var(--accent-text);
  font-family: Sora, Inter, sans-serif; font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 10px 24px -10px rgba(124, 58, 237, 0.75);
}
#go:hover { filter: brightness(1.05); }
#reset {
  flex: 0 0 auto; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-in);
  background: var(--surface); color: var(--muted); font-family: Sora, Inter, sans-serif; font-weight: 600;
  box-shadow: var(--shadow-sm); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
#reset:hover { color: #d1242f; border-color: #d1242f; }
#go:disabled { opacity: .6; cursor: progress; }
#status { margin: 0; min-height: 1.2em; color: var(--muted); font-size: 13px; }
#status:empty { min-height: 0; }
#status.error { color: #d1242f; }

#summary { border-top: 1px solid var(--hair); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 8px 9px;
  box-shadow: var(--shadow-sm); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.stat b { display: block; font-family: Sora, Inter, sans-serif; font-size: 15px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); }
.note { font-size: 12px; color: var(--muted); margin: 0; }
.alerts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.alerts li { padding: 8px 10px; border-radius: var(--r-in); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--c, var(--k-none)); font-size: 13px; box-shadow: var(--shadow-sm); }

footer { margin-top: auto; font-size: 11px; color: var(--muted); }
footer a { color: inherit; }

main { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #dbeafe; }

#legend {
  position: absolute; top: 12px; right: 12px; z-index: 500; display: flex; gap: 10px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 7px 11px; font-size: 12px; color: var(--text);
  box-shadow: var(--shadow-md); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
#legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; background: var(--c); margin-right: 4px; vertical-align: middle; }

#timeline {
  position: absolute; left: 12px; right: 12px; bottom: 18px; z-index: 500; display: flex; gap: 8px;
  overflow-x: auto; padding: 9px; background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--line); border-radius: 18px; scrollbar-width: thin;
  box-shadow: var(--shadow-md); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
}
.tcard {
  flex: 0 0 auto; min-width: 86px; text-align: center; padding: 7px 8px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); border-bottom: 3px solid var(--c); cursor: pointer; color: var(--text);
  box-shadow: var(--shadow-sm);
}
.tcard:hover { border-color: var(--accent); }
.tcard .ic { font-size: 24px; line-height: 1.2; }
.tcard .t { font-weight: 700; }
.tcard small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; }

/* Map markers — kept near-opaque so they stay legible over map tiles */
.wx { background: none; border: 0; }
.wx div {
  display: inline-flex; flex-direction: column; align-items: center; white-space: nowrap; transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.92); color: #1c2330; border: 2px solid var(--c); border-radius: 12px;
  padding: 3px 8px 4px; font: 600 12px/1.2 Inter, system-ui, sans-serif; box-shadow: 0 4px 12px rgba(30,36,56,.28);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.wx div b { display: flex; align-items: center; gap: 2px; font-size: 13px; }
.wx div b span { font-size: 18px; }
.wx .time { font-size: 10px; font-weight: 600; color: #475467; }
.wind { display: inline-flex; align-items: center; gap: 2px; font-size: 10px; font-weight: 600; color: #475467; }
.wind i { display: inline-block; font-style: normal; font-weight: 800; color: var(--accent); }
.tcard .wind { color: var(--muted); }
.wx.end div { border-width: 3px; }
.leaflet-popup-content { font-size: 13px; }
.leaflet-popup-content h3 { margin: 0 0 4px; font-size: 14px; font-family: Sora, Inter, sans-serif; }
.leaflet-popup-content .big { font-size: 26px; }

@media (max-width: 760px) {
  body { flex-direction: column; }
  #panel { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  #panelScroll { overflow: visible; }
  main { height: 70vh; flex: none; }
  #legend { display: none; }
  html, body { height: auto; }
}
