/**
 * Historical Routes Page Styles
 * 3-panel layout: Left (filters + list), Right (map), Bottom (detail panel)
 */

/* ========================================================================
   LAYOUT - 3-Panel Architecture
   ======================================================================== */

.routes-container {
    display: flex;
    height: calc(100vh - 76px);
    margin-top: 76px; /* Push below absolute-positioned navbar */
    overflow: hidden;
}

/* Dark background behind transparent navbar so white text is readable */
body.routes-page {
    background: #131325;
    font-family: "Inconsolata", "SF Mono", Consolas, monospace;
}

/* Hide footer on full-viewport routes page */
body.routes-page .cs-footer {
    display: none;
}

.routes-left-panel {
    width: 380px;
    min-width: 300px;
    max-width: 60%;
    display: flex;
    flex-direction: column;
    background: #1a1a2e;
    color: #fff;
    overflow-y: auto;
    border-right: 1px solid #333;
}

.routes-right-panel {
    flex: 1;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    position: relative;
}

.routes-bottom-panel {
    position: fixed;
    bottom: 0;
    left: 380px; /* offset by left panel width - JS updates this */
    right: 0;
    height: 300px;
    background: #fff;
    border-top: 2px solid #239BCD;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    z-index: 100;
    transition: height 0.3s ease, left 0.1s linear;
}

/* ========================================================================
   FILTER SECTION
   ======================================================================== */

/* Filter panel header (collapse toggle) */
.routes-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 16px;
    background: #1a1a2e;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.routes-filters-header h5 {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.routes-filters-toggle {
    background: none;
    border: none;
    color: #239BCD;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background 0.15s;
}

.routes-filters-toggle:hover {
    background: rgba(35, 155, 205, 0.2);
}

.routes-filters {
    background: #1a1a2e;
    padding: 0;
    flex-shrink: 0;
}

.routes-filter-section {
    border-bottom: 1px solid #333;
}

.routes-filter-header {
    padding: 8px 16px;
    background: #252540;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.2s;
}

.routes-filter-header:hover {
    background: #2d2d4a;
}

.routes-filter-header h5 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.routes-filter-header i {
    color: #239BCD;
    transition: transform 0.2s;
}

