@keyframes marquee-scroll {
    0% {
        transform: translateX(0)
    }

    to {
        transform: translateX(-100%)
    }
}

.bus-icon-container {
    transition: opacity 0.5s ease, filter 0.5s ease;
}

@keyframes pulse {
    0%,to {
        transform: translateX(-50%) scale(1)
    }

    50% {
        transform: translateX(-50%) scale(1.1)
    }
}

@keyframes slide-green {
    0% {
        transform: translateX(-4px);
        opacity: 0
    }

    50% {
        transform: translateX(0);
        opacity: 1
    }

    to {
        transform: translateX(4px);
        opacity: 0
    }
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239,68,68,.4);
        opacity: 1
    }

    70% {
        box-shadow: 0 0 0 6px transparent
    }

    to {
        box-shadow: 0 0 0 0 transparent;
        opacity: 1
    }

    50% {
        opacity: .7
    }
}

@keyframes location-pulse {
    0% {
        transform: scale(1);
        opacity: 1
    }

    to {
        transform: scale(4);
        opacity: 0
    }
}

@keyframes blinker-flash {
    0%,to {
        transform: scale(.8);
        opacity: 0
    }

    50% {
        transform: scale(1.1);
        opacity: .9
    }
}

#drag-handle,#sidebar {
    width: 100%;
    user-select: none
}

#drag-handle,#sidebar,.route-header {
    display: flex
}

.bus-item:hover,h1 {
    color: var(--maroon)
}

.bus-pointer,.top-badge {
    left: 50%;
    transform: translateX(-50%)
}

.eta-label,.stat-label,.tag.approaching {
    text-transform: uppercase
}

#alert-box,#sidebar,.flow-gauge-wrap,.pace-gauge,.route-group,body {
    overflow: hidden
}

.bus-grid,.bus-stat-item,.eta-box,.pop-alert-banner,.r-badge {
    text-align: center
}

#alert-box,#drag-handle,.bus-item,.route-header,.stop-marker,.stop-node,.stop-popup-btn,button.arr-btn {
    cursor: pointer
}

#locate-btn,.route-header {
    transition: background .2s
}

/* --- Clean Control Alignment --- */
#locate-control-wrapper {
    margin-bottom: 2px !important; /* Forces uniform spacing when stacked right above zoom bars */
}

/* Style the button anchor link to match native leaflet-bar anchors identically */
#locate-control-btn {
    background-color: #fff;
    width: 30px;
    height: 30px;
    line-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #681B34;
    transition: background-color 0.2s, color 0.2s;
    text-decoration: none;
}

#locate-control-btn:hover {
    background-color: #f4f4f4;
    color: #000;
}

/* --- Locate Icon Spin Animation --- */
@keyframes control-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* When the locating class is appended by JS, spin the SVG inside the anchor */
#locate-control-btn.locating #locate-icon {
    animation: control-spin 1s linear infinite;
    color: #e57722; /* Optional visual accent change during calculation */
}

/* --- User Location Heading/Direction Indicator --- */
.user-location-container {
    position: relative;
    overflow: visible !important;
}

/* The directional heading pointer */
.user-heading-pointer {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    /* Create a sharp, clean triangle pointing straight up */
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid #007aff; 
    
    /* Center the triangle relative to the icon and push it upward out of the dot's core */
    margin-left: -6px;
    margin-top: -24px; 
    
    /* Smooth transitions for heading updates */
    transition: transform 0.2s ease-out;
    transform-origin: 6px 24px; /* Rotates perfectly around the true center coordinate */
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25));
    display: none; /* Hidden by default until a valid heading vector arrives */
}

/* Adjust heading triangle color for dark mode mapping continuity */
body.dark-mode .user-heading-pointer {
    border-bottom-color: #e5751f;
}

/* --- Pristine Dark Mode Mapping Integrations --- */
body.dark-mode #locate-control-btn {
    background-color: #27272a !important;
    color: #d86827 !important;
    border-color: #3f3f46 !important;
}

body.dark-mode #locate-control-btn:hover {
    background-color: #3f3f46 !important;
    color: #fff !important;
}

#alert-box,#alert-inner,.r-count,.top-badge {
    white-space: nowrap
}

.blinker-glow,.bus-ghost,.route-arrow-icon,.top-badge {
    pointer-events: none
}

