:root {
  --sand: #F5EBDD;
  --sunset-1: #F4A26B;
  --sunset-2: #E8825B;
  --sunset-3: #C25E7A;
  --terracotta: #C15F3C;
  --terracotta-dark: #A34D30;
  --indigo: #2E4756;
  --gold: #D9A441;
  --sage: #8A9A5B;
  --ink: #3A2E28;
  --card-bg: #FFFDF9;
  --card-shadow: 0 8px 24px rgba(58, 46, 40, 0.10);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--sand);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body {
  background-image:
    radial-gradient(circle at 15% 8%, rgba(217, 164, 65, 0.06), transparent 40%),
    radial-gradient(circle at 85% 92%, rgba(194, 94, 122, 0.06), transparent 40%);
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  position: relative;
}

a { color: inherit; }

button {
  font-family: var(--font-body);
  cursor: pointer;
}

/* ---------- Header ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 15;
  padding: calc(18px + env(safe-area-inset-top)) 20px 14px;
  text-align: center;
  background: var(--sand);
  border-bottom: 1px solid rgba(58, 46, 40, 0.08);
}

.app-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.9rem;
  margin: 0;
  color: var(--indigo);
  letter-spacing: 0.01em;
}

.app-subtitle {
  margin: 4px 0 0;
  font-size: 0.92rem;
  color: var(--terracotta-dark);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ---------- Views ---------- */

.view {
  padding: 0 16px 24px;
}

/* ---------- Sunset hero / current card wrapper ---------- */

.sunset-hero {
  border-radius: var(--radius-lg);
  padding: 22px 20px 26px;
  background: linear-gradient(160deg, var(--sunset-1) 0%, var(--sunset-2) 55%, var(--sunset-3) 100%);
  position: relative;
  overflow: hidden;
  color: #fff;
  box-shadow: var(--card-shadow);
  margin-bottom: 18px;
}

.sunset-hero::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0) 70%);
  pointer-events: none;
}

.hero-eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  opacity: 0.92;
  margin: 0 0 6px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.2;
}

.hero-meta {
  font-size: 0.94rem;
  opacity: 0.95;
  margin: 0 0 4px;
}

.hero-countdown {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  background: rgba(255,255,255,0.22);
  padding: 4px 12px;
  border-radius: 999px;
}

.hero-notes {
  font-size: 0.88rem;
  opacity: 0.92;
  margin: 10px 0 0;
  line-height: 1.45;
}

/* ---------- Cards (generic) ---------- */

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--card-shadow);
  margin-bottom: 16px;
}

.card-eyebrow {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--sage);
  margin: 0 0 6px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--indigo);
  margin: 0 0 6px;
  line-height: 1.25;
}

.card-meta {
  font-size: 0.92rem;
  color: var(--ink);
  opacity: 0.85;
  margin: 0 0 2px;
}

.card-notes {
  font-size: 0.88rem;
  color: var(--ink);
  opacity: 0.78;
  margin: 8px 0 0;
  line-height: 1.45;
}

.empty-message {
  text-align: center;
  padding: 40px 16px;
}

.empty-message .card-title {
  font-size: 1.4rem;
}

.empty-message a:not(.navigate-btn) {
  color: var(--terracotta);
  font-weight: 600;
  text-decoration: underline;
}

/* ---------- Navigate button ---------- */

.navigate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  background: var(--terracotta);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 18px;
  margin-top: 12px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(193, 95, 60, 0.35);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.navigate-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(193, 95, 60, 0.3);
}

.navigate-btn.small {
  min-height: 40px;
  font-size: 0.85rem;
  padding: 8px 14px;
  margin-top: 8px;
}

.navigate-btn .icon {
  font-size: 1.1em;
}

/* On the sunset hero, keep the same terracotta button for consistency and contrast */

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}

.badge-confirmed { background: rgba(217, 164, 65, 0.22); color: #8A6415; }
.badge-backup { background: rgba(217, 164, 65, 0.16); color: #8A6415; }
.badge-tentative { background: rgba(138, 154, 91, 0.18); color: #5C6640; }

/* ---------- Today's schedule expander ---------- */

.today-expander {
  margin-top: 4px;
}

.expander-toggle {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(58, 46, 40, 0.15);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--indigo);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.expander-toggle .chevron {
  transition: transform 0.2s ease;
}

.expander-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.expander-body {
  margin-top: 10px;
}

.expander-body[hidden] { display: none; }

/* ---------- Timeline / event rows (Full Week + today list) ---------- */

.day-section {
  margin-bottom: 22px;
  scroll-margin-top: 16px;
}

.day-heading {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--indigo);
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px dashed rgba(138, 154, 91, 0.4);
}

.event-row {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--card-shadow);
}

.event-row-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.event-time {
  font-weight: 700;
  color: var(--terracotta-dark);
  font-size: 0.92rem;
  white-space: nowrap;
}

.event-title-line {
  flex: 1;
}

.event-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}

.event-location {
  font-size: 0.85rem;
  opacity: 0.7;
  margin: 3px 0 0;
}

.event-notes {
  font-size: 0.85rem;
  opacity: 0.75;
  margin: 8px 0 0;
  line-height: 1.4;
}

