/* Parking assistant – functionalist look: plain grid, black lines, off-white paper,
   few colours and each one with a meaning (blue = selection/set, red = problem, orange = street). */
:root {
  --ink: #111111;
  --paper: #f6f5f1;
  --muted: #5f5e5a;
  --accent: #0057b8;
  --warn: #d62828;
  --touch: 44px; /* comfortable size for a finger on a tablet */
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

header {
  background: #ffffff;
  border-bottom: 2px solid var(--ink);
}

.title-bar {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ink);
}

h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.subtitle {
  color: var(--muted);
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.group {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 14px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.group h2,
.panel-label {
  flex-basis: 100%;
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

button,
select,
input[type="text"],
input[type="number"] {
  min-height: var(--touch);
  padding: 0 14px;
  font: inherit;
  color: var(--ink);
  background: #ffffff;
  border: 1.5px solid var(--ink);
  border-radius: 0;
}

button {
  cursor: pointer;
}

button:hover {
  background: #eceae4;
}

button:active {
  background: var(--ink);
  color: #ffffff;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

input[type="file"] {
  max-width: 100%;
  font: inherit;
}

input[type="file"]::file-selector-button {
  min-height: var(--touch);
  margin-right: 10px;
  padding: 0 14px;
  font: inherit;
  background: #ffffff;
  border: 1.5px solid var(--ink);
  cursor: pointer;
}

input[type="range"] {
  min-height: var(--touch);
  accent-color: var(--ink);
}

.inline-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #ffffff;
  border: 2px solid var(--accent);
}

.messages {
  padding: 12px 16px 4px;
}

#status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding-left: 10px;
  border-left: 4px solid var(--ink);
  font-weight: 600;
}

#status-line.flash {
  animation: flash 1.2s ease-out;
}

@keyframes flash {
  from { background: #ffe066; }
  to   { background: transparent; }
}

#warnings {
  margin: 8px 0 0;
  padding-left: 10px;
  border-left: 4px solid var(--warn);
  color: var(--warn);
}

#warnings.all-clear {
  border-left-color: #1d9e75;
  color: #11603f;
}

#warnings:empty {
  display: none;
}

.view-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
}

#zoom-value,
#map-fade-value {
  min-width: 3.5em;
}

#scale-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#scale-bar-line,
#print-scale-line {
  display: inline-block;
  height: 8px;
  border: 1.5px solid var(--ink);
  background: linear-gradient(to right, var(--ink) 50%, #ffffff 50%);
}

#print-scale {
  display: none;
}

#scale-info {
  margin-right: 12px;
  padding: 0 10px;
  border-left: 1px solid var(--ink);
  color: var(--muted);
}

/* Labelled rows inside the toolbar groups: label | control(s) */
.field-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto; /* label | choice | button */
  align-items: center;
  gap: 8px;
  width: 100%;
}

.field-row > label,
.field-label {
  font-size: 13px;
  color: var(--muted);
}

.field-row select {
  width: 100%;
  min-width: 0;
}

/* a row with only a label and a choice: the choice uses the full width */
.field-row > select:last-child,
.field-buttons {
  grid-column: 2 / 4;
}

.field-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#map-frame {
  position: relative;
  margin: 0 16px 16px;
}

#plan-wrapper {
  position: relative;
  max-height: 78vh; /* the window grows with the map, up to 78 % of the screen */
  overflow: auto;
  background: #ffffff;
  border: 1.5px solid var(--ink);
}

#plan {
  display: block;
  max-width: 100%;
  touch-action: none; /* fingers drag vehicles and pan the map instead of scrolling the page */
}

/* The vehicle bar: docked at the top of the map window, stays put while zooming and panning */
#vehicle-panel {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  right: 8px;
  max-width: 820px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.97);
  border: 2px solid var(--ink);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

#panel-title {
  flex: 1;
  font-size: 15px;
}

.panel-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.panel-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--ink);
}

.panel-row select,
.panel-row input[type="number"] {
  width: 100%;
}

.panel-row label {
  width: 100%;
}

#print-info {
  display: none;
}

@media print {
  header,
  #status-line,
  .view-bar,
  #vehicle-panel {
    display: none !important;
  }
  body {
    background: #ffffff;
  }
  #map-frame {
    margin: 0;
  }
  #plan-wrapper {
    max-height: none;
    overflow: visible;
    border: none;
  }
  #plan {
    width: 100% !important;
    max-width: 100% !important;
  }
  #print-info {
    display: block;
    padding: 0 16px;
  }
  #print-scale {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0;
  }
}

