/* ============================================
   Travel Dashboard — design tokens
   Dark, map-first, "departure board" feel.
   ============================================ */
:root {
  /* Colour */
  --bg: #0b1220;           /* deep navy base */
  --panel: #131b2c;        /* card / overlay surface */
  --panel-border: #223049;
  --text: #eef1f6;
  --text-muted: #8a93a6;
  --accent: #e8a33d;       /* amber — departure-board accent */
  --route: #4fb6e8;        /* teal — flight paths / water */
  --done: #4caf7d;

  /* Type */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shape */
  --radius: 14px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

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

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  pointer-events: none; /* let map interactions pass through the empty space */
}

.topbar__brand {
  pointer-events: auto;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.topbar__brand span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}

.topbar__nav {
  pointer-events: auto;
  display: flex;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 4px;
  box-shadow: var(--shadow);
}

.topbar__nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}

.topbar__nav a:hover,
.topbar__nav a:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.topbar__nav a[aria-current='page'] {
  color: var(--bg);
  background: var(--accent);
}

/* ============================================
   Checklist page
   ============================================ */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 100px 20px 60px;
}

.page__heading {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.page__subheading {
  color: var(--text-muted);
  margin: 0 0 32px;
  font-size: 0.95rem;
}

.category {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}

.category__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.category__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}

.category__progress {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--panel-border);
}

.checklist-item:first-of-type {
  border-top: none;
}

.checklist-item input[type='checkbox'] {
  appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 2px;
  border-radius: 5px;
  border: 1.5px solid var(--panel-border);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.checklist-item input[type='checkbox']:checked {
  background: var(--done);
  border-color: var(--done);
}

.checklist-item input[type='checkbox']:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checklist-item__body { flex: 1; min-width: 0; }

.checklist-item__title {
  font-size: 0.95rem;
  line-height: 1.3;
}

.checklist-item--done .checklist-item__title {
  color: var(--text-muted);
  text-decoration: line-through;
}

.checklist-item__notes {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.checklist-item__due {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  white-space: nowrap;
}

/* Add-item form */
.add-form {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.add-form select,
.add-form input {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 0.85rem;
}

.add-form input[type='text'] { flex: 1; min-width: 180px; }

.add-form button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.add-form button:hover { opacity: 0.88; }

@media (max-width: 520px) {
  .page { padding: 130px 16px 40px; }
}

/* ---------- Map ---------- */
#map {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

/* Dim/tint the tile layer so our own markers and UI pop */
.leaflet-tile-pane {
  filter: saturate(0.85) brightness(0.9);
}

/* ---------- Plane marker ---------- */
.plane-icon {
  filter: drop-shadow(0 2px 6px rgba(232, 163, 61, 0.5));
}

/* ---------- Update card (bottom-left, latest entry) ---------- */
.update-card {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 1000;
  width: min(340px, calc(100vw - 40px));
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.update-card__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
}

.update-card__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 10px;
}

.update-card__route {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.update-card__route strong {
  color: var(--text);
  font-weight: 500;
}

.update-card__arrow {
  color: var(--route);
}

.update-card__place {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 12px;
}

.update-card__link {
  background: none;
  border: none;
  color: var(--route);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0;
  cursor: pointer;
}

.update-card__link:hover { text-decoration: underline; }

/* ---------- Journey status legend on the map ---------- */
.legend {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  box-shadow: var(--shadow);
}

.legend__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}

/* ---------- Entries side panel ---------- */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  width: min(380px, 100vw);
  background: var(--panel);
  border-left: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.panel[aria-hidden='false'] {
  transform: translateX(0);
}

.panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--panel-border);
}

.panel__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
}

.panel__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
}

.panel__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.panel__close:hover { color: var(--text); }

.panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 24px;
}

.entry-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--panel-border);
  cursor: pointer;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  text-align: left;
  width: 100%;
  color: inherit;
  font-family: inherit;
}

.entry-row:first-of-type { padding-top: 0; }

.entry-row__date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.entry-row__title {
  font-size: 0.95rem;
  font-weight: 500;
}

.entry-row__place {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.panel__back {
  background: none;
  border: none;
  color: var(--route);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0 0 14px;
}

.entry-detail__date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.entry-detail__body {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

.entry-detail img {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 14px;
}

.panel__empty {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- Currency converter ---------- */
.converter {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.converter__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.converter__field label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.converter__field input,
.converter__field output {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--text);
  min-width: 130px;
}

.converter__equals {
  color: var(--text-muted);
  font-size: 1.2rem;
  padding-bottom: 10px;
}

#currency-select {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  align-self: flex-end;
}

.add-form__refresh {
  margin-top: 16px;
  background: none;
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.add-form__refresh:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.add-form__refresh:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ---------- Mobile ---------- */
@media (max-width: 520px) {
  .update-card {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }

  .topbar { padding: 12px 14px; }

  .legend {
    left: 12px;
    right: 12px;
    bottom: 90px;
    justify-content: center;
  }

  .panel { width: 100vw; }
}
