/* ============================================================
   EthioRoute — Left Drawer Panel & Route Results (panels.css)
   ============================================================ */

/* --- Left Drawer --- */
#drawer {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 320px;
    background: var(--bg-1);
    border-right: 1px solid var(--bg-3);
    z-index: 1200;
    /* Above everything */
    display: flex;
    flex-direction: column;
    transform: translate3d(-100%, 0, 0);
    transition: transform 0.3s var(--ease);
    will-change: transform;
    overflow: hidden;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.05);
}

#drawer.open {
    transform: translate3d(0, 0, 0);
}

#drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px;
    border-bottom: 1px solid #E9ECEF;
    flex-shrink: 0;
}

#drawer-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

#drawer-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-3);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

#drawer-close:hover {
    color: var(--text-primary);
}

#drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-3) transparent;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Mode Tabs */
.mode-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    background: var(--bg-2);
    border-radius: var(--r-sm);
    padding: 4px;
}

.mode-tab {
    flex: 1;
    height: 34px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.18s, color 0.18s;
}

.mode-tab.active {
    background: var(--accent);
    color: #000;
}

/* Section headings inside drawer */
.drawer-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin: 16px 0 8px;
}

/* Route Planner Inputs */
.route-input-row {
    position: relative;
    margin-bottom: 10px;
}

.route-input-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    pointer-events: none;
}

.route-input {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid #DEE2E6;
    border-radius: var(--r-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    padding: 9px 10px 9px 28px;
    outline: none;
    transition: border-color var(--dur);
}

.route-input:focus {
    border-color: var(--accent);
}

/* Inline autocomplete dropdown for route-from / route-to inputs */
.route-results-dropdown {
    display: none;
    background: var(--bg-1);
    border: 1px solid var(--bg-3);
    border-radius: var(--r-sm);
    overflow: hidden;
    margin-bottom: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    /* Max 4 results visible before scroll */
    max-height: 220px;
    overflow-y: auto;
}

.route-results-dropdown.open {
    display: block;
    animation: slideDown 0.15s var(--ease);
}

/* Tighter result items inside the narrow drawer */
.route-results-dropdown .result-item {
    padding: 8px 12px;
    gap: 10px;
}

.route-results-dropdown .result-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.route-results-dropdown .result-icon img {
    width: 16px;
    height: 16px;
}

.route-results-dropdown .result-name {
    font-size: 13px;
}

.route-results-dropdown .result-suggest {
    font-size: 12px;
    padding: 7px 12px;
}

#btn-plan-route {
    width: 100%;
    height: 40px;
    border-radius: var(--r-sm);
    background: var(--accent);
    border: none;
    color: #000;
    font-weight: 700;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    margin-top: 6px;
    transition: background 0.15s;
}

#btn-plan-route:hover {
    background: var(--accent-dim);
}

/* Layer toggles */
.layer-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #E9ECEF;
    cursor: pointer;
}

.layer-toggle:last-child {
    border-bottom: none;
}

.layer-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.layer-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.toggle-switch {
    width: 38px;
    height: 22px;
    border-radius: 11px;
    background: var(--bg-3);
    position: relative;
    cursor: pointer;
    border: none;
    transition: background 0.2s, opacity 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

/* Locked state — shown before any route is searched */
.toggle-switch.route-locked:not(.route-mode) {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Once route-mode is active, restore full opacity and pointer */
.toggle-switch.route-mode {
    opacity: 1;
    cursor: pointer;
}

.toggle-switch.on {
    background: var(--accent);
}

/* When on AND in route-mode — highlight with glow: this transit IS used in the route */
.toggle-switch.route-mode.on {
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.35);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s var(--ease);
}

.toggle-switch.on::after {
    transform: translateX(16px);
}

/* Shake animation for locked toggle clicks */
@keyframes toggle-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

.toggle-switch.shake {
    animation: toggle-shake 0.4s ease;
}

/* Layer toggle row — dim when locked */
.layer-toggle:has(.route-locked) .layer-label {
    opacity: 0.45;
}

/* Route-active hint label */
.transit-layers-hint {
    font-size: 11px;
    color: var(--accent);
    margin: 6px 0 10px;
    padding: 6px 10px;
    background: rgba(255, 204, 0, 0.08);
    border-radius: 6px;
    border-left: 3px solid var(--accent);
    display: none;
}

.transit-layers-hint.visible {
    display: block;
}

/* --- Route Results / Steps --- */
#route-results {
    display: none;
    margin-top: 14px;
}

#route-results.visible {
    display: block;
}

.route-summary {
    background: var(--bg-2);
    border-radius: var(--r-md);
    padding: 14px;
    margin-bottom: 12px;
    display: flex;
    gap: 16px;
}