#panel-size-row,
#panel-tent-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

/* ===========================================================================
   Neon look (optional): night-city colours, bold slanted headings, neon outlines.
   Same layout and behaviour as the functional look. Print always stays light.
   =========================================================================== */
body.theme-neon {
  --ink: #f4f1ff;
  --paper: #14112b;
  --muted: #b9b0ee;
  --accent: #00d9c5;
  --warn: #ff4d4d;
  --neon-pink: #ff3ea5;
  --neon-teal: #00d9c5;
  --neon-gold: #ffd166;
  --panel: #1f1840;
  --panel-line: #3a2d7a;
  background: var(--paper);
  color: var(--ink);
}

body.theme-neon header {
  background: #1a1438;
  border-bottom: 3px solid var(--neon-pink);
}

body.theme-neon .title-bar {
  background: linear-gradient(90deg, #ff3ea5 0%, #ff8a3d 45%, #7b2ff7 100%);
  border-bottom: none;
}

body.theme-neon h1 {
  font-family: "Arial Black", "Helvetica Neue", system-ui, sans-serif;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff6d9;
  text-shadow: 2px 2px 0 #14112b;
}

body.theme-neon .subtitle {
  color: #14112b;
  font-weight: 700;
}

body.theme-neon .group {
  border-color: var(--panel-line);
}

body.theme-neon .group h2,
body.theme-neon .panel-label {
  font-family: "Arial Black", system-ui, sans-serif;
  font-style: italic;
  color: var(--neon-pink);
}

body.theme-neon button,
body.theme-neon select,
body.theme-neon input[type="text"],
body.theme-neon input[type="number"],
body.theme-neon input[type="file"]::file-selector-button {
  background: #2c2260;
  color: var(--ink);
  border: 1.5px solid #5a48b8;
  border-radius: 6px;
}

body.theme-neon button:hover {
  background: #3a2d7a;
}

body.theme-neon button:active {
  background: var(--neon-pink);
  color: #14112b;
}

body.theme-neon #add-button,
body.theme-neon #add-tent-button,
body.theme-neon #trace-button {
  background: var(--neon-pink);
  color: #14112b;
  border-color: var(--neon-pink);
  font-weight: 700;
}

body.theme-neon .inline-box {
  background: var(--panel);
  border-color: var(--neon-gold);
}

body.theme-neon #status-line {
  background: #0f0c22;
  border-left-color: var(--neon-gold);
  padding: 6px 10px;
}

body.theme-neon #status::before {
  content: "OBJECTIVE · ";
  font-family: "Arial Black", system-ui, sans-serif;
  font-style: italic;
  color: var(--neon-gold);
}

body.theme-neon #warnings {
  color: #ff8080;
  border-left-color: var(--warn);
}

body.theme-neon #warnings.all-clear {
  color: #7ef0c8;
  border-left-color: var(--neon-teal);
}

body.theme-neon #plan-wrapper {
  background: #0f0c22;
  border: 2px solid var(--neon-teal);
  box-shadow: 0 0 14px rgba(0, 217, 197, 0.45);
}

body.theme-neon #vehicle-panel {
  background: rgba(20, 17, 43, 0.95);
  border: 2px solid var(--neon-pink);
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(255, 62, 165, 0.45);
}

body.theme-neon #panel-title {
  font-family: "Arial Black", system-ui, sans-serif;
  font-style: italic;
  text-transform: uppercase;
  color: var(--neon-gold);
}

body.theme-neon #scale-bar-line {
  border-color: var(--neon-teal);
  background: linear-gradient(to right, var(--neon-teal) 50%, transparent 50%);
}

body.theme-neon input[type="range"] {
  accent-color: var(--neon-pink);
}

body.theme-neon #status-line.flash {
  animation: neon-flash 1.2s ease-out;
}

@keyframes neon-flash {
  from { background: #ff3ea5; }
  to   { background: #0f0c22; }
}

/* Print / PDF: always the light functional look */
@media print {
  body.theme-neon {
    --ink: #111111;
    --paper: #ffffff;
    background: #ffffff;
    color: #111111;
  }
  body.theme-neon #warnings,
  body.theme-neon #warnings.all-clear,
  body.theme-neon #print-info {
    color: #111111;
    border-left-color: #111111;
  }
  body.theme-neon #plan-wrapper {
    box-shadow: none;
    background: #ffffff;
    border: none;
  }
  body.theme-neon #print-scale-line {
    border-color: #111111;
    background: linear-gradient(to right, #111111 50%, #ffffff 50%);
  }
}
