:root {
    --primary: #0b3d91;
    --primary-dark: #082a66;
    --accent: #f0a500;
    --card-radius: 12px;
    --gap: 1rem;
}

* { font-family: 'Inter', system-ui, -apple-system, sans-serif; box-sizing: border-box; }

html { font-size: 15px; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
    background: #f0f4f8;
    color: #1e293b;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== NAV / TOP ===== */
.top-bar { font-size: 0.75rem; }
.navbar { background: var(--primary) !important; padding: 0.4rem 0; }
.navbar-brand { font-size: 1.1rem; letter-spacing: 0.3px; }
.navbar .nav-link { font-size: 0.9rem; padding: 0.4rem 0.7rem !important; }

/* ===== PAGE SHELL ===== */
.page-shell {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.75rem 0.75rem 2rem;
}
@media (min-width: 768px) {
    .page-shell { padding: 1rem 1.25rem 2.5rem; }
}

.page-header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.page-header-bar h1, .page-header-bar h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

/* ===== 8/4 GRID ===== */
.content-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap);
}
.content-main {
    flex: 1 1 100%;
    min-width: 0;
}
.content-side {
    flex: 1 1 100%;
    min-width: 0;
}
@media (min-width: 992px) {
    .content-main { flex: 1 1 calc(66.666% - var(--gap)/2); max-width: calc(66.666% - var(--gap)/2); }
    .content-side { flex: 1 1 calc(33.333% - var(--gap)/2); max-width: calc(33.333% - var(--gap)/2); }
    .content-side .promo-panel,
    .content-side .tips-panel { position: sticky; top: 70px; }
}

/* ===== CARDS ===== */
.form-card, .data-card {
    background: #fff;
    border-radius: var(--card-radius);
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    overflow: hidden;
}
.form-card .card-header,
.data-card .card-header {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.85rem 1.1rem;
    border: none;
}
.form-card .card-header.header-warning {
    background: linear-gradient(90deg, #f0a500, #d97706);
    color: #1e293b;
}
.form-card .card-header.header-light,
.data-card .card-header.header-light {
    background: #f8fafc;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
}
.form-card .card-body,
.data-card .card-body { padding: 1.15rem; }

/* ===== TIPS PANEL ===== */
.tips-panel {
    background: #fff;
    border-radius: var(--card-radius);
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    overflow: hidden;
}
.tips-panel .tips-header {
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}
.tips-panel .tips-body { padding: 1rem; }
.tip-item {
    display: flex;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.4;
}
.tip-item:last-child { margin-bottom: 0; }
.tip-num {
    flex-shrink: 0;
    width: 22px; height: 22px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

/* ===== PROMO / ADS PANEL ===== */
.promo-panel {
    background: #fff;
    border-radius: var(--card-radius);
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    overflow: hidden;
}
.promo-panel .promo-header {
    background: linear-gradient(90deg, #1e293b, #334155);
    color: #fff;
    font-weight: 600;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}
.promo-panel .promo-body { padding: 0.9rem; }
.promo-video-wrap iframe {
    border: 0;
    width: 100%;
    height: 100%;
}
.promo-caption { font-size: 0.75rem; }
.promo-banner { font-size: 0.85rem; }
.promo-link-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    text-decoration: none;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s;
}
.promo-link-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}
.promo-link-item i { font-size: 1.1rem; }

/* ===== FORMS ===== */
.form-label {
    font-weight: 500;
    font-size: 0.8rem;
    color: #475569;
    margin-bottom: 0.3rem;
}
.form-control, .form-select {
    border-radius: 8px;
    border-color: #cbd5e1;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11,61,145,0.12);
}
.required-star { color: #dc2626; }
.input-group-text { border-radius: 8px 0 0 8px; font-size: 0.85rem; }

/* ===== TABLES ===== */
.table { margin-bottom: 0; font-size: 0.85rem; }
.table thead th {
    background: #f1f5f9;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    padding: 0.65rem 0.75rem;
}
.table td {
    vertical-align: middle;
    padding: 0.6rem 0.75rem;
}
.table-responsive { -webkit-overflow-scrolling: touch; }

/* ===== BUTTONS ===== */
.btn {
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.45rem 1rem;
}
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-warning { background: var(--accent); border-color: var(--accent); color: #1e293b; }
.btn-success { background: #059669; border-color: #059669; }

/* ===== DASH STATS ===== */
.dash-stat {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    border: 1px solid #e2e8f0;
    height: 100%;
}
.dash-stat .value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.dash-stat .label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}

/* ===== DETAIL GRID ===== */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}
@media (min-width: 576px) {
    .detail-grid { grid-template-columns: 140px 1fr; }
}
.detail-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
}
.detail-value {
    font-size: 0.9rem;
    color: #1e293b;
}

/* Fuel progress bar */
.fuel-bar {
    height: 10px;
    border-radius: 6px;
    background: #e2e8f0;
    overflow: hidden;
}
.fuel-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s;
}

