:root {
  /* MotorLog-matched palette: dark navy base, slate panels, amber accent */
  --color-bg: #030615;
  --color-surface: #1b2430;
  --color-surface-raised: #1e293b;
  --color-border: #38455e;
  --color-text: #f1f5f9;
  --color-muted: #94a3b8;
  --color-primary: #ffc90e;
  --color-on-primary: #1b2430;
  --color-danger: #f87171;
  --color-danger-bg: rgba(239, 68, 68, 0.15);
  --color-danger-border: rgba(239, 68, 68, 0.4);
  --color-success: #4ade80;
  --color-success-bg: rgba(34, 197, 94, 0.15);
  --color-success-border: rgba(34, 197, 94, 0.4);
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.5);
  --max-width: 1180px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ─────────────────────────────────────────── */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand span { color: var(--color-primary); }
.main-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}
.main-nav a {
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}
.main-nav a:hover { color: var(--color-primary); }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.btn-primary:hover { background: #ffd54a; }
.btn-ghost {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-ghost:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; text-align: center; }
.link-btn {
  background: none;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}
.link-btn:hover { color: var(--color-primary); }
.link-btn.danger:hover { color: var(--color-danger); }
.inline-form { display: inline; }

/* ── Page layout ────────────────────────────────────── */
.page { padding: 32px 24px 64px; min-height: 70vh; }
.page-title { font-size: 1.6rem; font-weight: 800; margin: 0 0 20px; letter-spacing: -0.02em; }

/* ── Forms ──────────────────────────────────────────── */
.auth-card, .form-card {
  max-width: 480px;
  margin: 40px auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}
.form-card { max-width: 560px; }
.stack-form { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.stack-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--color-muted); }
.stack-form input,
.stack-form select,
.stack-form textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text);
}
.stack-form input::placeholder,
.stack-form textarea::placeholder { color: var(--color-muted); opacity: 0.7; }
.stack-form input:focus,
.stack-form select:focus,
.stack-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface-raised);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.muted { color: var(--color-muted); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.75rem; }
.center { text-align: center; }

/* ── Alerts ─────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 16px;
}
.alert-success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border); }
.alert-error { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-border); }

/* ── Add road preview ───────────────────────────────── */
.selected-preview {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
}
.map-preview {
  width: 100%;
  height: 220px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  overflow: hidden;
  background: var(--color-surface);
}

/* ── Attribute pills ────────────────────────────────── */
.attributes-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 4px 0;
  padding: 18px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.attributes-section h2 {
  font-size: 0.95rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
}
.attribute-group { display: flex; flex-direction: column; gap: 8px; }
.attribute-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-group input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.pill {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.pill:hover { border-color: var(--color-primary); }
.pill-group input[type="radio"]:checked + .pill {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
}
.pill-group input[type="radio"]:focus-visible + .pill {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ── Photo upload ───────────────────────────────────── */
.photo-upload-row { display: flex; align-items: flex-start; gap: 16px; margin-top: 6px; }
.photo-upload-controls { display: flex; flex-direction: column; gap: 8px; }
.photo-preview, .current-photo {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  background: var(--color-surface-raised);
  flex-shrink: 0;
}
.checkbox-label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.form-actions { display: flex; gap: 12px; align-items: center; }

/* ── Split layout (My Roads / Dashboard) ────────────── */
.split-layout {
  display: flex;
  gap: 20px;
  align-items: stretch;
  min-height: 560px;
}
.road-list-panel {
  width: 300px;
  max-width: 300px;
  flex-shrink: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.map-panel {
  flex: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}
#my-roads-map, #dashboard-map { width: 100%; height: 100%; min-height: 560px; }

.road-list { list-style: none; margin: 0; padding: 0; }
.road-list-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.1s ease;
}
.road-list-item:hover { background: var(--color-surface-raised); }
.list-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
}
.road-list-item-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.road-list-item-main strong { font-size: 0.95rem; word-break: break-word; }
.road-list-item-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  flex-shrink: 0;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ── Search bar (main dashboard) ────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.search-form { display: flex; gap: 8px; }
.search-form input {
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.9rem;
  min-width: 240px;
  background: var(--color-surface);
  color: var(--color-text);
}
.search-form input:focus { outline: none; border-color: var(--color-primary); }
.result-count { font-size: 0.85rem; }

/* ── Road card grid (dashboard search results) ──────── */
.road-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.road-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.road-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--color-primary); }
.road-card-image {
  height: 160px;
  background-size: cover;
  background-position: center;
  background-color: var(--color-surface-raised);
}
.road-card-body { padding: 14px 16px 16px; }
.road-card-body h3 { margin: 0 0 4px; font-size: 1.05rem; letter-spacing: -0.01em; }
.road-card-location { margin: 0; }
.road-card-stats {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--color-muted);
  font-weight: 600;
}
.road-card-stats .dot { opacity: 0.5; }

/* ── Landing hero ───────────────────────────────────── */
.landing-hero {
  display: grid;
  grid-template-columns: 1.3fr 420px;
  gap: 32px;
  align-items: stretch;
  min-height: 560px;
  margin: 8px 0 40px;
}
.hero-art {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  background: var(--color-bg);
  min-height: 560px;
}
.hero-art svg { width: 100%; height: 100%; display: block; }
.hero-tagline {
  position: absolute;
  left: 40px;
  right: 40px;
  bottom: 36px;
  color: #fff8e8;
  text-shadow: 0 2px 16px rgba(0,0,0,0.65);
}
.hero-tagline h1 {
  font-size: 2.1rem;
  font-weight: 800;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.hero-tagline p {
  margin: 0;
  font-size: 1rem;
  max-width: 440px;
  color: #ffe9b8;
}
.hero-login {
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-login .auth-card { margin: 0; width: 100%; }

@media (max-width: 900px) {
  .landing-hero { grid-template-columns: 1fr; min-height: unset; }
  .hero-art { min-height: 320px; }
}

/* ── Empty states ───────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state.small { padding: 32px 16px; }
.empty-state h1 { font-size: 2.4rem; margin-bottom: 8px; }

@media (max-width: 860px) {
  .split-layout { flex-direction: column; }
  .road-list-panel { width: 100%; max-width: 100%; max-height: 260px; }
  .form-grid { grid-template-columns: 1fr; }
  .main-nav { gap: 12px; font-size: 0.85rem; }
}

/* ── Footer ─────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 24px 0;
  color: var(--color-muted);
  font-size: 0.82rem;
}
