/* ---------------------------------------------------------------------
   Design-Tokens
   Leitidee: ein ruhiges "Instrumentenpanel" für Wetterdaten - dunkle
   Flächen wie ein Radar-/Leitstand-Display, kühles Zyan als Datenfarbe,
   ein warmer Bernstein-Akzent für die primäre Aktion, Messwerte in Mono.
------------------------------------------------------------------------ */
:root {
  --bg-app: #0e1620;
  --bg-panel: #141e29;
  --bg-card: #1a2733;
  --bg-card-hover: #20313f;
  --border-hairline: #263542;
  --text-primary: #edf2f7;
  --text-muted: #8ca0b3;
  --accent-cyan: #4fc3e8;
  --accent-amber: #ff8a3d;
  --accent-amber-hover: #ff9d5c;
  --danger: #ff6b6b;

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
}

button,
input,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ---------------------------------------------------------------------
   Layout
------------------------------------------------------------------------ */
.app {
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "header header"
    "sidebar main";
  height: 100vh;
}

.app-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-hairline);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.04em;
  color: var(--accent-cyan);
}

.brand-sub {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  color: var(--text-muted);
}

/* "Instrumenten-Readout" - das Signature-Element der Anwendung */
.readout {
  display: flex;
  gap: 28px;
  padding: 8px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.readout-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 100px;
}

.readout-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.readout-value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* ---------------------------------------------------------------------
   Sidebar
------------------------------------------------------------------------ */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-hairline);
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 12px 0;
}

.field {
  margin-bottom: 10px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

.field input[type="text"]:focus,
.field input[type="number"]:focus,
.field select:focus,
button:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 1px;
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--accent-cyan);
}

.input-row {
  display: flex;
  gap: 6px;
}

.input-row input {
  flex: 1;
}

.btn-icon {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  width: 38px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-icon:hover {
  background: var(--accent-cyan);
  color: var(--bg-app);
}

.hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 8px 0 0 0;
}

.run-toggle {
  display: flex;
  gap: 16px;
}

.run-toggle label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent-amber);
  color: #241305;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease;
}

.btn-primary:hover {
  background: var(--accent-amber-hover);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: progress;
}

.status {
  min-height: 16px;
  font-size: 12.5px;
  color: var(--accent-cyan);
  margin: 0;
}

.status.status-error {
  color: var(--danger);
}

.tabs {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.tab {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 8px;
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
}

.tab.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.tab:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ---------------------------------------------------------------------
   Kartenbereich
------------------------------------------------------------------------ */
.map-wrap {
  grid-area: main;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  background: var(--bg-app);
}

.legend {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 500;
  background: rgba(20, 30, 41, 0.92);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  min-width: 220px;
  backdrop-filter: blur(4px);
}

.legend-title {
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.legend-bar {
  height: 10px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.legend-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------
   Responsive
------------------------------------------------------------------------ */
@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "header"
      "sidebar"
      "main";
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-hairline);
    max-height: 46vh;
  }

  .map-wrap {
    min-height: 50vh;
  }

  .readout {
    gap: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
