:root {
    --bg-dark: #1b1c2a;
    --bg-panel: #232536;
    --text-primary: #ffffff;
    --text-secondary: #9ba1b9;
    --accent-pink: #d81b60;
    --accent-blue: #3f51b5;
    --border-color: #2f3247;
    --font-family: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
}

.icon { width: 20px; height: 20px; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; vertical-align: middle; }

.app-container { display: flex; height: 100vh; width: 100vw; }

/* ====== SIDEBAR ====== */
.sidebar {
    width: 380px; background-color: var(--bg-panel); color: var(--text-primary);
    display: flex; flex-direction: column; z-index: 1000; box-shadow: 2px 0 16px rgba(0,0,0,0.1);
    position: relative; overflow: hidden;
}
.sidebar-scroll-content {
    flex: 1; overflow-y: auto; overflow-x: hidden;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-panel);
}
.sidebar-header h2 { font-size: 20px; margin-bottom: 4px; }
.sidebar-header .subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 24px; }

/* Route Planning Inputs */
.routing-inputs {
    background: rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
    position: relative;
}
.routing-inputs::before {
    content: '';
    position: absolute;
    left: 27px;
    top: 36px;
    bottom: 36px;
    width: 2px;
    background: rgba(255,255,255,0.1);
    z-index: 1;
}

.search-box { margin-bottom: 12px; position: relative; z-index: 2; }
.search-box:last-child { margin-bottom: 0; }
.search-label {
    display: none; /* Hide label to save space, relying on placeholder */
}

.input-wrapper {
    display: flex; align-items: center;
    background: #ffffff; border-radius: 8px; padding: 10px 14px; color: #333; position: relative;
}
.input-wrapper input {
    border: none; outline: none; background: transparent;
    width: 100%; margin-left: 10px; font-family: var(--font-family); font-size: 14px; color: #333;
}

/* Secondary Options (Time, Mode, Settings) */
.routing-options {
    display: flex; gap: 8px; margin-bottom: 16px; flex-direction: column; align-items: stretch;
}
.option-box {
    display: flex; align-items: center; justify-content: flex-start; gap: 8px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; padding: 10px 12px; color: var(--text-primary);
    position: relative; cursor: pointer; transition: background 0.2s; width: 100%;
}
.option-box:hover { background: rgba(255,255,255,0.1); }
#btn-adv-settings { flex: 0 0 auto; padding: 8px 10px; }

.sidebar-input {
    background: transparent; border: none; outline: none; color: white;
    font-family: var(--font-family); font-size: 13px; font-weight: 500;
    width: 100%; cursor: pointer;
}
.sidebar-input option { color: #333; }
.sidebar-input::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }

