﻿
body, html, input, select, div {
}

/* Ensure the body and html take full height and use Flexbox */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

#header-container {
    flex: none; /* Fixed height header */

    display: flex;
}

    #header-container > .header-title {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 100%;
        cursor: pointer;
    }

        #header-container > .header-title > div {
        }

            #header-container > .header-title > div > p {
                margin: 0;
                padding: 0;
            }

            #header-container > .header-title > div > .header-title-subtitle {
            }


/* Be a flex item (of body) and a flex container as well */
#main-body-container {
    flex: 1 1 auto; /* flex item properties */

    display: flex;
    flex-direction: row;
}

    /* Be a flex item (of main-body-container) and a flex container as well */
    #main-body-container > .left-panel {
        flex: 0 0 420px; /* flex item property */
        height: 100%;
    }

        /* This container must grow to fill the available space in the left panel */
        #main-body-container > .left-panel > .left-panel-container {
            display: flex;
            flex-direction: column;
            height: 100%;
        }

            #main-body-container > .left-panel > .left-panel-container > .tab-bar {
                flex: none;
            }

            #main-body-container > .left-panel > .left-panel-container > .tab-inner-content {
                flex: 1 0 auto;
                display: flex;
                flex-direction: column;
            }

                #main-body-container > .left-panel > .left-panel-container > .tab-inner-content > .search-controls {
                    flex: none; /* Fixed height for the search controls */
                }

                #main-body-container > .left-panel > .left-panel-container > .tab-inner-content > .scrollable-list {
                    flex: 1 0 100px;
                    overflow-y: auto;
                }



    /* Flexbox setup for the right panel */
    #main-body-container > .right-panel {
        position: relative;
        flex: 1 0 auto;
        display: flex;
        flex-direction: column;
    }

#map_function_bar {
    flex: none;
}

#map {
    flex: 1;
}

/* Other non-layout styles can be added here */

/* Style for the selected segment in route overview */
.ro-segment-btn.active {
    background-color: #0d6efd !important;
    color: #fff !important;
    border-color: #0d6efd !important;
}

.ro-segment-btn.active .text-muted {
    color: #e7f1ff !important;
}

/* Style for the pop-up card */
#tpu-popup {
    width: 200px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#stop-popup {
    width: 500px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Style for the arrow (pseudo-element) */
.ol-popup::after {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-top-color: white;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
}

/* Base styles for all status dots */
.route-status-dot {
    height: 10px;
    width: 10px;
    border-radius: 50%;
    margin-right: 12px; /* Adds spacing between the dot and the text */
    flex-shrink: 0; /* Prevents the dot from shrinking */
}

/* Style for the green restructured dot */
.restructured-dot {
    background-color: #7FBA00; /* Green */
}

/* Style for the gray hollow dot */
.unstructured-dot {
    background-color: transparent; /* Makes it hollow */
    border: 1px solid #6c757d; /* Gray border for the outline */
}

/* Style for selected route list item */
.active-route {
    background-color: lightblue;
}

/* Style for route status */
.route-status-btn {
    margin-right: 12px;
    flex-shrink: 0;
    font-size: 0.8rem !important;
    padding: 0.25rem 0.5rem;
    line-height: 1.2;
    white-space: normal;
    text-align: center !important;
    min-width: 90px;
    max-width: 90px; /* widened from 75px → 90px */
    border-radius: 6px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/*Time Special*/
.time-special-row .badge,
.time-special-row .time-special-tag {
    background-color: transparent !important;
    color: #6c757d !important; /* muted gray to match "Weekday" text */
    font-size: 0.7rem !important;
    font-weight: 500;
    padding: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.route-status-btn:focus {
    box-shadow: none;
}

/* ===== Basemap switcher ===== */
#map_function_bar {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

#basemap-toggle-btn {
    width: 42px;
    height: 42px;
    background: #0d6efd;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

    #basemap-toggle-btn:hover {
        background: #0b5ed7;
    }

#basemap-panel {
    position: absolute;
    top: 0;
    right: 52px;
    background: white;
    border-radius: 6px;
    padding: 12px 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    min-width: 220px;
}

.basemap-panel-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.basemap-options {
    display: flex;
    gap: 10px;
}

.basemap-option {
    cursor: pointer;
    text-align: center;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 3px;
    transition: border-color 0.15s ease;
    display: flex; 
    flex-direction: column; 
    align-items: center;
}

    .basemap-option:hover {
        border-color: #b6d4fe;
    }

    .basemap-option.selected {
        border-color: #0d6efd;
        border-width: 4px; /* ← thicker border for the active map */
        padding: 1px; /* keep total size constant */
    }

.basemap-thumb {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
}

.basemap-thumb-topo {
    background-image: url('/lib/basemap/topo.png');
    background-color: #e8f0d8;
}

.basemap-thumb-imagery {
    background-image: url('/lib/basemap/imagery.png');
    background-color: #2a5e3e;
}

.basemap-label {
    font-size: 0.8em;
    margin-top: 4px;
}

