:root {
  --color-flight: #3498db;
  --color-train: #e67e22;
  --color-bus: #f1c40f;
  --color-stay: #9b59b6;
  --color-visit: #2ecc71;
  --bg-color: #f0f2f5;
  --card-bg: #ffffff;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  color: #333;
  background: var(--bg-color);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Layout */
.split-view {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  position: relative;
}

.timeline-container {
  flex: 0 0 450px;
  overflow-y: auto;
  background: var(--bg-color);
  border-right: 1px solid #ddd;
  position: relative;
  z-index: 20;
  transition: transform 0.3s ease-in-out;
}

.map-wrapper {
  flex: 1;
  position: relative;
  z-index: 1;
}

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

/* Toggle Button (Hidden on Desktop) */
.sidebar-toggle {
  display: none;
  position: absolute;
  bottom: calc(2rem + env(safe-area-inset-bottom));
  left: 1rem;
  z-index: 1000;
  background: white;
  border: none;
  padding: 0.8rem 1.2rem;
  border-radius: 30px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  font-weight: bold;
  color: #2c3e50;
  cursor: pointer;
  align-items: center;
  gap: 0.5rem;
}

/* Timeline Components */
.timeline-header {
  padding: 2rem;
  background: #2c3e50;
  color: white;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.timeline-header h1 { margin: 0; font-size: 1.5rem; }
.timeline-header p { margin: 0.5rem 0 0; opacity: 0.8; font-size: 0.9rem; }

.timeline {
  list-style: none;
  padding: 1rem;
  margin: 0;
}

.timeline-item {
  margin-bottom: 2rem;
  opacity: 0.8;
  transition: all 0.3s ease;
  cursor: pointer;
}

.timeline-item.active {
  opacity: 1;
  transform: scale(1.02);
}

.timeline-item.active .item-card {
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  border-left-width: 6px;
}

/* Card Design */
.item-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  border-left: 6px solid #ccc;
  transition: border-left-width 0.2s;
}

.item-card.flight { border-left-color: var(--color-flight); }
.item-card.train { border-left-color: var(--color-train); }
.item-card.stay { border-left-color: var(--color-stay); }
.item-card.visit { border-left-color: var(--color-visit); }

.card-header {
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(0,0,0,0.02);
  border-bottom: 1px solid #eee;
}

.icon-badge {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-text h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #2c3e50;
}

.card-body {
  padding: 1rem;
}

.schedule-grid {
  display: flex;
  align-items: stretch;
  margin-bottom: 1rem;
}

.time-point {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.time-point.start { text-align: left; }
.time-point.end { text-align: right; }

.time-point .time { font-weight: 800; font-size: 1.1rem; color: #2c3e50; }
.time-point .date { font-size: 0.75rem; color: #7f8c8d; text-transform: uppercase; margin-top: 2px; }
.time-point .location { font-size: 0.85rem; color: #555; margin-top: 4px; line-height: 1.2; }

.connector {
  flex: 0 0 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 0.8rem;
  position: relative;
}

.connector .line {
  flex: 1;
  width: 2px;
  background: #eee;
  margin: 5px 0;
}

.connector .via, .connector .via-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid #eee;
  font-size: 0.65rem;
  color: #777;
  z-index: 2;
  text-align: center;
  max-width: 120px;
}

.connector .via-text {
  /* Allow wrapping for list */
  white-space: normal; 
  line-height: 1.2;
}

.stay-details {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #555;
}

.stay-details .icon { margin-right: 5px; }

.description {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.5;
  border-top: 1px dashed #eee;
  padding-top: 0.8rem;
}

.timeline-footer {
  text-align: center;
  padding: 2rem;
  color: #999;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Mobile Layout */
@media (max-width: 768px) {
  .sidebar-toggle {
    display: flex;
  }

  .split-view {
    overflow: hidden; /* Contain drawer */
  }

  .map-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  .timeline-container {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 85%;
    max-width: 350px;
    transform: translateX(-100%); /* Hidden by default */
    box-shadow: 2px 0 20px rgba(0,0,0,0.3);
  }

  .timeline-container.open {
    transform: translateX(0);
  }
}