.filter-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn-filter, .btn-route {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: transparent; border: 1px solid var(--text-secondary); color: var(--text-primary);
    border-radius: 20px; padding: 10px 16px; font-family: var(--font-family);
    font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-filter {
    flex: 2; background-color: var(--accent-pink); border-color: var(--accent-pink);
    box-shadow: 0 4px 12px rgba(216, 27, 96, 0.4);
}
.btn-route { flex: 1; }
.btn-filter:hover { background: #e91e63; }
.btn-route:hover { background: rgba(255,255,255,0.1); }

#status-message {
    padding: 12px; border-radius: 8px; font-size: 13px; display: none;
    font-weight: 500; margin-top: 16px;
}

/* Sliders */
.slider-box {
    background: rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}
.slider-wrapper {
    display: flex; align-items: center; gap: 12px;
}
.slider-val {
    font-size: 13px; font-weight: 600; color: #1e88e5; min-width: 48px;
}
.nice-slider {
    flex: 1; -webkit-appearance: none; appearance: none;
    height: 6px; background: #e0e0e0; border-radius: 3px; outline: none;
}
.nice-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: #1e88e5; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.sidebar-list { flex: none; padding-bottom: 24px; background-color: #f5f6f8; }

/* Legend */
.floating-legend {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #333;
    font-size: 13px;
    min-width: 160px;
}
.floating-legend strong {
    display: block; margin-bottom: 12px; text-transform: uppercase;
    font-size: 11px; letter-spacing: 0.5px; color: #777;
}
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 10px; vertical-align: middle; }
.legend-item { display: flex; align-items: center; margin-bottom: 8px; font-size: 13px; color: #555; }

/* ====== ITINERARY CARDS ====== */
#itineraries-container { background: #f5f6f8; }

.itin-card {
    background: white; border-bottom: 1px solid #e8e8e8;
    transition: all 0.2s; cursor: pointer;
}
.itin-card.active { border-left: 4px solid var(--accent-pink); }
.itin-card:hover { background: #fafafa; }

.itin-summary { padding: 16px 20px; }

.itin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.itin-time-range { font-size: 17px; font-weight: 700; color: #222; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.itin-duration { font-size: 14px; color: #888; font-weight: 600; white-space: nowrap; }

.itin-legs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.leg-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; color: white;
}
.leg-arrow { color: #bbb; font-size: 13px; }

.itin-expand-hint {
    font-size: 11px; color: #aaa; margin-top: 8px; text-transform: uppercase; letter-spacing: 0.3px;
}

/* Delay badges */
.delay-badge {
    font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 4px; white-space: nowrap;
}
.delay-late { color: #d32f2f; background: #ffebee; }
.delay-early { color: #1565c0; background: #e3f2fd; }
.delay-ontime { color: #2e7d32; background: #e8f5e9; }

/* ====== EXPANDED DETAILS (TIMELINE) ====== */
.itin-details { padding: 0 20px 16px 20px; background: #fafafa; border-top: 1px solid #eee; }

.leg-timeline { padding-top: 12px; }

.timeline-leg { position: relative; padding-left: 44px; margin-bottom: 4px; }

.timeline-line {
    position: absolute; left: 19px; top: 28px; bottom: -4px;
    border-left: 3px solid #ccc; width: 0;
}
.walk-leg .timeline-line { border-style: dashed !important; }

.timeline-content { display: flex; align-items: flex-start; gap: 12px; }
.timeline-icon {
    width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: white; flex-shrink: 0;
    position: absolute; left: 6px; top: 0; z-index: 1;
}

.timeline-text { flex: 1; padding-top: 2px; }
.timeline-text strong { font-size: 14px; color: #333; }
.timeline-sub { font-size: 12px; color: #999; margin-left: 8px; }

.transit-header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.transit-header strong { font-size: 14px; color: #222; }

.transit-times { font-size: 13px; color: #555; margin: 4px 0; }
.depart-stop, .arrive-stop { display: flex; align-items: center; gap: 6px; }
.time-scheduled { font-weight: 600; color: #333; min-width: 40px; }
.time-real { font-weight: 600; color: #d32f2f; text-decoration: none; }
.time-real::before { content: '→ '; color: #999; }

.transit-duration { font-size: 12px; color: #999; margin: 4px 0; }

/* Stops toggle button */
.stops-toggle {
    background: none; border: 1px solid #ddd; border-radius: 12px;
    padding: 4px 12px; font-size: 12px; color: #1e88e5; cursor: pointer;
    margin: 8px 0; font-family: var(--font-family); font-weight: 500;
    transition: background 0.15s;
}
.stops-toggle:hover { background: #e3f2fd; }

/* Intermediate stops list */
.intermediate-stops { padding: 4px 0 4px 8px; }
.stop-item {
    display: flex; align-items: center; gap: 8px; padding: 4px 0;
    font-size: 12px; color: #666;
}
.stop-dot {
    width: 8px; height: 8px; border-radius: 50%; border: 2px solid #ccc;
    background: white; flex-shrink: 0;
}
.stop-time { font-weight: 600; color: #888; min-width: 36px; font-size: 11px; }
.stop-name { color: #555; }

/* ====== MAP ====== */
.map-container { flex: 1; position: relative; }
#map { width: 100%; height: 100%; background: #e0e0e0; }

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute; top: 110%; left: 0; width: 100%;
    background: white; color: #333; border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2); display: none; z-index: 2000;
    max-height: 250px; overflow-y: auto;
}
.autocomplete-item { padding: 12px 14px; font-size: 13px; cursor: pointer; border-bottom: 1px solid #eee; }
.autocomplete-item:hover { background: #f5f5f5; }
.autocomplete-item strong { display: block; font-size: 14px; margin-bottom: 2px; }

/* Tooltip for isochrones */
.iso-tooltip { font-family: var(--font-family); font-size: 13px; font-weight: 500; }

/* Advanced Settings */
.adv-settings-panel {
    position: absolute;
    top: 260px;
    left: 410px;
    background: white;
    color: #333;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    z-index: 1000;
    width: 250px;
}