/* Contact Us link in header */
.contact-us-link {
    color: #0d6efd;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

    .contact-us-link:hover {
        color: #0b5ed7;
        text-decoration: underline;
    }

/* Contact modal styling */
#contactUsModal .modal-header {
    background-color: #f8f9fa;
    border-bottom: 2px solid #0d6efd;
}

#contactUsModal .modal-title {
    color: #0d6efd;
    font-weight: 600;
}

#contactUsModal .contact-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

#contactUsModal .contact-item:last-child {
    border-bottom: none;
}

#contactUsModal .contact-label {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 0.25rem;
}

#contactUsModal .contact-value {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
}

#contactUsModal .contact-value a {
    color: #0d6efd;
    text-decoration: none;
}

#contactUsModal .contact-value a:hover {
    text-decoration: underline;
}

/* MOBILE RESPONSIVE STYLES */

/* Hide the drag handle on desktop */
.bottom-sheet-handle {
    display: none;
}

@media (max-width: 768px) {

    /* ---------- Header: wrap + smaller font ---------- */
    #header-container {
        flex-wrap: wrap;
        padding: 0.5rem 0.75rem !important;
        gap: 0.25rem;
    }

        #header-container > .header-title {
            flex: 1 1 100%;
            min-width: 0;
        }

        #header-container .header-title p.h3 {
            font-size: 0.95rem;
            line-height: 1.2;
            margin: 0;
            white-space: normal;
            word-break: break-word;
        }

        #header-container .header-title p.small {
            font-size: 0.7rem;
            line-height: 1.1;
        }

        #header-container .header-right {
            flex: 0 0 auto;
            margin-left: auto;
            font-size: 0.8rem;
            gap: 0.5rem !important;
        }

    .contact-us-link {
        font-size: 0.8rem;
    }

    /* ---------- Main body: stack vertically ---------- */
    #main-body-container {
        flex-direction: column;
        position: relative;
        overflow: hidden;
    }

        /* Map (right panel) takes ALL remaining space */
        #main-body-container > .right-panel {
            order: 1;
            flex: 1 1 auto;
            height: 100%;
            width: 100%;
            min-height: 0;
        }

        /* ---------- Left panel becomes bottom sheet ---------- */
        #main-body-container > .left-panel {
            order: 2;
            position: fixed;
            left: 0;
            right: 0;
            bottom: 0;
            flex: none;
            width: 100%;
            height: 50vh; /* half height by default */
            background: white;
            z-index: 1000;
            box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.18);
            border-radius: 16px 16px 0 0;
            border: none !important;
            transition: transform 0.3s ease, height 0.3s ease;
            transform: translateY(calc(100% - 88px)); /* collapsed: show handle + tab bar only */
        }

            /* States driven by JS */
            #main-body-container > .left-panel.sheet-half {
                transform: translateY(0);
                height: 50vh;
            }

            #main-body-container > .left-panel.sheet-full {
                transform: translateY(0);
                height: 85vh;
            }

    /* ---------- Drag handle (visible on mobile only) ---------- */
    .bottom-sheet-handle {
        display: block;
        height: 24px;
        cursor: pointer;
        flex: none;
        touch-action: none;
    }

        .bottom-sheet-handle::before {
            content: '';
            display: block;
            width: 44px;
            height: 5px;
            background: #ccc;
            border-radius: 3px;
            margin: 9px auto 0;
        }

    /* ---------- Inside the sheet: allow proper scrolling ---------- */
    #main-body-container > .left-panel > .left-panel-container {
        height: 100%;
        overflow: hidden;
    }

    .tab-inner-content {
        min-height: 0;
    }

    .scrollable-list {
        -webkit-overflow-scrolling: touch;
    }

    /* Tabs shouldn't wrap oddly */
    .nav-tabs .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }

    /* ---------- Map popups: responsive width ---------- */
    #stop-popup {
        width: 88vw;
        max-width: 420px;
    }

    #tpu-popup {
        width: 180px;
    }

    /* ---------- Basemap button: reposition so it isn't hidden ---------- */
    #map_function_bar {
        top: 10px;
        right: 10px;
    }

    #basemap-panel {
        right: 52px;
        min-width: 180px;
    }

    .basemap-thumb {
        width: 64px;
        height: 64px;
    }

    /* ---------- Modals: better spacing on small screens ---------- */
    .modal-dialog {
        margin: 0.5rem;
    }

    /* Advanced filter inline radios wrap nicely */
    .form-check-inline {
        margin-right: 0.5rem;
    }

    /* Stop explorer: cards inside popup smaller */
    #stop-popup .row-cols-3 > .col {
        flex: 0 0 auto;
        width: 50%; /* 2 cols on phone instead of 3 */
    }
}

/* Extra small phones (≤ 400px) */
@media (max-width: 400px) {
    #header-container .header-title p.h3 {
        font-size: 0.85rem;
    }

    #header-container .header-title p.small {
        font-size: 0.65rem;
    }

    .contact-us-link {
        font-size: 0.75rem;
    }

    #main-body-container > .left-panel {
        transform: translateY(calc(100% - 84px));
    }
}