/* Pico.css (loaded in base.html) handles body/typography, nav, form, button, table and
   article styling on plain semantic HTML with no extra classes -- this file only keeps what
   Pico has no opinion on, plus a compact-density override so a tab's content has a shot at
   fitting one screen without scrolling. */

:root {
  /* Pico's own recommended technique for a denser UI: its spacing/typography is rem-based,
     so shrinking the root size scales paddings/margins/gaps everywhere at once. */
  --pico-font-size: 80%;
  --pico-spacing: 0.55rem;
}

main.container {
  padding-block: 0.75rem;
}

h1, h2, h3 {
  margin-block: 0.25rem 0.5rem;
}

.inline-form {
  display: inline;
}

.flash {
  background: var(--pico-mark-background-color, #fff3cd);
  border: 1px solid var(--pico-mark-color, #ffe08a);
  padding: 0.4rem 0.75rem;
  border-radius: var(--pico-border-radius);
  list-style: none;
  margin: 0 0 0.75rem;
}

.error {
  color: var(--pico-del-color, #a00);
}

.hint {
  color: var(--pico-muted-color);
  font-size: 0.85em;
  margin-block: 0.25rem;
}

.user-badge {
  color: var(--pico-muted-color);
  font-size: 0.9em;
}

.checkbox {
  display: flex !important;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-block: 0.4rem;
}

/* Compact start forms -- these are secondary to the map/log once something is running, and
   the user explicitly asked for smaller inputs so the map/log get the room. */
.compact-form label {
  margin-bottom: 0.3rem;
  font-size: 0.9em;
}

.compact-form input, .compact-form select {
  padding: 0.3rem 0.5rem;
  font-size: 0.95em;
  margin-bottom: 0;
}

/* Running/stopped indicator, shown instead of the start form once a process exists for that
   tab -- a single Start/Stop slot per tab, mirroring control_panel.py's ttk.Notebook (one
   script, one button, never a duplicated map). */
.panel-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.9rem;
  background: var(--pico-card-sectioning-background-color, var(--pico-background-color));
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  margin-bottom: 0.5rem;
}

.status-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--pico-muted-color);
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.running {
  background: #2ecc71;
  box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.25);
}

.extra-processes {
  margin-top: 0.5rem;
}

/* Deliberately theme-independent -- a dark terminal look regardless of light/dark page mode. */
.log {
  background: #111;
  color: #d6ffd6;
  font-family: ui-monospace, monospace;
  font-size: 0.78em;
  overflow-y: auto;
  padding: 0.4rem 0.6rem;
  white-space: pre-wrap;
  border-radius: var(--pico-border-radius);
  margin-bottom: 0.4rem;
}

/* The log IS the main content on tabs with no map (NTRIP) -- give it the prominence a map
   would otherwise get. */
.log-solo {
  height: 340px;
}

/* The GNSS tab's single map -- big on purpose (it's the star of that tab, whether showing the
   planned-path preview at rest or the live marker + breadcrumb while running). */
.live-map-big {
  height: 420px;
  margin: 0.5rem 0;
  border-radius: var(--pico-border-radius);
}

/* Log + map side by side, 50/50, on tabs that have both (GNSS, Constelación) -- log on the
   left, map on the right, same height so their tops/bottoms line up. When there's no log to
   show (idle, nothing running yet) .log-col is simply absent and .map-col takes the full row. */
.map-log-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.map-log-row .log-col {
  flex: 1 1 50%;
  min-width: 220px;
}

.map-log-row .map-col {
  flex: 1 1 50%;
  min-width: 0;
}

.map-log-row .log-side {
  height: 420px;
  margin: 0.5rem 0;
}

@media (max-width: 700px) {
  .map-log-row {
    flex-direction: column;
  }
  .map-log-row .log-col {
    flex: none;
    width: 100%;
  }
  .map-log-row .log-side {
    height: 200px;
  }
}

.route-editor-map {
  height: 380px;
  margin-bottom: 0.4rem;
  border-radius: var(--pico-border-radius);
}

.route-editor-grid {
  align-items: start;
}

.waypoint-table-wrap {
  max-height: 160px;
  overflow-y: auto;
}

.waypoint-table {
  margin-bottom: 0;
}

.waypoint-table td, .waypoint-table th {
  padding: 0.2rem 0.5rem;
}

.waypoint-table td {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
}

/* --- Tabs (mirrors control_panel.py's ttk.Notebook) --- */

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.tab-button {
  /* Explicit colors, not Pico's button vars: Pico's default <button> pairs a filled
     background with a light/inverse text color meant to contrast against THAT background --
     stripping the background here left the text almost invisible against the page. */
  background: none !important;
  border: none;
  box-shadow: none;
  padding: 0.4rem 1rem;
  margin: 0 0 -1px 0;
  cursor: pointer;
  color: #57606a !important;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  font-size: 0.95em;
}

.tab-button:hover {
  color: #1a1a1a !important;
}

.tab-button.active {
  color: #1a1a1a !important;
  border-bottom-color: var(--pico-primary);
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  .tab-button {
    color: #9aa4af !important;
  }
  .tab-button:hover {
    color: #f0f0f0 !important;
  }
  .tab-button.active {
    color: #f5f5f5 !important;
  }
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}