.route-stat {
    text-align: center;
}

.route-stat-val {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.route-stat-lbl {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.route-step {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #E9ECEF;
}

.route-step:last-child {
    border-bottom: none;
}

.step-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.step-icon.walk {
    background: rgba(153, 153, 168, 0.15);
}

.step-icon.minibus {
    background: rgba(255, 204, 0, 0.18);
}

.step-icon.lrt {
    background: rgba(0, 200, 83, 0.18);
}

.step-icon.anbessa {
    background: rgba(255, 61, 0, 0.18);
}

.step-body {
    flex: 1;
    min-width: 0;
}

.step-main {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
}

.step-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.step-note {
    font-size: 11px;
    color: #FFA726;
    margin-top: 3px;
    font-style: italic;
}

.step-dur {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 700;
    flex-shrink: 0;
}

/* --- Walking Directions (collapsible sub-steps) --- */
.walk-directions {
    margin-top: 6px;
    border-radius: 6px;
    overflow: hidden;
}

.walk-directions summary {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 0;
    list-style: none;
    user-select: none;
    transition: color 0.15s;
}

.walk-directions summary:hover {
    color: var(--accent);
}

.walk-directions summary::before {
    content: '▶';
    font-size: 8px;
    margin-right: 5px;
    display: inline-block;
    transition: transform 0.2s;
}

.walk-directions[open] summary::before {
    transform: rotate(90deg);
}

.walk-dir-list {
    margin: 4px 0 0;
    padding-left: 18px;
    list-style: none;
    counter-reset: walk-step;
}

.walk-dir-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #F1F3F5;
    counter-increment: walk-step;
    font-size: 11px;
}

.walk-dir-item:last-child {
    border-bottom: none;
}

.walk-dir-item::before {
    content: counter(walk-step);
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-3);
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.walk-dir-text {
    flex: 1;
    color: var(--text-secondary);
    line-height: 1.4;
}

.walk-dir-dist {
    flex-shrink: 0;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* --- Driver Heatmap Panel --- */
#driver-panel {
    display: none;
}

#driver-panel.visible {
    display: block;
}

.driver-route-select {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid #DEE2E6;
    border-radius: var(--r-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    padding: 10px 12px;
    outline: none;
    margin-bottom: 14px;
}

.demand-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.return-demand-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding: 12px;
    background: var(--bg-2);
    border-radius: var(--r-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

/* WAITING COUNT BADGE */
.waiting-count {
    font-size: 22px;
    font-weight: 800;
    color: var(--danger);
    text-align: center;
    margin: 8px 0 4px;
}

.waiting-label {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* --- Drawer Toggle Button (hamburger) --- */
#btn-drawer-toggle {
    position: fixed;
    top: 14px;
    left: 56px;
    /* after header padding */
    z-index: 1001;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: color 0.15s;
}

#btn-drawer-toggle:hover {
    color: var(--text-primary);
}

@media (max-width: 600px) {
    #drawer {
        width: 100%;
        max-width: 360px;
    }
}

/* ============================================================
   Tariff Comparison Section (inside Route Steps)
   ============================================================ */

.tariff-section {
    margin-top: 14px;
    border-top: 1px solid #E9ECEF;
    padding-top: 12px;
}

/* 💡 Tip banner — shown when a cheaper mode exists */
.tariff-tip {
    background: rgba(255, 204, 0, 0.10);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.5;
}

.tariff-tip strong {
    color: var(--accent);
}

/* Collapsible "Compare all fares" disclosure */
.tariff-details {
    border-radius: 8px;
    overflow: hidden;
}

.tariff-details summary {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 2px;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    transition: color 0.15s;
}

.tariff-details summary:hover {
    color: var(--accent);
}

.tariff-details summary::before {
    content: '▶';
    font-size: 9px;
    transition: transform 0.2s;
    display: inline-block;
}

.tariff-details[open] summary::before {
    transform: rotate(90deg);
}

/* Fare comparison table */
.tariff-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 12px;
}

.tariff-table th {
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    padding: 4px 6px 6px;
    border-bottom: 1px solid #E9ECEF;
}

.tariff-table td {
    padding: 7px 6px;
    color: var(--text-secondary);
    border-bottom: 1px solid #F1F3F5;
    font-weight: 600;
}

.tariff-table tr:last-child td {
    border-bottom: none;
}

/* Highlight the mode actually used in the route */
.tariff-table tr.tariff-row-used td {
    background: rgba(255, 204, 0, 0.07);
    color: var(--text-primary);
}

.tariff-table tr.tariff-row-used td:first-child {
    border-left: 3px solid var(--accent);
    padding-left: 4px;
    border-radius: 2px 0 0 2px;
}