/* ---------- Day jump nav (Full Week) ---------- */

.day-jump {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 16px;
  margin: 0 -2px;
  -webkit-overflow-scrolling: touch;
}

.day-jump::-webkit-scrollbar { display: none; }

.day-jump-btn {
  flex: 0 0 auto;
  background: var(--card-bg);
  border: 1px solid rgba(58, 46, 40, 0.12);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--indigo);
  min-height: 40px;
}

.day-jump-btn.active {
  background: var(--terracotta);
  color: #fff;
  border-color: var(--terracotta);
}

/* ---------- Reservation panel ---------- */

.reservation-toggle {
  width: 100%;
  background: rgba(46, 71, 86, 0.06);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--indigo);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.reservation-toggle .chevron {
  transition: transform 0.2s ease;
}

.reservation-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.reservation-panel {
  margin-top: 10px;
  padding: 14px;
  background: rgba(46, 71, 86, 0.05);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  line-height: 1.5;
}

.reservation-panel[hidden] { display: none; }

.reservation-row {
  margin: 0 0 8px;
}

.reservation-row:last-child { margin-bottom: 0; }

.reservation-label {
  font-weight: 700;
  color: var(--indigo);
  margin-right: 4px;
}

.reservation-policy {
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px dashed rgba(58, 46, 40, 0.18);
  opacity: 0.85;
}

.reservation-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--terracotta);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 8px 14px;
  border-radius: 999px;
  min-height: 38px;
}

.contact-link.secondary {
  background: var(--indigo);
}

.reservation-address {
  margin-top: 10px;
  opacity: 0.75;
}

/* ---------- Footer ---------- */

.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(60px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.74rem;
  color: var(--ink);
  opacity: 0.65;
  pointer-events: none;
  z-index: 5;
}

.app-footer > * { pointer-events: auto; }

.refresh-btn {
  background: none;
  border: 1px solid rgba(58, 46, 40, 0.3);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink);
  min-height: 30px;
}

/* This footer is fixed above the tab bar; views need bottom padding already applied via #app */

/* ---------- Tab bar ---------- */

.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: var(--card-bg);
  border-top: 1px solid rgba(58, 46, 40, 0.1);
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  z-index: 10;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink);
  opacity: 0.55;
  min-height: 48px;
}

.tab-btn.active {
  opacity: 1;
  color: var(--terracotta-dark);
}

.tab-icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* ---------- Install tip ---------- */

.install-tip {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  background: var(--indigo);
  color: #fff;
  font-size: 0.8rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 8;
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}

.install-tip[hidden] {
  display: none;
}

.tip-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px 6px;
  opacity: 0.8;
}

/* ---------- Update toast ---------- */

.update-toast {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  background: var(--sage);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 999px;
  z-index: 20;
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}

/* ---------- Collapsed notes (day notes, nice-to-have) ---------- */

.day-notes-toggle {
  background: none;
  border: none;
  color: var(--sage);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 0;
  min-height: 32px;
}

.day-notes-body {
  font-size: 0.85rem;
  opacity: 0.8;
  padding: 8px 0 0;
  line-height: 1.5;
}

.day-notes-body[hidden] { display: none; }

/* ---------- Map view (Leaflet + OpenStreetMap) ----------
   The map tab behaves like a real map screen: it fills the space between
   the header and the bottom bar exactly (height set in JS, see sizeMapView
   in app.js) and never scrolls as a page. The day legend and the stop
   detail card float on top of the map instead of pushing it down, so
   there's nothing to scroll past and nothing for the map's own touch-drag
   panning to fight with. */

.view-map {
  padding: 0;
  position: relative;
  overflow: hidden;
}

#leaflet-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-legend {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}

.map-day-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 253, 249, 0.94);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(58, 46, 40, 0.12);
  border-radius: 999px;
  padding: 6px 11px 6px 9px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink);
  opacity: 0.8;
  min-height: 34px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  pointer-events: auto;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.map-day-chip.active {
  opacity: 1;
  border-color: var(--chip-color);
  border-width: 2px;
  padding: 5px 10px 5px 8px;
}

.map-day-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--chip-color);
  flex: 0 0 auto;
}

.map-day-dot-all {
  background: none;
  background-image: var(--chip-color);
}

.map-day-chip-all.active {
  border-color: var(--indigo);
}

.map-offline-note {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: #fff;
  background: linear-gradient(160deg, var(--indigo), #1c2f39);
}

/* Custom divIcon markers */
.map-pin-icon {
  background: none;
  border: none;
}

.map-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--pin-color, var(--terracotta));
  border: 2px solid #fff;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(0,0,0,0.35);
}

.map-pin-home {
  width: 34px;
  height: 34px;
  background: var(--indigo);
  font-size: 1.1rem;
  box-shadow: 0 3px 10px rgba(0,0,0,0.4);
}

.map-hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink);
  background: rgba(255, 253, 249, 0.94);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.map-detail-floating {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  max-height: 55%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.map-detail-floating .map-detail {
  margin-top: 0;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
}

/* Keep Leaflet's own UI (zoom buttons, attribution) legible against the warm theme */
.leaflet-control-attribution {
  font-size: 0.65rem;
}

@media (min-width: 600px) {
  #app { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
}