body,html {
    overscroll-behavior: none;
    height: 100%;
    -webkit-tap-highlight-color: transparent
}

:root {
    --maroon: #630031;
    --orange: #cf4420;
    --bg: #f4f4f9;
    --slate: #2c3e50;
    --red-alert: #d32f2f
}

body {
    margin: 0;
    font-family: Inter,sans-serif;
    background: var(--bg)
}

#sidebar {
    top: 15px;
    background: #fff;
    border-radius: 24px 24px 0 0;
    transition: transform .4s cubic-bezier(.25,1,.5,1);
    max-height: 90vh;
    position: fixed;
    bottom: 0;
    left: 0;
    box-shadow: 0 -8px 30px rgba(0,0,0,.15);
    z-index: 2000;
    flex-direction: column;
    height: 90dvh;
    max-height: 90dvh;
    
    /* --- ✅ FIXED COLLAPSED PROFILE HEIGHT Bounds --- */
    --collapsed-height: 160px; /* Establishes a global structural math anchor */
    transform: translateY(calc(100% - var(--collapsed-height))); 
    padding-bottom: 100px;
    margin-bottom: -100px;
}

#alert-box,.bus-body-base,.bus-item {
    position: relative
}

#sidebar.dragging {
    transition: none!important
}

#drag-handle {
    touch-action: none;
    height: 30px;
    justify-content: center;
    align-items: center
}

#sidebar.open {
    transform: translateY(0)
}

.handle-bar {
    width: 40px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 10px
}

@media (min-width:768px) {
    #sidebar {
        height: auto;
        border-radius: 12px;
        padding-bottom: 0;
        margin-bottom: 0;
        box-shadow: 0 10px 30px rgba(0,0,0,.2);
        top: 15px;
        left: 15px;
        bottom: auto;
        width: 350px;
        transform: none!important;
        max-height: 90vh
    }

    #drag-handle {
        display: none
    }
}

#map {
    height: 100vh;
    width: 100%;
    z-index: 1
}

#alert-box {
    /* Gradient sweeping from VT Maroon to BT Orange */
    background: linear-gradient(135deg, #861F41 0%, #E87722 100%);
    color: #fff;
    font-size: .85rem;
    padding: 10px 0;
    display: none;
    border-bottom: 1px solid rgba(0,0,0,.1);
    font-weight: 700;
}

#alert-inner {
    display: inline-block;
    padding-left: 100%;
    animation: 40s linear infinite marquee-scroll
}

#alert-box:hover #alert-inner {
    animation-play-state: paused
}

.header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee
}

h1 {
    margin: 0;
    font-size: 1.2rem
}

.status-txt {
    font-size: .8rem;
    color: #666;
    margin-top: 4px
}

#list-container {
    overflow-y: auto;
    padding: 10px;
    flex-grow: 1
}

.route-group {
    margin-bottom: 8px;
    border-radius: 8px;
    border: 1px solid #ddd
}

.route-header {
    padding: 12px;
    align-items: center;
    border-left: 4px solid transparent
}

.route-header:hover {
    background: #f0f0f0
}

.r-badge {
    color: #fff;
    padding: 2px 0;
    border-radius: 4px;
    font-weight: 800;
    font-size: .75rem;
    width: 42px;
    margin-right: 12px;
    box-shadow: inset 0-2px 0 rgba(0,0,0,.2)
}

.bus-body-base,.r-count,.r-title,.tc-badge {
    font-weight: 700
}

.r-title {
    color: #333;
    flex-grow: 1
}

.r-count {
    font-size: .7rem;
    color: #888;
    background: #eee;
    padding: 2px 10px;
    border-radius: 12px
}

.bus-list {
    display: none;
    border-top: 1px solid #eee
}

.bus-ptrn,.route-group.open .bus-list {
    display: block
}

.bus-item {
    padding: 10px 15px;
    border-bottom: 1px solid #f5f5f5;
    font-size: .9rem;
    color: #555
}

.bus-item:hover {
    background: #fffbf0
}

.bus-item.selected {
    background: #ffebeb;
    border-left: 4px solid var(--maroon);
    font-weight: 700
}

.bus-ptrn {
    font-size: .8rem;
    color: #999;
    margin-top: 2px
}

.route-group.open .route-header {
    background: #fdfdfd;
    border-left: 4px solid var(--maroon)
}

