/* Fix Leaflet marker image paths when CSS is served from /css/ */
.leaflet-default-icon-path {
  background-image: url(../vendor/images/marker-icon.png);
}

/* ── Variables ────────────────────────────────────────────────────── */
:root {
  --sidebar-width: 290px;

  --bg:        #13161d;
  --surface:   #1a1d27;
  --surface-2: #22273a;
  --surface-3: #2c3248;

  --ink:       #e2e8f0;
  --ink-2:     #a8b5c8;
  --ink-3:     #637083;

  --accent:    #3b82f6;
  --accent-h:  #2563eb;
  --amber:     #f59e0b;
  --green:     #22c55e;
  --red:       #ef4444;

  --border:    #2a3044;
  --radius:    8px;
  --radius-sm: 5px;

  --font: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
}

/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
}

body {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: auto 1fr;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */
#sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 2px; }

/* ── Sidebar Header ───────────────────────────────────────────────── */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.sidebar-header h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.subtitle {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 1px;
}

.subtitle a {
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.subtitle a:hover {
  color: var(--accent);
}

/* ── Control Sections ─────────────────────────────────────────────── */
.control-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 7px;
}

.field-hint {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 6px;
  line-height: 1.4;
}

/* ── Select ───────────────────────────────────────────────────────── */
select {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  appearance: auto;
}

select:focus {
  border-color: var(--accent);
}

select option {
  background: var(--surface-2);
  color: var(--ink);
}

/* ── Text Input ───────────────────────────────────────────────────── */
input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus {
  border-color: var(--accent);
}

input[type="text"]::placeholder {
  color: var(--ink-3);
}

/* ── Radio Group ──────────────────────────────────────────────────── */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.radio-option:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
}

.radio-option input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.radio-option input[type="radio"]:checked + .radio-content .radio-title {
  color: var(--accent);
}

.radio-content {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.radio-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  transition: color 0.15s;
}

.radio-desc {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.35;
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.button-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.btn-primary {
  flex: 1;
  padding: 9px 14px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--accent-h); }
.btn-primary:disabled {
  background: var(--surface-3);
  color: var(--ink-3);
  cursor: not-allowed;
}

.btn-secondary {
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-secondary:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

.btn-small {
  padding: 4px 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-small:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Progress ─────────────────────────────────────────────────────── */
#progress-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.progress-bar-track {
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 7px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 11px;
  color: var(--ink-3);
}

/* ── Results ──────────────────────────────────────────────────────── */
#results-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.results-header h2 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.stats-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 8px;
  align-items: baseline;
}

.stats-list dt {
  font-size: 12px;
  color: var(--ink-2);
}

.stats-list dd {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stats-divider {
  grid-column: 1 / -1;
  height: 1px;
  background: var(--border);
  margin: 3px 0;
}

.turn-label.right  { color: var(--green); }
.turn-label.left   { color: var(--red); }
.turn-label.straight { color: var(--ink-2); }

/* ── Warnings ─────────────────────────────────────────────────────── */
#warnings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
}

#warnings-section:not(:empty) {
  padding-top: 12px;
  padding-bottom: 4px;
}

.warning-card {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  line-height: 1.4;
}

.warning-card.info {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

.warning-card.warn {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}

.warning-card.error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* ── Start Node ───────────────────────────────────────────────────── */
.start-node-section {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}

.checkbox-option input[type="checkbox"] {
  accent-color: var(--accent);
}

/* ── Footer ───────────────────────────────────────────────────────── */
.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--ink-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-footer a {
  color: var(--ink-3);
  text-decoration: none;
}

.sidebar-footer a:hover {
  color: var(--accent);
}

/* ── Page Banner ─────────────────────────────────────────────────── */
#page-banner {
  grid-column: 1 / -1;
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  z-index: 10;
}

.banner-inner {
  display: flex;
  align-items: center;
  gap: 0;
  max-width: 100%;
  width: 100%;
}

.banner-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-right: 20px;
  margin-right: 20px;
  border-right: 1px solid var(--border);
}

.banner-app-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.banner-text {
  font-size: 11px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* ── Map ──────────────────────────────────────────────────────────── */
#map {
  height: 100%;
  z-index: 0;
}

/* ── Leaflet overrides ────────────────────────────────────────────── */
.leaflet-control-attribution {
  font-size: 10px;
  background: rgba(26, 29, 39, 0.8) !important;
  color: var(--ink-3) !important;
}

.leaflet-control-attribution a {
  color: var(--accent) !important;
}

/* ── Direction arrow markers ──────────────────────────────────────── */
.route-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.route-arrow svg {
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.5));
}

/* ── Utility ──────────────────────────────────────────────────────── */
.hidden { display: none !important; }