.routes-filter-header[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.routes-filter-body {
    padding: 10px 16px;
    background: #1a1a2e;
}

/* ========================================================================
   FILTER INPUTS
   ======================================================================== */

.routes-filter-group {
    margin-bottom: 10px;
}

.routes-filter-group:last-child {
    margin-bottom: 0;
}

.routes-filter-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.routes-filter-input {
    width: 100%;
    padding: 8px 12px;
    background: #252540;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-size: 0.9rem;
}

.routes-filter-input:focus {
    outline: none;
    border-color: #239BCD;
    box-shadow: 0 0 0 2px rgba(35, 155, 205, 0.2);
}

.routes-filter-input::placeholder {
    color: #666;
}

/* Tag input for airport codes */
.routes-tags-input {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
    background: #252540;
    border: 1px solid #444;
    border-radius: 4px;
    min-height: 38px;
    align-items: center;
}

.routes-tags-input:focus-within {
    border-color: #239BCD;
    box-shadow: 0 0 0 2px rgba(35, 155, 205, 0.2);
}

.routes-tag {
    background: #239BCD;
    color: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.routes-tag-remove {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.routes-tag-remove:hover {
    opacity: 1;
}

.routes-tags-input input {
    flex: 1;
    min-width: 60px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
}

.routes-tags-input input::placeholder {
    color: #666;
}

/* Mode pills (Airport/TRACON/ARTCC) */
.routes-mode-pills {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.routes-mode-pill {
    flex: 1;
    padding: 6px 8px;
    background: #252540;
    border: 1px solid #444;
    border-radius: 4px;
    color: #aaa;
    font-size: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.routes-mode-pill:hover {
    background: #2d2d4a;
    border-color: #666;
}

.routes-mode-pill.active {
    background: #239BCD;
    border-color: #239BCD;
    color: #fff;
}

/* Checkbox groups */
.routes-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.routes-checkbox-item {
    display: inline-flex;
    align-items: center;
    color: #ccc;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.routes-checkbox-item input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
}

/* Date range */
.routes-date-range {
    display: flex;
    gap: 8px;
}

/* Hour range */
.routes-hour-range {
    display: flex;
    gap: 8px;
}

/* Season pills */
.routes-season-pills {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.routes-season-pill {
    flex: 1;
    min-width: 70px;
    padding: 6px 12px;
    background: #252540;
    border: 1px solid #444;
    border-radius: 4px;
    color: #aaa;
    font-size: 0.8rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: capitalize;
}

.routes-season-pill:hover {
    background: #2d2d4a;
    border-color: #666;
}

.routes-season-pill.active {
    background: #239BCD;
    border-color: #239BCD;
    color: #fff;
}

/* Quick-select pills (alliance, DCC region, time presets) */
.routes-alliance-pills,
.routes-region-pills,
.routes-time-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    align-items: center;
}

.routes-pill-label {
    font-size: 0.7rem;
    color: #888;
    margin-right: 2px;
}

.routes-quick-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background: transparent;
    border: 1px solid #555;
    color: #bbb;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.routes-quick-pill:hover {
    background: #239BCD;
    border-color: #239BCD;
    color: #fff;
}

/* DCC Region origin/dest toggle */
.routes-region-target-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.routes-region-target {
    font-size: 0.7rem;
    color: #777;
    cursor: pointer;
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.routes-region-target:hover {
    color: #bbb;
}

.routes-region-target.active {
    color: #239BCD;
    border-color: #239BCD;
    font-weight: 600;
}

/* Select2 Dark Theme Overrides */
.select2-container .select2-selection--multiple {
    background-color: #252540 !important;
    border: 1px solid #444 !important;
    color: #fff !important;
}

.select2-container .select2-selection--multiple .select2-selection__choice {
    background-color: #239BCD !important;
    border: 1px solid #1a7fa8 !important;
    color: #fff !important;
    font-size: 0.75rem !important;
    margin: 2px !important;
}

.select2-container .select2-selection--multiple .select2-selection__choice__remove {
    color: rgba(255,255,255,0.8) !important;
    border-right-color: rgba(255,255,255,0.3) !important;
}

.select2-container .select2-selection--multiple .select2-selection__choice__display {
    color: #fff !important;
}

.select2-container .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #fff !important;
    background-color: rgba(255,255,255,0.15) !important;
}

.select2-container .select2-selection--multiple .select2-search__field {
    color: #fff !important;
    font-size: 0.85rem !important;
}

.select2-container .select2-selection--multiple .select2-search__field::placeholder {
    color: #666 !important;
    font-size: 0.85rem !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
    color: #666 !important;
    font-size: 0.85rem !important;
}

.select2-container.select2-container--focus .select2-selection--multiple {
    border-color: #239BCD !important;
    box-shadow: 0 0 0 2px rgba(35, 155, 205, 0.2) !important;
}

.select2-container .select2-dropdown {
    background-color: #252540 !important;
    border: 1px solid #444 !important;
}

.select2-container .select2-results__option {
    color: #fff !important;
    background-color: #252540 !important;
    font-size: 0.8rem !important;
    padding: 4px 8px !important;
}

.select2-container .select2-results__option--highlighted {
    background-color: #2d2d4a !important;
}

.select2-container .select2-results__option[aria-selected="true"] {
    background-color: #239BCD !important;
}

.select2-container .select2-search--dropdown .select2-search__field {
    background-color: #1a1a2e !important;
    border: 1px solid #444 !important;
    color: #fff !important;
}

/* ========================================================================
   FILTER CHIPS BAR
   ======================================================================== */

.routes-filter-chips {
    padding: 12px 16px;
    background: #252540;
    border-bottom: 1px solid #333;
    display: none; /* Hidden by default, shown via JS when chips added */
    flex-wrap: wrap;
    gap: 6px;
}

.routes-filter-chips.has-chips {
    display: flex;
}

.routes-filter-chip {
    background: #1a1a2e;
    border: 1px solid #444;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.routes-chip-label {
    white-space: nowrap;
}

.routes-chip-remove {
    cursor: pointer;
    color: #ff6b6b;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
    font-size: 0.7rem;
    margin-left: 2px;
}

.routes-chip-remove:hover {
    opacity: 1;
}

/* ========================================================================
   SEARCH BUTTON
   ======================================================================== */

/* Search row: both buttons same width, side by side */
.routes-search-row {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    flex-shrink: 0;
}

.routes-search-btn,
.routes-clear-btn {
    flex: 1;
    padding: 8px 0;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.routes-search-btn {
    background: #239BCD;
    color: #fff;
    border: 1px solid #239BCD;
}

.routes-search-btn:hover {
    background: #1d84b0;
    border-color: #1d84b0;
}

.routes-search-btn:disabled {
    background: #444;
    border-color: #444;
    cursor: not-allowed;
    opacity: 0.5;
}

.routes-clear-btn {
    background: transparent;
    color: #aaa;
    border: 1px solid #444;
}

.routes-clear-btn:hover {
    background: #252540;
    border-color: #666;
    color: #fff;
}

/* ========================================================================
   ROUTE LIST
   ======================================================================== */

.routes-list {
    flex: 1;
    min-height: 120px;
    overflow-y: auto;
    padding: 8px 16px;
}

.routes-summary {
    background: #252540;
    padding: 10px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    color: #aaa;
}

.routes-summary span {
    display: inline-block;
}

/* Map tier selector */
.routes-tier-wrap {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
    flex-shrink: 0;
}

.routes-tier-label {
    font-size: 0.7rem;
    color: #888;
    margin-right: 2px;
    white-space: nowrap;
}

.routes-tier-btn {
    background: rgba(35, 155, 205, 0.1);
    color: #6ab7d6;
    border: 1px solid rgba(35, 155, 205, 0.25);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 0.7rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.routes-tier-btn:hover {
    background: rgba(35, 155, 205, 0.25);
    color: #81d4fa;
}

.routes-tier-btn.active {
    background: rgba(35, 155, 205, 0.4);
    color: #fff;
    border-color: rgba(35, 155, 205, 0.6);
}

.routes-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.routes-sort-select {
    background: #252540;
    border: 1px solid #444;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.routes-item {
    background: #252540;
    border: 1px solid #3a3a55;
    border-left: 3px solid #3a3a55;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.routes-item.routes-item-offmap {
    opacity: 0.35;
}

.routes-item.freq-high {
    border-left-color: #ef5350;
}

.routes-item.freq-medium {
    border-left-color: #ffb300;
}

.routes-item.freq-low {
    border-left-color: #66bb6a;
}

.routes-item:hover {
    background: #2d2d4a;
    border-color: #239BCD;
    border-left-color: #239BCD;
    box-shadow: 0 2px 8px rgba(35, 155, 205, 0.15);
}

.routes-item.selected {
    background: #2a2a48;
    border-color: #239BCD;
    border-left-color: #239BCD;
    box-shadow: 0 0 0 2px rgba(35, 155, 205, 0.3);
}

.routes-item.multi-selected {
    border-left: 3px solid var(--multi-color, #239BCD);
}

.routes-multi-check {
    flex-shrink: 0;
    margin-right: 8px;
    accent-color: #239BCD;
    cursor: pointer;
    width: 16px;
    height: 16px;
    align-self: flex-start;
}

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

.routes-item-airports {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.3px;
}

.routes-item-airports .arrow {
    color: #239BCD;
    margin: 0 6px;
}

.routes-item-count {
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: rgba(35, 155, 205, 0.25);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.routes-item.freq-high .routes-item-count {
    background: rgba(239, 83, 80, 0.3);
    color: #ff8a80;
}

.routes-item-stats {
    font-size: 0.75rem;
    color: #aaa;
}

.routes-item-route {
    font-family: "Inconsolata", "SF Mono", 'Courier New', monospace;
    font-size: 0.8rem;
    color: #9ba8c0;
    line-height: 1.35;
    overflow-wrap: break-word;
    word-break: normal;
}

.routes-item-meta {
    display: flex;
    gap: 12px;
    font-size: 0.72rem;
    color: #888;
    flex-wrap: wrap;
}

.routes-item-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.routes-item-meta i {
    color: #5a7a9a;
    font-size: 0.65rem;
}

.routes-load-more {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: transparent;
    border: 1px solid #444;
    color: #aaa;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.routes-load-more:hover {
    background: #252540;
    border-color: #239BCD;
    color: #fff;
}

/* ========================================================================
   EMPTY STATES
   ======================================================================== */

.routes-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #888;
    text-align: center;
    padding: 20px;
}

.routes-empty-state i {
    font-size: 2.5rem;
    margin-bottom: 16px;
    opacity: 0.5;
    width: 64px;
    height: 64px;
    line-height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.routes-empty-state h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    color: #aaa;
}

.routes-empty-state p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.7;
    max-width: 280px;
}

/* ========================================================================
   MAP CONTAINER
   ======================================================================== */

/* Map container */
#routes_map {
    width: 100%;
    height: 100%;
}

.routes-right-panel .maplibregl-map {
    border-radius: 0;
}

/* Map legend overlay */
.routes-map-legend {
    position: absolute;
    bottom: 20px;
    left: 12px;
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.75rem;
    color: #ccc;
    z-index: 10;
}

.routes-map-legend-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #fff;
}

.routes-map-legend-item {
    display: flex;
    align-items: center;
    margin: 2px 0;
}

.routes-map-legend-swatch {
    width: 24px;
    height: 3px;
    margin-right: 6px;
    border-radius: 2px;
}

/* ========================================================================
   SCROLLBARS
   ======================================================================== */

.routes-left-panel::-webkit-scrollbar,
.routes-list::-webkit-scrollbar,
.routes-bottom-panel::-webkit-scrollbar {
    width: 8px;
}

.routes-left-panel::-webkit-scrollbar-track,
.routes-list::-webkit-scrollbar-track,
.routes-bottom-panel::-webkit-scrollbar-track {
    background: #1a1a2e;
}

.routes-left-panel::-webkit-scrollbar-thumb,
.routes-list::-webkit-scrollbar-thumb,
.routes-bottom-panel::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.routes-left-panel::-webkit-scrollbar-thumb:hover,
.routes-list::-webkit-scrollbar-thumb:hover,
.routes-bottom-panel::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* ========================================================================
   SPLITTER
   ======================================================================== */

.routes-splitter {
    width: 5px;
    cursor: col-resize;
    background: #333;
    flex-shrink: 0;
    z-index: 10;
    transition: background 0.15s;
}

.routes-splitter:hover,
.routes-resizing .routes-splitter {
    background: #239BCD;
}

body.routes-resizing {
    cursor: col-resize !important;
    user-select: none;
}

body.routes-resizing iframe,
body.routes-resizing .maplibregl-map {
    pointer-events: none;
}

/* ========================================================================
   DETAIL PANEL TABS
   ======================================================================== */

/* Detail Panel Tabs */
.routes-detail-tabs {
    display: flex;
    align-items: center;
    background: #1a1a2e;
    border-bottom: 1px solid #333;
    padding: 0 12px;
}

.routes-detail-tab {
    background: none;
    border: none;
    color: #888;
    padding: 10px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.routes-detail-tab:hover {
    color: #ccc;
}

.routes-detail-tab.active {
    color: #239BCD;
    border-bottom-color: #239BCD;
}

.routes-detail-close {
    background: none;
    border: none;
    color: #888;
    margin-left: auto;
    cursor: pointer;
    padding: 8px;
    font-size: 1rem;
}

.routes-detail-close:hover {
    color: #fff;
}

.routes-detail-content {
    overflow-y: auto;
    height: calc(100% - 40px);
    padding: 12px;
}

/* Variants Table */
.routes-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.routes-detail-table thead th {
    background: #1a1a2e;
    color: #aaa;
    padding: 8px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    z-index: 1;
}

.routes-detail-table tbody td {
    padding: 6px 8px;
    border-bottom: 1px solid #2a2a3e;
    color: #ccc;
}

.routes-detail-table tbody tr:hover {
    background: rgba(35, 155, 205, 0.1);
}

.routes-detail-route-cell {
    font-family: "Inconsolata", "SF Mono", Consolas, monospace;
    font-size: 0.8rem;
    overflow-wrap: break-word;
    word-break: normal;
}

/* Statistics Grid */
.routes-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    height: 100%;
}

.routes-stats-chart {
    min-height: 180px;
    background: #1e1e30;
    border-radius: 4px;
    border: 1px solid #333;
}

/* Empty state */
.routes-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-size: 0.9rem;
    gap: 12px;
}

.routes-detail-empty i {
    font-size: 2rem;
    opacity: 0.4;
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */

@media (max-width: 1024px) {
    .routes-left-panel {
        width: 320px;
        min-width: 260px;
    }

    .routes-right-panel {
        min-width: 300px;
    }
}

@media (max-width: 768px) {
    .routes-container {
        flex-direction: column;
    }

    .routes-left-panel {
        width: 100% !important;
        max-width: 100%;
        min-width: 100%;
        height: auto;
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid #333;
    }

    .routes-splitter {
        display: none;
    }

    .routes-right-panel {
        min-width: 100%;
        height: 55vh;
    }

    .routes-bottom-panel {
        left: 0 !important;
        height: 250px;
    }

    .routes-filter-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .routes-result-bar {
        flex-wrap: wrap;
        gap: 6px;
    }

    .routes-detail-tabs .routes-detail-tab {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .routes-detail-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================================================
   ROUTE INFO DIALOG (SweetAlert2)
   ======================================================================== */

.route-info-popup {
    background: #1e1e36 !important;
    border: 1px solid #3a3a55;
    border-radius: 10px !important;
    color: #e0e0e0;
    max-height: 90vh;
}

.route-info-popup .swal2-html-container {
    overflow-y: auto !important;
    max-height: calc(90vh - 120px);
}

.route-info-popup.rid-minimized {
    max-height: none !important;
    width: 400px !important;
    bottom: 20px !important;
    top: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    position: fixed !important;
}

.route-info-popup.rid-minimized .swal2-html-container,
.route-info-popup.rid-minimized .swal2-actions {
    display: none !important;
}

.route-info-title {
    color: #fff !important;
    font-family: "Inconsolata", "SF Mono", Consolas, monospace !important;
    font-size: 1.4rem !important;
    letter-spacing: 1px;
}

.route-info-html {
    text-align: left !important;
    padding: 0 8px !important;
}

.route-info-popup .swal2-close {
    color: #888 !important;
}

.route-info-popup .swal2-close:hover {
    color: #fff !important;
}

/* Minimize button */
.rid-minimize-btn {
    position: absolute;
    top: 8px;
    right: 44px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    z-index: 10;
    transition: color 0.2s;
}

.rid-minimize-btn:hover {
    color: #fff;
}

/* Sortable column headers */
.rid-table th.rid-sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 16px;
}

.rid-table th.rid-sortable:hover {
    color: #239BCD;
}

.rid-table th.rid-sortable::after {
    content: '\f0dc';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.6rem;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
}

.rid-table th.rid-sort-asc::after {
    content: '\f0de';
    opacity: 1;
    color: #239BCD;
}

.rid-table th.rid-sort-desc::after {
    content: '\f0dd';
    opacity: 1;
    color: #239BCD;
}

/* Selectable table rows */
.rid-table tbody tr.rid-row-selected {
    background: rgba(35, 155, 205, 0.2) !important;
}

.rid-table tbody tr {
    cursor: pointer;
}

.route-info-dialog {
    font-size: 0.9rem;
}

.rid-route-string {
    font-family: "Inconsolata", "SF Mono", Consolas, monospace;
    font-size: 0.82rem;
    color: #9ba8c0;
    background: #15152a;
    border: 1px solid #2a2a45;
    border-radius: 6px;
    padding: 10px 12px;
    line-height: 1.4;
    overflow-wrap: break-word;
    word-break: normal;
    margin-bottom: 16px;
}

.rid-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.rid-stat {
    flex: 1 1 auto;
    min-width: 80px;
    background: #252545;
    border: 1px solid #3a3a55;
    border-radius: 6px;
    padding: 8px 12px;
    text-align: center;
}

.rid-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    font-family: "Inconsolata", "SF Mono", Consolas, monospace;
}

.rid-stat-label {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.rid-dates {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 14px;
    padding: 0 4px;
}

.rid-dates i {
    color: #5a7a9a;
    margin-right: 4px;
}

.rid-section {
    margin-bottom: 14px;
}

.rid-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #2a2a45;
}

.rid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    max-height: 300px;
    display: block;
    overflow-y: auto;
}

.rid-table thead,
.rid-table tbody,
.rid-table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.rid-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.rid-table th {
    background: #252545;
    color: #aaa;
    font-weight: 600;
    padding: 5px 8px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.rid-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #1a1a30;
    color: #ccc;
}

.rid-table tbody tr:hover {
    background: #2a2a48;
}

.rid-route-cell {
    font-family: "Inconsolata", "SF Mono", Consolas, monospace;
    font-size: 0.75rem;
    color: #9ba8c0;
    overflow-wrap: break-word;
    word-break: normal;
}

.rid-col-num {
    width: 60px;
    text-align: right !important;
}

.rid-col-date {
    width: 90px;
    text-align: right !important;
}

/* Bar chart rows */
.rid-bar-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rid-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rid-bar-label {
    width: 110px;
    flex-shrink: 0;
    font-size: 0.78rem;
    color: #ccc;
    font-family: "Inconsolata", "SF Mono", Consolas, monospace;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rid-bar-track {
    flex: 1;
    height: 14px;
    background: #1a1a30;
    border-radius: 3px;
    overflow: hidden;
}

.rid-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.rid-bar-cyan         { background: #239BCD; }
.rid-bar-teal         { background: #4ECDC4; }
.rid-bar-purple       { background: #7B68EE; }
.rid-bar-orange       { background: #FF8C42; }
.rid-bar-green        { background: #4CAF50; }
.rid-bar-orange-light { background: #FFAB76; }
.rid-bar-green-light  { background: #81C784; }
.rid-bar-yellow       { background: #FFB300; }
.rid-bar-yellow-light { background: #FFD54F; }
.rid-bar-slate        { background: #78909C; }

/* Callsign progressive disclosure */
.rid-cs-expandable { cursor: pointer; transition: background 0.15s; }
.rid-cs-expandable:hover { background: rgba(255, 179, 0, 0.1); }
.rid-cs-chevron { display: inline-block; width: 14px; font-size: 0.65rem; color: #888; transition: transform 0.15s; }
.rid-cs-expandable.rid-cs-open .rid-cs-chevron { transform: rotate(90deg); }
.rid-cs-detail { padding-left: 20px; border-left: 2px solid rgba(255, 179, 0, 0.3); margin-left: 8px; }
.rid-cs-sub .rid-bar-label { width: 90px; font-size: 0.72rem; color: #aaa; }
.rid-cs-sub .rid-bar-track { height: 6px; }
.rid-cs-sub .rid-bar-value { font-size: 0.68rem; }

/* Filter match highlight in info dialog */
.rid-bar-row.rid-filter-match {
    background: rgba(255, 215, 0, 0.15);
    border-left: 3px solid #ffd700;
    padding-left: 5px;
    border-radius: 2px;
}

.rid-bar-value {
    width: 40px;
    flex-shrink: 0;
    text-align: right;
    font-size: 0.75rem;
    color: #aaa;
    font-family: "Inconsolata", "SF Mono", Consolas, monospace;
}

/* Variant selection actions */
.rid-variant-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    margin-bottom: 4px;
}

.rid-filter-selected-btn {
    background: #239BCD;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
}

.rid-filter-selected-btn:hover {
    background: #1d84b0;
}

.rid-clear-selected-btn {
    background: transparent;
    color: #aaa;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
}

.rid-clear-selected-btn:hover {
    color: #fff;
    border-color: #666;
}

.rid-selected-count {
    font-size: 0.75rem;
    color: #888;
    font-family: "Inconsolata", "SF Mono", Consolas, monospace;
}

.rid-loading {
    text-align: center;
    color: #888;
    padding: 16px 0;
    font-size: 0.85rem;
}

.rid-empty {
    text-align: center;
    color: #666;
    padding: 12px 0;
    font-size: 0.85rem;
}

/* ========================================================================
   MAP LAYER CONTROLS & ROUTE COUNT
   ======================================================================== */

.rmap-layer-panel {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.rmap-layer-toggle {
    background: rgba(20, 20, 40, 0.92);
    border: 1px solid #3a3a55;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.78rem;
    color: #ccc;
    cursor: pointer;
    user-select: none;
    font-family: "Inconsolata", "SF Mono", Consolas, monospace;
    letter-spacing: 0.3px;
    transition: background 0.15s;
}

.rmap-layer-toggle:hover,
.rmap-layer-toggle.expanded {
    background: rgba(30, 30, 55, 0.95);
    color: #fff;
}

.rmap-layer-toggle i {
    margin-right: 4px;
    color: #239BCD;
}

.rmap-layer-list {
    background: rgba(20, 20, 40, 0.95);
    border: 1px solid #3a3a55;
    border-radius: 6px;
    padding: 4px 0;
    margin-top: 4px;
    max-height: 320px;
    overflow-y: auto;
}

.rmap-layer-separator {
    font-size: 0.65rem;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 6px 10px 2px;
    border-top: 1px solid #2a2a45;
    margin-top: 2px;
}

.rmap-layer-separator:first-child {
    border-top: none;
    margin-top: 0;
}

.rmap-layer-row {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 3px 10px;
    font-size: 0.78rem;
    color: #ccc;
    user-select: none;
}

.rmap-layer-row:hover {
    color: #fff;
    background: rgba(35, 155, 205, 0.1);
}

.rmap-layer-check {
    width: 14px;
    height: 14px;
    accent-color: #239BCD;
    cursor: pointer;
}

.rmap-layer-label {
    font-family: "Inconsolata", "SF Mono", Consolas, monospace;
    letter-spacing: 0.3px;
}

.rmap-route-count {
    position: absolute;
    bottom: 28px;
    left: 10px;
    z-index: 10;
    background: rgba(20, 20, 40, 0.9);
    border: 1px solid #3a3a55;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    color: #aaa;
    font-family: "Inconsolata", "SF Mono", Consolas, monospace;
    backdrop-filter: blur(4px);
}

@media (max-width: 480px) {
    .routes-left-panel {
        max-height: 40vh;
    }

    .routes-filter-header h5 {
        font-size: 0.85rem;
    }

    .routes-mode-pills {
        gap: 4px;
    }

    .routes-mode-pill {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .routes-search-btn {
        font-size: 0.85rem;
        padding: 8px;
    }

    .routes-route-card {
        padding: 8px;
    }
}

/* ======================================================================
   AUTO-GROUPING
   ====================================================================== */

.routes-group {
    margin-bottom: 2px;
}

.routes-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #1e1e38;
    border-left: 3px solid #4a4a6a;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
    gap: 12px;
    overflow: hidden;
}

.routes-group-header:hover {
    background: #2d2d4a;
}

.routes-group-header.freq-high {
    border-left-color: #ef5350;
}

.routes-group-header.freq-medium {
    border-left-color: #ffb300;
}

.routes-group-header.freq-low {
    border-left-color: #66bb6a;
}

.routes-group-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.routes-group-chevron {
    font-size: 0.7rem;
    color: #888;
    transition: transform 0.15s;
    width: 12px;
    text-align: center;
}

.routes-group-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #e0e0e0;
    white-space: nowrap;
}

.routes-group-label .arrow {
    color: #888;
    margin: 0 4px;
}

.routes-group-header-right {
    display: flex;
    align-items: center;
    gap: 6px 12px;
    flex-shrink: 1;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}

.routes-group-stat {
    font-size: 0.8rem;
    color: #aaa;
    white-space: nowrap;
}

.routes-group-stat-date {
    font-size: 0.7rem;
    color: #777;
}

.routes-group-pct {
    font-size: 0.75rem;
    color: #888;
    background: rgba(255,255,255,0.06);
    padding: 2px 6px;
    border-radius: 3px;
    min-width: 45px;
    text-align: center;
}

.routes-group-routes {
    padding-left: 16px;
    border-left: 1px solid rgba(255,255,255,0.06);
    margin-left: 12px;
}

.routes-group-routes .routes-item {
    border-left-width: 2px;
}

/* ======================================================================
   MULTI-SELECT TOOLBAR
   ====================================================================== */

.routes-multi-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #1a1a36;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    margin: 4px 0;
}

.routes-multi-toolbar .routes-multi-btn {
    padding: 4px 12px;
    font-size: 0.8rem;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.routes-multi-toolbar .routes-multi-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.routes-multi-toolbar .routes-multi-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.routes-multi-toolbar .routes-multi-btn.btn-compare {
    border-color: #4ECDC4;
    color: #4ECDC4;
}

.routes-multi-toolbar .routes-multi-btn.btn-compare:hover:not(:disabled) {
    background: rgba(78, 205, 196, 0.15);
}

.routes-multi-toolbar .routes-multi-btn.btn-group {
    border-color: #FFE66D;
    color: #FFE66D;
}

.routes-multi-toolbar .routes-multi-btn.btn-group:hover:not(:disabled) {
    background: rgba(255, 230, 109, 0.15);
}

.routes-multi-toolbar .routes-multi-count {
    font-size: 0.8rem;
    color: #888;
    margin-left: auto;
}

/* Compare dialog */
.route-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.route-compare-table th,
.route-compare-table td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-align: right;
}

.route-compare-table th:first-child,
.route-compare-table td:first-child {
    text-align: left;
    color: #aaa;
    font-weight: normal;
    width: 120px;
}

.route-compare-table th {
    font-size: 0.75rem;
    color: #888;
    font-weight: 600;
    border-bottom: 2px solid rgba(255,255,255,0.12);
}

.route-compare-table td.compare-best {
    color: #4ECDC4;
    font-weight: 600;
}

/* Group dialog */
.route-group-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.route-group-summary .rgs-stat {
    text-align: center;
}

.route-group-summary .rgs-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #e0e0e0;
}

.route-group-summary .rgs-label {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
}

.route-group-breakdown {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 12px;
}

.route-group-breakdown th,
.route-group-breakdown td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.route-group-breakdown th {
    text-align: left;
    font-size: 0.75rem;
    color: #888;
    font-weight: 600;
}

.route-group-breakdown td:not(:first-child) {
    text-align: right;
}

.route-group-bar {
    height: 4px;
    border-radius: 2px;
    margin-top: 8px;
    display: flex;
    overflow: hidden;
}

.route-group-bar-segment {
    height: 100%;
    transition: width 0.3s;
}

/* Master checkbox row — aligned with route item checkboxes */
.routes-select-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    margin-bottom: 4px;
}

.routes-master-check {
    flex-shrink: 0;
    accent-color: #239BCD;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.routes-select-label {
    font-size: 0.78rem;
    color: #888;
    user-select: none;
}

/* Group dialog detail sections (reuses rid-* styles from route info) */
.route-group-detail-sections {
    margin-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 12px;
}

.route-group-detail-sections .rid-section {
    margin-bottom: 14px;
}

.route-group-detail-sections .rid-loading {
    text-align: center;
    padding: 16px;
    color: #888;
}
