/* Route Row */
.route-row {
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s ease;
    margin-bottom: 16px;
}

.route-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.route-header {
    display: grid;
    grid-template-columns: 60px 300px 40px 100px 1fr 50px 35px;
    gap: 20px;
    align-items: center;
    padding: 10px 20px;
    cursor: pointer;
    background: #f9f9f9;
    transition: background 0.2s ease;
    user-select: none;
}

/*Hide structural wrappers*/
.header-content,
.header-row-top,
.header-row-bottom {
    display: contents;
}

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

/* Route Number */
.route-number {
    font-weight: bold;
    font-size: 20px;
    color: white;
    padding: 8px 8px;
    border-radius: 2px;
    text-align: center;
    min-width: 45px;
}

/* Route Name */
.route-name {
    font-family: 'Oxanium', sans-serif;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status Indicator (Alerts/Check) */
.status-indicator {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    line-height: 1;
}

.status-indicator.alert {
    background: #ffc107;
    color: #000;
    border: 2px solid #ff9800;
}

.status-indicator.check {
    background-color: rgba(0, 0, 0, 0);
    color: rgba(0, 0, 0, 0);
    border: none;
}

/* Service Quality Badge */
.service-quality {
    padding: 6px 12px;
    border-radius: 2px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    font-family: 'Oxanium', sans-serif;
    white-space: nowrap;
}

.quality-perfect {
    background: #047508;
    color: white;
}

.quality-excellent {
    background: #00b306;
    color: white;
}

.quality-very-good {
    background: #61af4c;
    color: white;
}

.quality-good {
    background: #a5c34a;
    color: white;
}

.quality-fair {
    background: #c1a000;
    color: white;
}

.quality-poor {
    background: #ff9800;
    color: white;
}

.quality-very-poor {
    background: #f44336;
    color: white;
}

.quality-awful {
    background: #781008;
    color: white;
}

.quality-terrible {
    background: #350502;
    color: white;
}

.quality-unknown {
    background: #9e9e9e;
    color: white;
}

/* Status Bar Container */
.status-bar-container {
    min-width: 20px;
    max-width: 2000px;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    background: #e0e0e0;
    border: 1px solid #ccc;
    padding: 2px;
}

.status-bar {
    display: flex;
    height: 100%;
    width: 100%;
    gap: 2px;
}

.status-segment {
    display: flex;
    gap: 1px;
    height: 100%;
}

.vehicle-unit {
    height: 100%;
    border-radius: 2px;
}

.status-segment:last-child {
    border-right: none;
}

.view-map-btn {
    padding: 6px 12px;
    background-color: #0066cc;
    color: white;
    text-decoration: none;
    border-radius: 2px;
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: center;
}

.view-map-btn:hover {
    background-color: #0052a3;
}

/* Expand Icon */
.expand-icon {
    font-size: 14px;
    color: var(--accent-colour);
    transition: transform 0.2s ease;
    text-align: center;
}

/* Route Details Section */
.route-details {
    padding: 20px;
    background: #fafafa;
    border-top: 1px solid #eee;
}

.route-description {
    font-family: 'Oxanium', sans-serif;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
    padding: 10px;
    background: #fff;
    border-left: 3px solid #2196f3;
    border-radius: 2px;
}

/* Vehicles Section */
.vehicles-section {
    margin-top: 15px;
}

.vehicles-section h4 {
    font-family: 'Oxanium', sans-serif;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin: 0 0 10px 0;
}

.vehicles-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vehicles-list li {
    font-family: 'Oxanium', sans-serif;
    font-size: 13px;
    color: white;
    padding: 6px 12px;
    background: #2196f3;
    border-radius: 2px;
    line-height: 1.4;
    font-weight: bold
}


/* Alerts Section */
.alerts-section {
    margin-top: 15px;
}

.alerts-section h4 {
    font-family: 'Oxanium', sans-serif;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin: 0 0 10px 0;
}

.alerts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.alerts-list li {
    font-family: 'Oxanium', sans-serif;
    font-size: 13px;
    color: #555;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #fff;
    border-left: 3px solid #f44336;
    border-radius: 2px;
    line-height: 1.4;
}

.alerts-list li:last-child {
    margin-bottom: 0;
}

.no-alerts {
    font-family: 'Oxanium', sans-serif;
    font-size: 13px;
    color: #4caf50;
    padding: 10px 12px;
    background: #fff;
    border-left: 3px solid #4caf50;
    border-radius: 2px;
    margin: 0;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .route-row {
        background: var(--bg-primary);
        border-color: var(--border-color);
    }

    .route-header {
        background: var(--bg-primary);
    }

    .route-header:hover {
        background: var(--row-hover);
    }

    body.dark-mode .route-number{
        color: white;
    }

    .status-bar-container {
        background: var(--bg-primary);
        border-color: #666;
    }

    .status-indicator.has-alerts {
        background: #ffb300;
        border-color: #ff8f00;
        color: #000;
    }

    .status-indicator.no-alerts {
        background: #388e3c;
        border-color: #2e7d32;
        color: white;
    }

    .route-details {
        background: var(--bg-primary);
        border-top-color: #444;
    }

    .route-description {
        background: var(--bg-secondary);
        color: var(--text-primary);
        border-left-color: #64b5f6;
    }

    .alerts-section h4 {
        color: var(--text-primary);
    }

    .alerts-list li {
        background: var(--bg-secondary);
        color: var(--text-primary);
        border-left-color: #ef5350;
    }

    .no-alerts {
        background: var(--bg-secondary);
        color: var(--text-primary);
        border-left-color: #81c784;
    }

    .vehicles-section h4 {
        color: var(--text-primary);
    }

    body.dark-mode .vehicles-list li {
        color: white;
    }

}


@media (orientation: portrait) {
    .route-number {
        font-size: 32px;
    }

    .route-name {
        font-size: 26px;
    }

    .service-quality {
        font-size: 22px;
    }

    .view-map-btn {
        font-size: 22px;
    }

    .route-description,
    .vehicles-section h4,
    .vehicles-list li,
    .alerts-section h4,
    .alerts-list li,
    .no-alerts {
        font-size: 140%;
    }

    .status-indicator.alert,
    .status-indicator.check {
        font-size: 160%;
    }

    .status-indicator {
        width: 32px;
        height: 32px;
    }

    /* Outer Container: Splits Route Number (60px) and the Content */
    .route-header {
        grid-template-columns: 100px 1fr;
        gap: 15px;
    }

    /* Turn the wrapper into a stacked column */
    .header-content {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 16px;
    }

    /* Row 1 Grid */
    .header-row-top {
        display: grid;
        grid-template-columns: 1fr 32px;
        gap: 15px;
        align-items: center;
    }

    /* Row 2 Grid */
    .header-row-bottom {
        display: grid;
        grid-template-columns: 150px 1fr 80px 50px;
        gap: 10px;
        align-items: center;
    }
}