.tc-badge {
    font-size: .7em;
    background: #2c3e50;
    color: #fff;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 5px
}

.electric-badge {
    z-index: 9999!important;
    color: #333
}

.top-badge {
    color: #fff;
    padding: 2px 5px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.2)
}

.bdg-full {
    background: var(--red-alert);
    animation: 1s infinite pulse
}

.bdg-busy {
    background: #f57c00
}

.bdg-hold {
    background: #2c3e50;
    border: 1px solid #fff
}

.bus-body-base {
    border: 2px solid #fff;
    color: #fff;
    font-size: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,.3)
}

.bus-pointer {
    position: absolute;
    top: -8px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 8px solid var(--maroon)
}

.std-bus {
    width: 24px;
    height: 36px;
    border-radius: 4px
}

.acc-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px
}

.bus-grid,.bus-popup-grid {
    grid-template-columns: repeat(3,1fr);
    gap: 10px
}

.acc-front {
    width: 24px;
    height: 28px;
    border-radius: 4px 4px 0 0;
    border-bottom: none
}

.acc-joint {
    width: 18px;
    height: 6px;
    background: #555;
    border-radius: 2px;
    border: 1px solid #333
}

.acc-rear {
    width: 24px;
    height: 20px;
    border-radius: 0 0 4px 4px;
    background: var(--maroon);
    border: 2px solid #fff
}

.stop-center,.stop-marker {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.3)
}

.stop-marker {
    border: 2px solid #555;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: .2s
}

.stop-marker:hover {
    background: var(--maroon);
    border-color: #fff;
    transform: scale(2.4)
}

.stop-icon {
    position: relative;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center
}

.stop-center {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #555
}

.stop-badges {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10
}

.stop-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
    margin-top: -5px;
    position: relative;
    transition: transform .2s
}

.stop-badge:first-child {
    z-index: 5;
    margin-top: 0
}

.stop-badge:nth-child(2) {
    z-index: 4
}

.stop-badge:nth-child(3) {
    z-index: 3
}

.stop-badge:nth-child(4) {
    z-index: 2
}

.stop-badge:nth-child(5) {
    z-index: 1
}

.pop-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: .9rem;
    align-items: center
}

.stat-chip {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: .85rem
}

.tag {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .75rem;
    font-weight: 700
}

.tag.early {
    background: #e8f5e9;
    color: #2e7d32
}

.tag.late {
    background: #ffebee;
    color: #c62828
}

.tag.ontime {
    background: #e3f2fd;
    color: #1565c0
}

.tag.hold {
    background: #333;
    color: #fff
}

.tag.full {
    background: var(--red-alert);
    color: #fff
}

button.arr-btn {
    width: 100%;
    margin-top: 5px;
    padding: 8px;
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-weight: 600
}

button.arr-btn:hover {
    background: #ddd
}

.bus-popup-grid {
    display: grid;
    margin-top: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #edf2f7
}

.bus-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center
}

.stat-label {
    letter-spacing: .05em
}

.stat-value {
    margin-top: 2px
}

.flow-gauge-wrap {
    width: 40px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    margin-top: 4px
}

.flow-gauge-fill {
    height: 100%;
    transition: width .5s,background .5s
}

.icon-container {
    width: 24px;
    height: 24px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center
}

.movement-dot {
    width: 8px;
    height: 8px;
    background: #64748b;
    border-radius: 50%
}

.is-stopped .movement-dot {
    background: #ef4444;
    animation: 1.5s infinite pulse-red
}

.is-moving .movement-dot {
    width: 14px;
    height: 3px;
    border-radius: 2px;
    background: #22c55e;
    animation: 1s linear infinite slide-green
}

.lr-badge,.tag.lastrun {
    background: #000;
    color: #f55
}

.lr-badge {
    font-size: .7em;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 5px;
    font-weight: 800;
    letter-spacing: .5px
}

.lr-badge,.tag.lastrun {
    border: 1px solid red
}

.lr-border {
    border: 3px solid #cf4420!important;
    box-shadow: 0 0 8px #8b0000;
    z-index: 100!important
}

.leaflet-interactive {
    transition: stroke-width .2s
}

.stop-node:hover {
    transform: scale(2.5);
    border-color: var(--maroon);
    background-color: #fff;
    z-index: 1000!important
}

