:root {
  --brand: #2c3e50;
  --accent: #2980b9;
  --accent-2: #3498db;
  --ok: #27ae60;
  --bg: #fafafa;
  --card-bg: #ffffff;
  --border-soft: #cfcfcf;
  --shadow-soft: 0 1px 6px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  margin: 0;
  color: #222;
}

/* Header / nav */
header {
  background: var(--brand);
  color: #fff;
  padding: 0.75em 1em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

header h1 {
  margin: 0;
  font-size: 1.2em;
}

header nav a {
  color: #ecf0f1;
  margin-left: 1em;
  text-decoration: none;
  font-weight: 600;
}

header nav a:hover {
  text-decoration: underline;
}

/* Main Layout Helpers */
main {
  max-width: 1000px;
  margin: 1.25em auto;
  padding: 1em;
}

.site-title {
  text-decoration: none;
  color: inherit;
}
.site-title:hover {
  text-decoration: underline;
}

/* Used on pages with wider layouts (index/add/checkin) */
.layout-wide {
  max-width: 1100px;
}

/* Card style */
.card {
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  padding: 1em 1.2em;
  margin-bottom: 1em;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 0.75em;
}

/* Card grid for index/add/checkin sections */
.card-grid {
  display: grid;
  gap: 1em;
  margin-top: 0.75em;
}

/* ✅ Only 2 columns on larger screens */
@media (min-width: 800px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Text & headings */
h2 {
  margin: 0.2em 0 0.6em;
  font-size: 1.15em;
}

h3 {
  margin-top: 0;
}

/* Hero actions */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  margin: 0.5em 0;
}

/* Buttons & links */
.btn-primary,
.btn-secondary,
.open-map,
button {
  display: inline-block;
  text-align: center;
  font-weight: 700;
  padding: 0.7em 0.9em;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 1em;
  text-decoration: none;
}

button[type="submit"] {
  margin-top: 0.75em; /* or whatever spacing you like */
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

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

.btn-secondary {
  background: #ffffff;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-secondary:hover {
  background: #f0f7fb;
}

.open-map {
  background: var(--ok);
  color: #fff;
}

.open-map:hover {
  filter: brightness(1.05);
}

button {
  background: var(--ok);
  color: #fff;
}

button:hover {
  filter: brightness(1.05);
}

/* Form elements */
label {
  display: block;
  margin: 0.5em 0 0.25em;
  font-weight: 600;
}

/* ✅ Inputs: text/select/textarea full width, but NOT checkboxes/radios */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  padding: 0.6em 0.7em;
  font-size: 1em;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
}

/* Two-column form row (lat/lng, etc.) */
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6em;
}

@media (max-width: 600px) {
  .row {
    grid-template-columns: 1fr;
  }
}

/* Mini-map containers (for add/checkin) */
#miniMap {
  height: 260px;
  border-radius: 10px;
  overflow: hidden;
}

/* On add.html the mini map is taller */
.add-page #miniMap {
  height: 320px;
}

/* Map page specific */
#map {
  height: calc(100vh - 150px);
  width: 100%;
}

/* Utility */
.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6em;
  margin-top: 0.5em;
}

.hint {
  font-size: 0.9em;
  color: #666;
}

.card-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.card-link:hover {
  text-decoration: underline;
}

/* --- Map layout with sidebar --- */

.map-layout {
  display: flex;
  min-height: calc(100vh - 70px); /* header height-ish */
  max-width: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

/* Left sidebar for filters + legend */
.map-sidebar {
  width: 280px;
  max-width: 100%;
  background: #ffffff;
  border-right: 1px solid #e0e0e0;
  padding: 0.75em 0.75em 1em;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.75em;
  overflow-y: auto;
}

.sidebar-title {
  margin: 0 0 0.25em;
  font-size: 1em;
  font-weight: 600;
}

/* Right side: map fills remaining space */
.map-main {
  flex: 1;
  min-width: 0;
}

.map-main #map {
  width: 100%;
  height: calc(100vh - 70px); /* adjust if your header is taller/shorter */
}

/* Filterbar, Legend, and Status Legend blocks */
#filterbar,
#legend,
#status-legend {
  padding: 0.5em 1em;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-radius: 8px;
}

/* Filterbar: stacked checkbox list */
#filterbar {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}

/* Legends stacked with spacing */
#legend,
#status-legend {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}

/* Each row (filter option or legend item) */
#filterbar label,
#legend .legend-row,
#status-legend .status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
  line-height: 1.3;
  flex-wrap: wrap;
  padding: 0.1em 0;
}

/* Color swatches: fixed round dots */
.type-swatch,
.status-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

/* Text labels: expand naturally */
.type-label,
.status-label {
  flex: 1;
  min-width: 0;
  white-space: normal;
}

/* Buttons at bottom of filterbar */
#filterbar .filter-controls {
  width: 100%;
  display: flex;
  gap: 0.5em;
  margin-top: 0.5em;
}

/* Status legend title styling */
#status-legend-title {
  font-weight: 600;
  margin-bottom: 0.3em;
}

/* On narrow screens, stack sidebar on top of map */
@media (max-width: 700px) {
  .map-layout {
    flex-direction: column;
  }

  .map-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
  }

  .map-main #map {
    height: 60vh;
  }
}