/* Settings compact rows */
.settings-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid #f1f5f9;
}
.settings-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.settings-row .settings-label {
    flex: 0 0 100%;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
}
@media (min-width: 576px) {
    .settings-row .settings-label { flex: 0 0 140px; }
}
.settings-row .settings-input { flex: 1 1 auto; min-width: 0; }
.settings-row .btn { flex-shrink: 0; }

/* ===== HERO (landing) ===== */
.hero-live { position: relative; min-height: 70vh; }
@media (min-width: 768px) { .hero-live { min-height: 85vh; } }
.hero-bg {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
    animation: slowZoom 25s ease-in-out infinite alternate;
}
@keyframes slowZoom {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
}
.hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(11,61,145,0.85) 0%, rgba(8,42,102,0.75) 50%, rgba(0,0,0,0.55) 100%);
}
.z-2 { position: relative; z-index: 2; }
.text-shadow { text-shadow: 0 2px 12px rgba(0,0,0,0.4); }
/* ===== SMALL TRANSPARENT SIDE-VIEW BUSES ON ROAD ===== */
.road-scene {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 78px;
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
}
.road-surface {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 26px;
    background: linear-gradient(180deg, #4b5563 0%, #1f2937 60%, #111827 100%);
    box-shadow: 0 -4px 18px rgba(0,0,0,0.35);
}
.road-line {
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    height: 3px;
    margin-top: -1px;
    background: repeating-linear-gradient(90deg, #f0a500 0 36px, transparent 36px 64px);
    animation: roadMove 0.85s linear infinite;
}
@keyframes roadMove {
    from { background-position: 0 0; }
    to { background-position: 64px 0; }
}

.moving-bus {
    position: absolute;
    bottom: 18px;
    will-change: transform;
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.4));
}
.moving-bus .bus-photo {
    display: block;
    height: 42px;
    width: auto;
    background: transparent;
    border: none;
    /* SVG already faces right (forward) */
    transform: none;
}

.bus-1 { animation: busDriveForward 15s linear infinite; }
.bus-1 .bus-photo { height: 46px; }

.bus-2 { animation: busDriveForward 20s linear infinite; animation-delay: -5s; }
.bus-2 .bus-photo { height: 40px; }

.bus-3 { animation: busDriveForward 12s linear infinite; animation-delay: -9s; }
.bus-3 .bus-photo { height: 44px; }

.bus-4 { animation: busDriveForward 24s linear infinite; animation-delay: -14s; }
.bus-4 .bus-photo { height: 38px; }

@keyframes busDriveForward {
    0%   { transform: translateX(-160px); }
    100% { transform: translateX(calc(100vw + 20px)); }
}

@media (max-width: 576px) {
    .road-scene { height: 60px; }
    .road-surface { height: 20px; }
    .moving-bus { bottom: 12px; }
    .bus-1 .bus-photo { height: 34px; }
    .bus-2 .bus-photo { height: 30px; }
    .bus-3 .bus-photo { height: 32px; }
    .bus-4 .bus-photo { height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    .moving-bus, .road-line { animation: none !important; }
    .bus-1 { left: 6%; }
    .bus-2 { left: 30%; }
    .bus-3 { left: 55%; }
    .bus-4 { left: 78%; }
}

.stat-card {
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 1rem 0.5rem;
}
.stat-number { font-size: 1.35rem; font-weight: 700; }
.stat-label { font-size: 0.75rem; opacity: 0.85; }

.feature-card {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s;
    height: 100%;
}
.feature-card:hover { transform: translateY(-3px); }
.feature-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem;
    margin-bottom: 0.85rem;
}

/* Footer */
.footer { font-size: 0.8rem; }

/* Alerts inside page */
.alert { border-radius: 10px; font-size: 0.875rem; }

/* Mobile nav collapse polish */
@media (max-width: 991px) {
    .navbar-collapse {
        background: var(--primary-dark);
        margin: 0.5rem -0.75rem 0;
        padding: 0.5rem 1rem 1rem;
        border-radius: 0 0 12px 12px;
    }
}

/* Reduce empty side gaps on mobile */
@media (max-width: 575px) {
    .page-shell { padding-left: 0.5rem; padding-right: 0.5rem; }
    .form-card .card-body, .data-card .card-body { padding: 0.9rem; }
    .btn { width: 100%; margin-bottom: 0.35rem; }
    .d-flex.gap-2 .btn { width: auto; flex: 1; }
}