.stop-popup-btn {
    width: 100%;
    padding: 8px;
    background: var(--slate);
    color: #fff;
    border: 0;
    border-radius: 4px;
    font-weight: 700;
    margin-top: 5px
}

.stop-popup-btn:hover {
    background: #34495e
}

.eta-box {
    background: #fff;
    border: 1px solid #e0e6ed;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,.1);
    transition: background .3s
}

.eta-label {
    font-size: 10px;
    color: #64748b;
    letter-spacing: 1.2px;
    font-weight: 700;
    margin-bottom: 4px
}

.route-arrow-icon {
    background: 0 0!important;
    border: 0!important
}

.eta-timer {
    font-size: 32px;
    font-weight: 800;
    color: #1e293b;
    font-family: Inter,monospace;
    line-height: 1;
    margin: 8px 0
}

.eta-sub {
    font-size: 12px;
    color: #475569;
    font-weight: 500;
    line-height: 1.4
}

.pop-h,.tag.approaching,.tc-popup-label {
    color: #fff;
    font-weight: 800
}

.tag.approaching {
    background-color: #630031;
    padding: 6px 12px;
    border-radius: 4px;
    letter-spacing: 1px;
    animation: 1s infinite pulse
}

.tc-popup-label {
    display: inline-block;
    background: #2c3e50;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    margin-bottom: 8px;
    letter-spacing: .5px
}

.stop-node {
    background-color: #fff;
    border: 2px solid #2c3e50;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,.3);
    width: 14px!important;
    height: 14px!important;
    margin-left: -7px!important;
    margin-top: -7px!important;
    transition: transform .2s cubic-bezier(.175,.885,.32,1.275),border-color .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    line-height: 1
}

.stop-node.timecheck-node {
    border: 2px solid black;
    background-color: #2c3e50;
    transform: scale(1.3);
    z-index: 500;
    color: #fff
}

.bus-popup .leaflet-popup-content-wrapper {
    border-radius: 16px;
    padding: 0;
    overflow: hidden
}

.bus-popup .leaflet-popup-content {
    margin: 0;
    width: 300px!important
}

.bus-popup .leaflet-popup-close-button {
    color: #fff!important;
    font-size: 22px!important;
    padding: 10px 12px 0 0!important;
    font-weight: 700
}

.leaflet-popup:not(.bus-popup) .leaflet-popup-close-button {
    color: #444!important;
    font-size: 18px!important;
    padding: 8px 8px 0 0!important
}

.pop-h {
    background: var(--maroon);
    padding: 14px 18px;
    border-radius: 16px 16px 0 0;
    font-size: 16px
}

.pop-b {
    min-width: 220px;
    padding: 18px
}

.bus-grid {
    display: grid;
    margin-bottom: 16px
}

.bus-stat {
    display: flex;
    flex-direction: column;
    align-items: center
}

.stat-label {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 700;
    margin-top: 6px
}

.stat-value {
    font-size: 14px;
    font-weight: 800;
    color: #1e293b
}

#service-level-badge,.pop-alert-banner,.toggle-wrap {
    font-size: 10px;
    text-transform: uppercase
}

.pace-gauge {
    width: 80%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    margin-top: 5px
}

.pace-fill {
    height: 100%;
    transition: width .8s
}

.pop-alert-banner {
    font-weight: 900;
    padding: 6px;
    border-radius: 8px;
    margin-bottom: 12px;
    letter-spacing: 1px
}

.banner-last-run {
    background: #000;
    color: #f55;
    border: 1px solid red;
    animation: 2s infinite pulse-red
}

.banner-transition {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9
}

#service-level-badge {
    background: #fff;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 11px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px
}

.sl-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%
}

.sl-full {
    background: #22c55e
}

.sl-reduced {
    background: #f59e0b
}

.sl-holiday {
    background: #ef4444
}

.bus-ghost {
    opacity: .45!important;
    filter: grayscale(100%) brightness(1.2)
}

.ghost-tag {
    background: #64748b!important;
    color: #fff!important
}

.user-location-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px
}

.user-location-dot {
    width: 12px;
    height: 12px;
    background-color: #007aff;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0,0,0,.3);
    z-index: 2
}

.user-location-pulse {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: rgba(0,122,255,.4);
    border-radius: 50%;
    z-index: 1;
    animation: 2s ease-out infinite location-pulse
}

