/* i18n rules — keep in sync with base.html inline block */
.i18n-en { display: none; }

/* Glassmorphism */
.glass-nav {
    background: rgba(251, 249, 248, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Metric cards */
.metric-card-grid {
    align-items: stretch;
}
.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* Info tooltip — circled (i) next to card labels */
.info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
    color: #b8b3b1;
    line-height: 1;
    outline: none;
}
.info-tip:hover,
.info-tip:focus-visible {
    color: #9f4200;
}
.info-tip-icon {
    font-size: 15px !important;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}
.info-tip-bubble {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    width: max-content;
    max-width: 240px;
    padding: 0.55rem 0.7rem;
    background: #1b1c1c;
    color: #fbf9f8;
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.4;
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(27, 28, 28, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 50;
    text-align: left;
    white-space: normal;
}
.info-tip-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1b1c1c;
}
.info-tip:hover .info-tip-bubble,
.info-tip:focus-visible .info-tip-bubble {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Sparkline charts */
.sparkline-chart {
    width: 100%;
    height: auto;
    display: block;
}

/* Expandable stats panel */
#more-stats-wrapper {
    transition: max-height 0.5s ease-in-out;
}
#more-stats-fade {
    transition: opacity 0.3s ease-in-out;
}

/* Ambient shadow */
.ambient-shadow {
    box-shadow: 0 4px 60px rgba(27, 28, 28, 0.05);
}

/* Ghost border */
.ghost-border {
    box-shadow: inset 0 0 0 1px rgba(222, 192, 179, 0.15);
}