/* Disclaimer note at bottom of comparison */
.tariff-note {
    font-size: 10px;
    color: var(--text-muted);
    margin: 8px 0 4px;
    font-style: italic;
}

/* ============================================================
   Route Option Cards (Phase C — multi-alternative display)
   ============================================================ */

.route-options-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.route-option-card {
    background: var(--bg-2);
    border: 1px solid #DEE2E6;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
    position: relative;
}

.route-option-card::before {
    content: '';
    display: block;
    height: 3px;
    width: 100%;
    background: var(--card-accent, var(--text-muted));
}

.route-option-card:hover {
    border-color: #ADB5BD;
}

.route-option-card.selected {
    border-color: var(--card-accent, var(--accent));
    box-shadow: 0 0 0 1px var(--card-accent, var(--accent));
}

/* Accent colors per preference — set as CSS variable on the card */
.route-option-card[data-pref="cheapest"] { --card-accent: #40C057; }
.route-option-card[data-pref="fastest"]  { --card-accent: #F59F00; }
.route-option-card[data-pref="comfortable"] { --card-accent: #339AF0; }

/* Card header row: preference label + stats */
.option-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 0;
}

.option-pref-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--card-accent, var(--text-muted));
}

.option-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.option-stat-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

.option-stat-val {
    color: var(--text-primary);
    font-weight: 700;
}

.option-stat-unit {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
}

/* Card body: transit leg chain */
.option-body {
    padding: 8px 14px 12px;
}

.option-leg-chain {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-secondary);
}

.option-leg-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.04);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.option-leg-chip .leg-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.option-leg-arrow {
    color: var(--text-muted);
    font-size: 10px;
}

.option-transfer-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 7px;
    border-radius: 5px;
    background: rgba(255, 152, 0, 0.08);
    font-size: 10px;
    font-weight: 600;
    color: #FFA726;
    white-space: nowrap;
}

/* Expanded detail section (shown when card is tapped) */
.option-detail {
    display: none;
    border-top: 1px solid #E9ECEF;
    padding: 10px 14px 14px;
}

.route-option-card.expanded .option-detail {
    display: block;
    animation: optionExpand 0.2s var(--ease);
}

@keyframes optionExpand {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 500px; }
}

/* "No results" state */
.route-no-results {
    text-align: center;
    padding: 20px 12px;
    color: var(--text-muted);
    font-size: 13px;
}

.route-no-results .no-results-icon {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}

/* ============================================================
   Route Cards Floating Overlay (on map)
   ============================================================ */

#route-cards-overlay {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    display: none;
    width: calc(100% - 32px);
    max-width: 600px;
    pointer-events: none;
}

#route-cards-overlay.visible {
    display: block;
    animation: overlaySlideUp 0.28s ease-out;
}

@keyframes overlaySlideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Override card styles when inside the overlay */
#route-cards-overlay .route-options-container {
    display: flex;
    flex-direction: row;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 8px;
    scrollbar-width: none;
    pointer-events: auto;
}

#route-cards-overlay .route-options-container::-webkit-scrollbar {
    display: none;
}

#route-cards-overlay .route-option-card {
    min-width: 260px;
    max-width: 300px;
    flex-shrink: 0;
    scroll-snap-align: start;
    background: var(--bg-1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15), 0 1px 4px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.08);
}

#route-cards-overlay .route-option-card.selected {
    box-shadow: 0 4px 20px rgba(0,0,0,0.2), 0 0 0 2px var(--card-accent, var(--accent));
}

/* Hide the expanded detail in overlay — keep cards compact */
#route-cards-overlay .option-detail {
    display: none !important;
}

/* Close button for the overlay */
#route-cards-overlay .overlay-close {
    position: absolute;
    top: -12px;
    right: -4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-1);
    border: 1px solid var(--bg-3);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    pointer-events: auto;
    z-index: 1;
    transition: color 0.15s, background 0.15s;
}

#route-cards-overlay .overlay-close:hover {
    background: var(--bg-3);
    color: var(--text-primary);
}

@media (max-width: 600px) {
    #route-cards-overlay {
        bottom: 80px; /* above FABs on mobile */
        width: calc(100% - 20px);
    }

    #route-cards-overlay .route-option-card {
        min-width: 240px;
    }
}

/* ============================================================
   Route Card — Redesigned Icon-Centered Layout
   Added for route-panel.js card redesign (2026-07)
   ============================================================ */

/* Centered vehicle icon(s) at top of card */
.option-vehicle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 14px 4px;
    color: var(--text-secondary);
}

/* "+" separator between two vehicle icons on multi-modal cards */
.option-vehicle-icon-sep {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1;
}

/* Route name below the icon */
.option-route-name {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    padding: 2px 14px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Horizontal pill row below the route name */
.option-pills-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    padding: 4px 10px 14px;
}