.leaflet-control-locate {
    width: 33px;
    height: 33px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 5px rgba(0,0,0,.4);
    margin-bottom: 3px!important
}

body.dark-mode .leaflet-control-locate {
    background: #27272a;
    border-color: #3f3f46;
    color: #d6d6d6
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center
}

#locate-btn,.toggle-wrap {
    align-items: center;
    cursor: pointer;
    display: flex
}

.toggle-wrap {
    color: #94a3b8;
    font-weight: 800;
    gap: 6px;
    user-select: none
}

.electric-badge,.top-badge {
    position: absolute;
    font-size: 6px
}

.toggle-wrap input[type=checkbox] {
    appearance: none;
    background-color: #f1f5f9;
    margin: 0;
    font: inherit;
    color: var(--maroon);
    width: 14px;
    height: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    display: grid;
    place-content: center;
    cursor: pointer;
    transition: .2s
}

.toggle-wrap input[type=checkbox]::before {
    content: "";
    width: 8px;
    height: 8px;
    transform: scale(0);
    transition: transform 120ms ease-in-out;
    box-shadow: inset 1em 1em var(--maroon);
    clip-path: polygon(14% 44%,0 65%,50% 100%,100% 16%,80%0,43% 62%)
}

.toggle-wrap input[type=checkbox]:checked {
    background-color: #fff1f2;
    border-color: var(--maroon)
}

.toggle-wrap input[type=checkbox]:checked::before {
    transform: scale(1)
}

#locate-btn {
    position: absolute;
    bottom: 95px;
    right: 10px;
    z-index: 1000;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 34px;
    height: 34px;
    justify-content: center;
    font-size: 18px;
    color: #681B34;
}



#locate-btn:hover {
    background: #f4f4f4
}

body.dark-mode {
    background-color: #1e1e1e!important;
    color: #f4f4f5!important
}

body.dark-mode #service-level-badge {
    background: #27272a!important
}

body.dark-mode #sidebar,body.dark-mode .header {
    background: #18181b!important
}

body.dark-mode .r-count {
    background: #3f3f46!important
}

/* Add to static/style.css */
.no-buses-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    padding: 20px;
    text-align: center;
    color: #64748b;
    font-family: 'Inter', sans-serif;
}

.no-buses-ui svg {
    margin-bottom: 16px;
    opacity: 0.6;
}

.no-buses-ui h3 {
    margin: 0;
    color: #1e293b;
    font-weight: 800;
}

.no-buses-ui p {
    font-size: 13px;
    margin-top: 8px;
    max-width: 250px;
}

.signal {
  margin-left: 12px !important;
  margin-right: -8px !important;
}

body.dark-mode #sidebar {
    border-top: 1px solid #3d3d3d!important
}

body.dark-mode .header h1 {
    color: white !important;
}

body.dark-mode .route-header {
    background-color: #27272a!important;
    border-color: #3d3d3d!important;
    color: #fff!important
}

body.dark-mode .bus-item:hover,body.dark-mode .route-header:hover {
    background-color: #3f3f46!important
}

body.dark-mode .bus-item.selected {
    background-color: #450a0a!important;
    border-left: 4px solid #d6d6d6!important
}

body.dark-mode .leaflet-popup-content-wrapper,body.dark-mode .leaflet-popup-tip,body.dark-mode .pop-b,body.dark-mode .pop-b div {
    background-color: #27272a!important;
    color: #f4f4f5!important
}

body.dark-mode .stat-box {
    background: #18181b!important;
    border: 1px solid #3d3d3d!important
}

body.dark-mode .stat-value {
    color: #afafaf!important
}

body.dark-mode .bus-item {
    color: #e8e8e8!important
}

body.dark-mode .bus-ptrn,body.dark-mode .r-count,body.dark-mode .stat-label,body.dark-mode .status-txt {
    color: #a1a1aa!important
}

.theme-link {
    cursor: pointer;
    color: #e5751f!important;
    font-weight: 800;
    text-decoration: underline;
    margin-left: 5px
}

body.dark-mode .bus-item:not(.selected),body.dark-mode .leaflet-popup-content-wrapper,body.dark-mode .pop-b,body.dark-mode .route-group {
    background-color: #27272a!important;
    color: #fff!important;
    border-color: #3f3f46!important
}