/* Line-trace progress bar */
.line-trace {
    height: 2px;
    background: #dec0b3;
    position: relative;
}
.line-trace-active {
    height: 2px;
    background: linear-gradient(90deg, #f67a32 0%, #9f4200 100%);
    box-shadow: 0 0 12px rgba(246, 122, 50, 0.4);
}

/* Line-Trace progress bar — shared by status.html and the coverage veil modal */
.line-trace-track {
    height: 2px;
    background: rgba(222, 192, 179, 0.4);
    border-radius: 9999px;
    overflow: hidden;
}
.line-trace-fill {
    height: 100%;
    background: linear-gradient(90deg, #9F4200, #F67A32);
    border-radius: 9999px;
    box-shadow: 0 0 8px rgba(246, 122, 50, 0.45);
    transition: width 0.6s ease;
}
.line-trace-fill.zero { background: rgba(95, 94, 94, 0.25); box-shadow: none; }
.line-trace-fill.full { background: #9F4200; }

/* Coverage veil — applied while mapping is incomplete.
   Dims and desaturates statistical sections on the homepage until the user
   acknowledges that the data is provisional. Numbers remain legible. */
.coverage-veiled {
    filter: grayscale(1);
    opacity: 0.55;
    transition: filter 0.5s ease, opacity 0.5s ease;
    pointer-events: none;
    user-select: none;
}
body.coverage-acknowledged .coverage-veiled {
    filter: none;
    opacity: 1;
    pointer-events: auto;
    user-select: auto;
}

/* Coverage modal — centered glass card over the greyed page */
.coverage-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
body.coverage-acknowledged .coverage-modal {
    display: none;
}
.coverage-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(27, 28, 28, 0.32);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.coverage-modal-card {
    position: relative;
    max-width: 34rem;
    width: 100%;
    background: rgba(251, 249, 248, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 1.5rem;
    padding: 2.25rem 2rem;
}
@media (min-width: 640px) {
    .coverage-modal-card { padding: 2.75rem 2.5rem; }
}

/* Material Symbols */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
}

/* Time breakdown bar */
.time-bar {
    display: flex;
    width: 100%;
    height: 28px;
    border-radius: 9999px;
    overflow: hidden;
}
.time-bar > div {
    min-width: 2px;
}
.time-bar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    font-size: 0.8rem;
    color: #5f5e5e;
}
.time-bar-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 0.2rem;
}

/* Hotspot items — JS renders these */
.hotspot-item {
    display: block;
    width: 100%;
    text-align: left;
    background: #ffffff;
    padding: 0.75rem 0.8rem;
    border: none;
    border-left: 4px solid #d0d0d0;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 20px rgba(27, 28, 28, 0.04);
}
.hotspot-item:hover {
    background: #fbf9f8;
}
.hotspot-item.is-active {
    box-shadow: 0 0 0 2px rgba(159, 66, 0, 0.15), 0 4px 20px rgba(27, 28, 28, 0.06);
    background: #f6f3f2;
}
.hotspot-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(246, 122, 50, 0.25);
}
.hotspot-item--traffic_light { border-left-color: #d64545; }
.hotspot-item--combined { border-left-color: #e2722c; }
.hotspot-item--transit_stop { border-left-color: #3f9f67; }
.hotspot-item--bottleneck { border-left-color: #2d6fae; }
.hotspot-item-top {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
}
.hotspot-item-rank {
    color: #757575;
    font-size: 0.76rem;
    font-weight: 700;
}
.hotspot-item-cat {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.68rem;
    color: #5a5a5a;
    font-weight: 700;
}
.hotspot-item-wait {
    margin-left: auto;
    font-size: 1.02rem;
    font-weight: 700;
    color: #1b1c1c;
}
.hotspot-item-meta {
    margin-top: 0.28rem;
    font-size: 0.76rem;
    color: #5f5e5e;
    line-height: 1.3;
}
.hotspot-item-lines {
    margin-top: 0.24rem;
    font-size: 0.75rem;
    line-height: 1.3;
    color: #444;
}
.hotspots-empty {
    margin: 0.4rem 0;
    color: #777;
    font-size: 0.88rem;
}
.hotspots-list-inner {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Leaflet popup overrides */
.hotspot-popup h3 {
    margin: 0 0 0.1rem;
    text-transform: capitalize;
}
.hotspot-popup p {
    margin: 0.35rem 0;
    font-size: 0.85rem;
}
.hotspot-popup ul {
    margin: 0.2rem 0 0.5rem;
    padding-left: 1rem;
}
.hotspot-popup li {
    margin: 0.2rem 0;
    font-size: 0.82rem;
}
.hotspot-popup-coord {
    color: #5f5e5e;
    font-size: 0.75rem !important;
}
.hotspot-popup-sub {
    color: #5f5e5e;
    font-size: 0.75rem;
}

/* Leaflet container — font + keep below fixed navbar */
.leaflet-container {
    font-family: Inter, -apple-system, sans-serif;
    z-index: 0;
}

/* Custom scrollbar */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Category toggle buttons */
.hotspot-cat-btn {
    background: rgba(27, 28, 28, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
}
.hotspot-cat-btn.is-active {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.hotspot-cat-btn:not(.is-active) {
    opacity: 0.4;
}
.hotspot-cat-btn:not(.is-active) .cat-icon {
    filter: grayscale(1);
}
.hotspot-cat-btn:not(.is-active) .cat-label {
    color: #999;
}
.hotspot-cat-btn:not(.is-active) .cat-desc {
    color: #bbb;
}
.hotspot-cat-btn:hover {
    border-color: rgba(0, 0, 0, 0.12);
}

/* Time band toggle buttons */
.hotspot-band-btn {
    color: #5f5e5e;
}
.hotspot-band-btn .band-icon {
    color: #8b7266;
}
.hotspot-band-btn.is-active {
    background: #ffffff;
    color: #1b1c1c;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    ring: 1px solid rgba(0, 0, 0, 0.05);
}
.hotspot-band-btn.is-active .band-icon {
    color: #9f4200;
}
.hotspot-band-btn:hover:not(.is-active) {
    color: #1b1c1c;
}

/* Commute select styling */
.commute-select {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(222, 192, 179, 0.3);
    border-radius: 0.75rem;
    background: #ffffff;
    color: #1b1c1c;
    cursor: pointer;
    width: 100%;
    max-width: 280px;
    transition: all 0.15s;
}
.commute-select:disabled {
    border-color: #e4e2e1;
    color: #999;
    cursor: default;
}
.commute-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(246, 122, 50, 0.15);
    border-color: #f67a32;
}

/* ==== Debug / ride inspector layout ==== */
.debug-inspect-shell {
    display: flex;
    height: calc(100vh - 4rem); /* viewport minus fixed navbar */
    min-height: 480px;
}
.debug-inspect-sidebar {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e4e2e1;
    background: #f6f3f2;
}
.debug-inspect-sidebar-head {
    padding: 1rem 1.25rem 0.5rem;
    border-bottom: 1px solid #e4e2e1;
}
.debug-ride-list {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
    overflow-y: auto;
    flex: 1;
}
.debug-ride-row {
    margin: 0;
    padding: 0;
}
.debug-ride-row + .debug-ride-row {
    border-top: 1px solid #eae8e7;
}
.debug-ride-row:hover {
    background: #eae8e7;
}
.debug-ride-row.is-selected {
    background: #ffdbcb;
}
.debug-ride-label {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 1.25rem;
    cursor: pointer;
}
.debug-ride-label input[type="radio"] {
    margin-top: 0.25rem;
    accent-color: #9f4200;
    flex-shrink: 0;
}
.debug-ride-text {
    min-width: 0;
    flex: 1;
}
.debug-ride-name {
    font-size: 12px;
    font-weight: 500;
    color: #1b1c1c;
    word-break: break-word;
    line-height: 1.35;
}
.debug-ride-meta {
    font-size: 10.5px;
    color: #8b7266;
    margin-top: 2px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.debug-sort-btn.is-active {
    background: #ffdbcb;
    border-color: #f67a32;
    color: #5c2300;
}
.debug-sort-arrow {
    margin-left: 0.25rem;
    font-size: 11px;
}
.debug-inspect-main {
    flex: 1;
    position: relative;
    background: #fbf9f8;
    min-width: 0;
}
.debug-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}
.debug-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}
@media (max-width: 768px) {
    .debug-inspect-shell {
        flex-direction: column;
        height: auto;
    }
    .debug-inspect-sidebar {
        width: 100%;
        max-height: 50vh;
        border-right: 0;
        border-bottom: 1px solid #e4e2e1;
    }
    .debug-inspect-main {
        min-height: 60vh;
    }
}
