/* Route page layout and components */

:root {
    --navbar-height: 56px;
    --sidebar-width: 400px;
    --bg-dark: #212529;
    --panel-dark: #343a40;
    --panel-border: #495057;
    --panel-accent: #2b3035;
    --text-light: #f8f9fa;
    --scroll-track: #2b3035;
    --scroll-thumb: #495057;
    --scroll-thumb-hover: #6c757d;
}

/* Main container below fixed navbar */
#main-container {
    height: calc(100vh - var(--navbar-height));
    display: flex;
    flex-direction: row;
}

/* Sidebar with sticky header and scrollable list */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--panel-dark);
    border-right: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    padding: 0 15px;
}

/* Sticky header */
#sidebar-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--panel-dark);
    padding: 12px 0;
    border-bottom: 1px solid var(--panel-border);
}

/* Inline selects row for Route & Day (equal width, fit panel) */
#sidebar-header .select-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}
#sidebar-header .select-row .form-select {
    background-color: var(--panel-accent);
    color: var(--text-light);
    border-color: var(--panel-border);
    height: 38px;
    flex: 1 1 0;            /* make both selects equal width */
    min-width: 0;           /* allow them to shrink within the row */
}

/* Reorder switch */
#reorderSwitch:disabled + .form-check-label { opacity: 0.65; }

/* Scroll only the list area; avoid overlay scrollbar */
#sidebar-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 0 15px 0;
    scrollbar-gutter: stable;
}

/* Dark themed custom scrollbars */
/* WebKit */
#sidebar-list::-webkit-scrollbar { width: 10px; }
#sidebar-list::-webkit-scrollbar-track { background: var(--scroll-track); }
#sidebar-list::-webkit-scrollbar-thumb {
    background-color: var(--scroll-thumb);
    border-radius: 8px;
    border: 2px solid var(--scroll-track);
}
#sidebar-list::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }
/* Firefox */
#sidebar-list {
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

/* Map area */
#map-container {
    order: 0;
    flex-grow: 1;
    height: 100%;
    position: relative;
}
#map { height: 100%; width: 100%; }

/* Sortable list styling */
.sortable-list { list-style: none; margin: 0; padding: 0; }
.sortable-item {
    background-color: #495057;
    margin-bottom: 10px;
    padding: 10px;
    cursor: grab;
    border: 1px solid #6c757d;
    border-radius: 4px;
    display: flex;
    align-items: center;
    -webkit-user-select: none; -moz-user-select: none; user-select: none;
}

.custom-focus-btn {
    font-size: 0.75rem; /* Smaller text/icon size */
    padding: 2px 6px; /* Reduced padding for smaller size */
    margin-left: 10px; /* Optional spacing from content */
}

/* Hide drag handles by default; shown when reordering is enabled */
#sidebar .sortable-handle { display: none; }
.reordering-on #sidebar .sortable-handle { display: inline-flex; }
/* Touch-friendly handle */
.sortable-handle {
    margin-right: 10px;
    cursor: grab;
    touch-action: none; -ms-touch-action: none;
    font-size: 20px; line-height: 1; padding: 6px 8px;
}

/* Numbered marker */
.marker-num {
    background: #2b3035;
    color: #fff;
    border: 2px solid #0d6efd;
    border-radius: 14px;
    width: 28px;
    height: 28px;
    line-height: 24px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 0 4px rgba(0,0,0,.4);
}
.marker-num.shadow {
    filter: drop-shadow(0 2px 2px rgba(0,0,0,.4));
}

.zoom-display {
    box-shadow: 0 1px 3px rgba(0,0,0,.4);
    pointer-events: none; /* don’t block map interactions */
}

.focus-marker-link {
    color: #0d6efd;
    text-decoration: underline;
    cursor: pointer;
    text-align: right;
}
.focus-marker-link:hover {
    color: #4dabf7;
    text-decoration: none;
}

/* Mobile: map above sidebar; header stays sticky; list scrolls */
@media (max-width: 768px) {
    #main-container { flex-direction: column; }
    #map-container { order: 0; height: 50vh; }
    #sidebar {
        order: 1;
        width: 100%;
        height: 50vh;
        border-right: none;
        border-top: 1px solid var(--panel-border);
    }
    #sidebar-header { top: 0; }
    /* Keep selects on one line; allow horizontal scroll if extremely narrow */
    #sidebar-header .select-row { overflow-x: auto; }
    #printButton { display: none; }
}