body.dark-mode .r-title {
    color: #fff!important;
    font-weight: 800!important;
    text-shadow: 0 1px 2px rgba(0,0,0,.5)
}

body.dark-mode .stopName {
    color: #fff!important
}

body.dark-mode .blue-text,body.dark-mode .stop-link,body.dark-mode a {
    color: #fff!important;
    font-weight: 600
}

#theme-button {
    position: fixed;
    bottom: 25px;
    right: 20px;
    z-index: 9999;
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid #3f3f46;
    background: #18181b;
    color: #e5751f;
    font-weight: 800;
    font-size: 11px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    gap: 8px
}

body.dark-mode #theme-button {
    background: #27272a;
    border-color: #e5751f
}


body.dark-mode #locate-btn,body.dark-mode .leaflet-bar a {
    background-color: #27272a!important;
    color: #d6d6d6!important;
    border-bottom: 1px solid #3f3f46!important
}

.bus-rotate-wrap {
    transition: transform var(--glide-time, 2.2s) cubic-bezier(.33,1,.68,1)
}

.artic-trailer {
    transition: transform var(--glide-time, .4s) cubic-bezier(.33,1,.68,1)
}

.top-badge {
    top: 23px;
    z-index: 1000;
    font-weight: 900
}

.electric-badge {
    bottom: 28px;
    right: 35px;
    background: #fc0;
    border-radius: 50%;
    width: 10px;
    height: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #fff
}

.blinker-active {
    opacity: 1;
    filter: blur(4px);
    animation: .8s cubic-bezier(.4,0,.2,1) infinite blinker-flash
}

.headlight-cone {
    opacity: .4;
    filter: blur(6px)
}

.brake-cone {
    opacity: .6;
    filter: blur(5px);
    transition: 1.8s linear
}

.artic-bus-container,.bus-icon-container {
    overflow: visible!important
}

.bus-rotate-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100px;
    height: 100px;
    transform: translateZ(0);
    will-change: transform;
    transition: transform .8s linear
}

.blinker-glow {
    opacity: 0
}

.stop-icon {
    position: relative; /* Essential */
}

/* The semi-circle tab */
.side-indicator {
    position: absolute;
    top: 0;
    left: -6px; /* Hangs off the left side */
    width: 6px;
    height: 20px;
    background: #630031; /* Default Color */
    border-radius: 6px 0 0 6px; /* Semi-circle shape */
}

/* Add this class to flip it to the right */
.side-indicator.flip {
    left: 20px; /* Moves it to the right side */
    border-radius: 0 6px 6px 0;
}
.route-service-times {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    margin-top: 3px;
}

body.dark-mode .route-service-times {
    color: #94a3b8;
}

.leaflet-popup-content {
    color: #1e293b !important; /* Default dark charcoal text for clear reading in light mode */
}

body.dark-mode .leaflet-popup-content-wrapper,
body.dark-mode .leaflet-popup-tip {
    background-color: #27272a !important;
    color: #f4f4f5 !important;
}

/* Also ensure the header line matches to preserve visual hierarchy */
body.dark-mode .route-group.open .route-header {
    border-left: 4px solid #d86827 !important;
    background-color: #27272a !important;
}

.popup-toggle-btn {
    background: #681B34 !important; /* Light mode default (VT Maroon) */
}
body.dark-mode .popup-toggle-btn {
    background: #d86827 !important; /* Dark mode override (BT Orange) */
}

/* --- ✅ MOBILE RESPONSIVE CONTROL CORNER INTERCEPTION --- */
@media (max-width: 767px) {
    /* Target the native structural Leaflet container pane directly */
    .leaflet-bottom.leaflet-right {
        /* Move the control stack up by the height of the collapsed drawer + a clean 10px margin gap */
        bottom: calc(160px - 100px + 15px) !important; 
        transition: transform 0.4s cubic-bezier(.25, 1, .5, 1);
    }

    /* If the user drags or transitions the sidebar layout to open, 
       smoothly slide the controls out of the way so they don't block the list entries */
    #sidebar.open ~ #map .leaflet-bottom.leaflet-right,
    #sidebar.open + #map .leaflet-bottom.leaflet-right {
        transform: translateY(-50vh);
        opacity: 0;
        pointer-events: none; /* Disables ghost taps while hidden */
    }
}
