/* Windward — design system CSS
   Ported from route-planner-mockup.html
   Space Grotesk / Inter / IBM Plex Mono — slate/teal/amber/coral palette */

:root {
  --ink: #1B2430;
  --ink-2: #2A3542;
  --paper: #F7F5F0;
  --paper-2: #FFFFFF;
  --line: #E3E0D6;
  --mist: #9CA9AC;
  --teal: #2F6F6B;
  --teal-deep: #20504C;
  --amber: #E8A33D;
  --coral: #D8564B;
  --text: #22282E;
  --text-soft: #6B7178;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font-body);
  color: var(--text);
  overflow: hidden;
  background: var(--ink);
}

/* Splash / loading state */
.ww-splash {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
}
.ww-splash-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--amber), var(--coral));
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-mark svg { width: 18px; height: 18px; }

/* ---- App layout ---- */
.app { display: flex; flex-direction: column; height: 100vh; width: 100%; }

/* Top bar */
.topbar {
  height: 56px;
  flex: 0 0 auto;
  background: var(--ink);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid #0d1218;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 9px; margin-right: 8px; }
.brand-name { font-family: var(--font-display); font-weight: 700; color: #fff; font-size: 16px; letter-spacing: .2px; }
.tb-divider { width: 1px; height: 24px; background: #3a4552; }
.tb-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; border: none;
  background: transparent; color: #B7C0C8; cursor: pointer; transition: background .15s;
}
.tb-btn:hover { background: #2A3542; color: #fff; }
.tb-btn svg { width: 17px; height: 17px; }
.tb-spacer { flex: 1; }
.tb-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #B7C0C8; }
.tb-logout {
  border: none; background: transparent; color: #B7C0C8; font-family: var(--font-body);
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 10px; border-radius: 7px;
}
.tb-logout:hover { background: #2A3542; color: #fff; }
.tb-save {
  height: 34px; padding: 0 16px; border-radius: 8px; border: none; cursor: pointer;
  background: var(--amber); color: #241705; font-weight: 600; font-size: 13px;
  font-family: var(--font-body); display: flex; align-items: center; gap: 7px;
}
.tb-save:hover { background: #f0af4c; }
.tb-close { color: #8b949c; }
.tb-close:hover { color: #fff; background: #3a2b2b; }

/* Body layout */
.body { flex: 1; display: flex; min-height: 0; position: relative; }

/* Sidebar */
.sidebar {
  width: 392px;
  flex: 0 0 auto;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  position: relative;
  z-index: 20;
}
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 18px 18px 28px; }
.sidebar-scroll::-webkit-scrollbar { width: 8px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: #DBD7CB; border-radius: 4px; }
.panel-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin: 2px 0 16px; color: var(--text); }

/* Compass card */
.compass-card {
  background: var(--ink); border-radius: 14px; padding: 16px 16px 14px;
  display: flex; align-items: center; gap: 14px; margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.compass-card::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 85% 0%, rgba(232,163,61,.14), transparent 60%);
  pointer-events: none;
}
.compass-wrap { width: 76px; height: 76px; flex: 0 0 auto; }
.compass-wrap svg { width: 100%; height: 100%; }
.compass-needle { transform-origin: 50% 50%; transition: transform 1s cubic-bezier(.2,.8,.2,1); }
.compass-info { flex: 1; min-width: 0; }
.compass-label { font-size: 11px; color: #8B94A0; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.compass-value { font-family: var(--font-mono); font-size: 22px; color: #fff; font-weight: 600; line-height: 1; }
.compass-value span { font-size: 13px; color: #8B94A0; font-weight: 500; margin-left: 4px; }
.compass-sub { margin-top: 6px; font-size: 12px; color: #B7C0C8; display: flex; align-items: center; gap: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); flex: 0 0 auto; }

/* Section labels */
.section-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-soft); margin: 22px 0 10px;
}

/* Waypoints */
.waypoints { background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; }
.wp-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; position: relative; }
.wp-row:first-child { border-radius: 12px 12px 0 0; }
.wp-row + .wp-row { border-top: 1px solid var(--line); }
.wp-badge {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: #fff;
}
.wp-badge.a { background: var(--teal); }
.wp-badge.b { background: var(--ink-2); }
.wp-input {
  border: none; outline: none; background: transparent; font-size: 13.5px; flex: 1;
  font-family: var(--font-body); color: var(--text);
}
.wp-input::placeholder { color: #A3A9AD; }
.loop-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-top: 1px solid var(--line); background: #FBFAF7;
  border-radius: 0 0 12px 12px;
}
.loop-label { font-size: 12.5px; color: var(--text-soft); display: flex; align-items: center; gap: 7px; }
.loop-label svg { width: 14px; height: 14px; }

/* Switch */
.switch { width: 34px; height: 20px; border-radius: 10px; background: #D8D4C8; position: relative; cursor: pointer; flex: 0 0 auto; transition: background .2s; }
.switch.on { background: var(--teal); }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on .switch-knob { left: 16px; }

/* Activity dropdown */
.activity-row { margin-top: 12px; position: relative; }
.activity-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.activity-btn svg.icon { width: 17px; height: 17px; color: var(--teal); flex: 0 0 auto; }
.activity-btn .txt { font-size: 13.5px; font-weight: 500; flex: 1; text-align: left; }
.activity-btn svg.chev { width: 12px; height: 12px; color: var(--text-soft); }
.activity-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); display: none; overflow: hidden; z-index: 10;
}
.activity-menu.open { display: block; }
.activity-opt { padding: 10px 12px; font-size: 13px; display: flex; align-items: center; gap: 9px; cursor: pointer; }
.activity-opt:hover { background: #F2F0E9; }
.activity-opt svg { width: 15px; height: 15px; color: var(--teal); }

/* Waypoint autocomplete */
.suggestion-dropdown {
  position: absolute; top: calc(100% + 2px); left: 12px; right: 12px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); overflow-y: auto; max-height: 220px; z-index: 20;
}
.suggestion-item { padding: 9px 12px; font-size: 13px; cursor: pointer; }
.suggestion-item:hover { background: #F2F0E9; }
.suggestion-item + .suggestion-item { border-top: 1px solid var(--line); }

/* Goal card */
.goal-card { background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.goal-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.goal-row-label { font-size: 12.5px; font-weight: 500; color: var(--text-soft); }
.dist-readout { font-family: var(--font-mono); font-size: 15px; font-weight: 600; color: var(--teal-deep); }
input[type=range] {
  width: 100%; height: 4px; -webkit-appearance: none; appearance: none;
  background: var(--line); border-radius: 2px; outline: none; margin: 4px 0 2px;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--teal); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer;
}
.range-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: #A3A9AD; font-family: var(--font-mono); margin-top: 2px; }
.datetime-input {
  width: 100%; margin-top: 12px; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 9px; font-family: var(--font-body); font-size: 13px; background: #FBFAF7; color: var(--text);
}

/* Optimize segmented control */
.segmented { display: flex; gap: 6px; margin-top: 12px; }
.seg-opt {
  flex: 1; text-align: center; padding: 9px 4px; border-radius: 9px;
  border: 1px solid var(--line); background: #FBFAF7;
  font-size: 12px; font-weight: 600; color: var(--text-soft); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; transition: all .15s;
}
.seg-opt svg { width: 15px; height: 15px; }
.seg-opt.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg-opt.active.wind { background: var(--amber); color: #241705; border-color: var(--amber); }

/* Generate button */
.generate-btn {
  width: 100%; margin-top: 16px; padding: 13px; border-radius: 11px; border: none; cursor: pointer;
  background: var(--teal); color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 14.5px;
  display: flex; align-items: center; justify-content: center; gap: 9px; transition: background .15s;
  position: relative; overflow: hidden;
}
.generate-btn:hover { background: var(--teal-deep); }
.generate-btn svg { width: 16px; height: 16px; }
.generate-btn.loading .btn-label { opacity: 0; }
.generate-btn .spinner {
  position: absolute; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; opacity: 0;
}
.generate-btn.loading .spinner { opacity: 1; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Route results */
.results-section { margin-top: 6px; }
.route-card {
  background: var(--paper-2); border: 1.5px solid var(--line); border-radius: 11px;
  padding: 12px 13px; margin-bottom: 9px; cursor: pointer; transition: border-color .15s, background .15s;
}
.route-card:hover { border-color: #C9C4B6; }
.route-card.active { border-color: var(--teal); background: #F2F7F6; }
.rc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rc-title { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.rc-swatch { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.rc-dist { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-soft); }
.rc-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin-bottom: 7px; }
.rc-bar span { height: 100%; }
.rc-stats { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-soft); }
.rc-stats b { font-family: var(--font-mono); color: var(--text); font-weight: 600; }
.rc-actions { margin-top: 10px; display: flex; gap: 8px; }
.rc-btn {
  flex: 1; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: #FBFAF7; font-size: 12px; font-weight: 600; cursor: pointer;
  color: var(--text-soft); display: flex; align-items: center; justify-content: center; gap: 6px;
}
.rc-btn:hover { background: var(--line); }
.rc-btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.rc-btn.primary:hover { background: var(--teal-deep); }
.rc-btn svg { width: 13px; height: 13px; }

/* Map area */
.map-area { flex: 1; position: relative; overflow: hidden; background: #DCE3DE; }
#map { width: 100%; height: 100%; }

/* Map overlays */
.stat-chip {
  position: absolute; top: 18px; left: 18px;
  background: rgba(27,36,48,.92); color: #fff;
  padding: 10px 14px; border-radius: 11px; display: flex; gap: 16px; align-items: center;
  backdrop-filter: blur(6px); z-index: 6; opacity: 0; transform: translateY(-6px); transition: all .4s;
}
.stat-chip.show { opacity: 1; transform: translateY(0); }
.sc-item { display: flex; flex-direction: column; gap: 1px; }
.sc-label { font-size: 9.5px; color: #8B94A0; text-transform: uppercase; letter-spacing: .06em; }
.sc-value { font-family: var(--font-mono); font-size: 14px; font-weight: 600; }
.sc-value.teal { color: #6FCFC6; }
.sc-value.coral { color: #F0938B; }
.sc-div { width: 1px; height: 26px; background: #3a4552; }

/* Floating map controls */
.map-controls { position: absolute; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 6; }
.mc-group { background: #fff; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.14); overflow: hidden; }
.mc-btn { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; cursor: pointer; color: var(--ink); }
.mc-btn:hover { background: #F2F0E9; }
.mc-btn svg { width: 17px; height: 17px; }
.mc-group .mc-btn + .mc-btn { border-top: 1px solid #EDEBE3; }

/* Layers chip */
.layers-chip {
  position: absolute; bottom: 18px; left: 18px; background: #fff; border-radius: 11px;
  box-shadow: 0 2px 10px rgba(0,0,0,.14); padding: 9px 12px;
  display: flex; align-items: center; gap: 10px; z-index: 6;
}
.layers-chip svg { width: 16px; height: 16px; color: var(--text-soft); }
.layers-chip span { font-size: 12.5px; font-weight: 500; }

/* Error / info states */
.api-error {
  background: #fef2f2; border: 1px solid #fca5a5; border-radius: 10px;
  padding: 12px 14px; font-size: 13px; color: #991b1b; margin-top: 14px;
}

/* Azure Maps JS interop container */
.map-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: #DCE3DE; color: var(--text-soft); font-size: 13px;
}

/* Auth pages (login / register) */
.auth-page {
  height: 100vh; width: 100%; overflow: auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink);
}
.auth-card {
  width: 100%; max-width: 360px; background: var(--paper-2);
  border-radius: 14px; padding: 32px 28px; box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.auth-title { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--text); margin: 0 0 4px; }
.auth-subtitle { font-size: 13px; color: var(--text-soft); margin: 0 0 20px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.auth-field label { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.auth-field input {
  font-family: var(--font-body); font-size: 14px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper);
}
.auth-submit {
  width: 100%; margin-top: 6px; padding: 11px; border: none; border-radius: 9px;
  background: var(--teal); color: #fff; font-family: var(--font-body); font-weight: 600;
  font-size: 14px; cursor: pointer;
}
.auth-submit:disabled { opacity: .6; cursor: default; }
.auth-switch { margin-top: 16px; font-size: 13px; color: var(--text-soft); text-align: center; }
.auth-switch a { color: var(--teal); font-weight: 600; text-decoration: none; }
