:root {
  --day-1: #E85D04;
  --day-2: #0077B6;
  --day-3: #2D6A4F;
  --bg: #F7F5F2;
  --surface: #FFFFFF;
  --text: #111111;
  --text-muted: #666666;
  --border: #E8E4DF;
  --header-h: 88px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ── Header ── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  box-shadow: 0 1px 8px rgba(0,0,0,0.08);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 16px;
  gap: 8px;
}

h1 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.subtitle {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.tabs {
  display: flex;
  gap: 6px;
}

.tab {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.tab:hover { border-color: var(--text-muted); color: var(--text); }

.tab.active[data-day="0"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.tab.active[data-day="1"] { background: var(--day-1); color: #fff; border-color: var(--day-1); }
.tab.active[data-day="2"] { background: var(--day-2); color: #fff; border-color: var(--day-2); }
.tab.active[data-day="3"] { background: var(--day-3); color: #fff; border-color: var(--day-3); }

/* ── Main layout — mobile first ── */
main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-top: var(--header-h);
}

#map {
  width: 100%;
  height: 45vh;
  flex-shrink: 0;
  z-index: 1;
  transition: height 0.3s ease;
  overflow: hidden;
}


#map-toggle {
  width: 100%;
  padding: 8px;
  background: var(--surface);
  border: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#map-toggle:active { background: var(--bg); }

#timeline {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  padding: 12px;
  scroll-behavior: smooth;
}

/* ── Desktop: split ── */
@media (min-width: 768px) {
  main {
    flex-direction: row;
    height: calc(100vh - var(--header-h));
    padding-top: 0;
    margin-top: var(--header-h);
    overflow: hidden;
  }

  #map {
    width: 55%;
    height: 100%;
  }

  #timeline {
    width: 45%;
    height: 100%;
    padding: 16px;
  }
}

/* ── Day section headings ── */
.day-section { margin-bottom: 8px; }

.day-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
}

.day-label[data-day="1"] { border-left: 3px solid var(--day-1); }
.day-label[data-day="2"] { border-left: 3px solid var(--day-2); }
.day-label[data-day="3"] { border-left: 3px solid var(--day-3); }

/* ── Cards ── */
.place-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  transition: transform 0.15s, box-shadow 0.15s;
  background: var(--surface);
}

.place-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,0.12); }
.place-card.active { box-shadow: 0 0 0 2.5px var(--active-color); }

/* ── Card image wrapper + overlay ── */
.card-img-wrap {
  position: relative;
  overflow: hidden;
}

.card-photo {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.card-img-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent 30%, rgba(0,0,0,0.75));
  padding: 32px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-name {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
}

.card-body {
  padding: 14px;
}

.card-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.badge-day {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  color: #fff;
}

.badge-day[data-day="1"] { background: var(--day-1); }
.badge-day[data-day="2"] { background: var(--day-2); }
.badge-day[data-day="3"] { background: var(--day-3); }

.badge-duration {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.card-desc {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tips-list li {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-left: 14px;
  position: relative;
  line-height: 1.4;
}

.tips-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  font-size: 0.7rem;
}

/* ── Leaflet overrides ── */
.leaflet-popup-content-wrapper {
  background: #ffffff;
  color: #111111;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.leaflet-popup-tip { background: #ffffff; }
.leaflet-popup-content { margin: 10px 12px; font-size: 0.82rem; color: #111111; }
.leaflet-popup-content b { display: block; margin-bottom: 2px; color: #111111; }
.leaflet-container { background: #e8e4df; }
