/* Clean, unbloated wireframe layout - Fully optimized for Mobile & Desktop */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #f4f6f8;
    color: #1e293b;
    line-height: 1.5;
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
header {
    background: #0f172a;
    color: #fff;
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

header h1 {
    font-size: 19px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

header .header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

header .user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    background: #1e293b;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #334155;
}

.role-tag-admin {
    background: #dc2626;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 11px;
}

.role-tag-passenger {
    background: #0284c7;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 11px;
}

/* Nav Tabs with native-app feel on mobile */
nav.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

nav.tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

nav.tabs button {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-bottom: none;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    color: #475569;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

nav.tabs button.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

/* Layout containers */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* Cards & Panels */
.card {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 16px;
}

.card h2, .card h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #0f172a;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 6px;
}

/* Forms & Inputs */
label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #334155;
}

input, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
    background-color: #fff;
}

button.btn-primary {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
}

button.btn-primary:hover { background: #1d4ed8; }

button.btn-secondary {
    background: #e2e8f0;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    padding: 9px 14px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
}

button.btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
}

button.btn-danger:hover { background: #b91c1c; }

/* Video Frame */
.video-frame {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    background: #000;
    border-radius: 6px;
    border: 1px solid #94a3b8;
}

/* Lane card styles */
.lane-card {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    background: #f8fafc;
}

.lane-card.fastest {
    border-color: #16a34a;
    background: #f0fdf4;
}

.lane-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.badge-fastest { background: #22c55e; color: #fff; }
.badge-normal { background: #94a3b8; color: #fff; }

.metric-big {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
}

/* Risk meter */
.risk-meter {
    height: 16px;
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    margin: 12px 0;
}

.risk-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

.risk-LOW { background: #22c55e; }
.risk-MODERATE { background: #eab308; }
.risk-HIGH { background: #f97316; }
.risk-CRITICAL { background: #ef4444; }

.status-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.pill-CRITICAL { background: #fee2e2; color: #b91c1c; }
.pill-HIGH { background: #ffedd5; color: #c2410c; }
.pill-MODERATE { background: #fef9c3; color: #854d0e; }
.pill-LOW { background: #dcfce7; color: #15803d; }

/* Voucher card */
.voucher-box {
    border: 2px dashed #0284c7;
    background: #f0f9ff;
    padding: 16px;
    border-radius: 8px;
    margin-top: 14px;
}

.voucher-code {
    font-family: monospace;
    font-size: 15px;
    font-weight: 800;
    background: #e0f2fe;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block;
    color: #0369a1;
    word-break: break-all;
}

/* Route Cards */
.route-card {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 12px;
    background: #fff;
}

.route-card.best {
    border: 2px solid #2563eb;
    background: #eff6ff;
}

.route-header {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 4px;
}

.route-timeline {
    font-size: 13px;
    color: #475569;
}

/* Passenger Table */
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 10px;
    min-width: 580px; /* enables horizontal scroll on mobile */
}

table.data-table th, table.data-table td {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    text-align: left;
}

table.data-table th {
    background: #f1f5f9;
    font-weight: 700;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-box {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

/* ========================================================= */
/* MOBILE OPTIMIZATIONS (Smartphones, small tablets <= 680px) */
/* ========================================================= */

@media (max-width: 680px) {
    body {
        padding: 10px 8px;
    }

    header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    header h1 {
        font-size: 17px;
    }

    header .header-controls {
        width: 100%;
        justify-content: space-between;
    }

    /* Prevent auto-zoom on iOS Safari when tapping inputs */
    input, select {
        font-size: 16px;
        padding: 10px;
    }

    /* Mobile tabs with pill-style scrolling */
    nav.tabs {
        gap: 6px;
        padding-bottom: 8px;
    }

    nav.tabs button {
        padding: 8px 14px;
        font-size: 12px;
        border-radius: 18px;
        border: 1px solid #cbd5e1;
    }

    /* Grids collapse to single column */
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .card {
        padding: 14px;
        margin-bottom: 12px;
    }

    .card h2, .card h3 {
        font-size: 15px;
    }

    .metric-big {
        font-size: 24px;
    }

    /* Buttons touch targets */
    button.btn-primary, button.btn-secondary, button.btn-danger {
        padding: 10px 14px;
        font-size: 13px;
        min-height: 42px;
    }

    /* Mobile video stream */
    .video-frame {
        max-height: 260px;
    }
}
