/* ============================================================
   ALCOLOCK ONLINE — MODERN DASHBOARD
   2026-09-22
   ============================================================ */

:root {
    --ao-bg: #0b1220;
    --ao-topbar: #0f172a;
    --ao-sidebar: #111827;
    --ao-card: #182235;
    --ao-card-hover: #1d2a40;
    --ao-border: #2a3950;
    --ao-border-soft: rgba(148, 163, 184, 0.18);

    --ao-text: #f8fafc;
    --ao-text-soft: #cbd5e1;
    --ao-muted: #94a3b8;

    --ao-blue: #2563eb;
    --ao-blue-hover: #1d4ed8;
    --ao-green: #22c55e;
    --ao-amber: #f59e0b;
    --ao-red: #ef4444;
    --ao-offline: #64748b;

    --ao-radius: 9px;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
}

body {
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: var(--ao-bg);
    color: var(--ao-text);
}

* {
    box-sizing: border-box;
}

body.lightTheme,
body.darkTheme {
    background: var(--ao-bg);
}

/* ========================= TOP BAR ========================= */

#topbar {
    position: relative;
    z-index: 3000;

    display: flex;
    align-items: center;
    justify-content: space-between;

    height: 80px;
    min-height: 80px;

    padding: 0 22px;

    background: var(--ao-topbar) !important;
    color: var(--ao-text);

    border-bottom: 1px solid var(--ao-border-soft);

    box-shadow:
        0 1px 0 rgba(255,255,255,0.02),
        0 10px 28px rgba(2,6,23,0.16);
}

#leftControls {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

#leftControls > button,
#rightLogo > button,
#toggleSidebarBtn,
#themeBtn,
#settingsBtn,
#languageBtn,
#summaryBtn,
#reportsBtn,
#adminBtn {
    margin: 0 !important;
}

#topbar button {
    min-height: 38px;
    padding: 8px 12px;

    border: 1px solid transparent;
    border-radius: 8px;

    background: transparent;
    color: var(--ao-text-soft);

    font-size: 14px;
    font-weight: 650;
    line-height: 1;

    box-shadow: none;

    transition:
        background-color 120ms ease,
        border-color 120ms ease,
        color 120ms ease;
}

#topbar button:hover {
    background: rgba(148, 163, 184, 0.10);
    border-color: rgba(148, 163, 184, 0.12);
    color: #ffffff;
    transform: none;
}

#toggleSidebarBtn {
    background: var(--ao-blue) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

#toggleSidebarBtn:hover {
    background: var(--ao-blue-hover) !important;
}

#themeBtn,
#settingsBtn,
#languageBtn,
#summaryBtn,
#reportsBtn,
#adminBtn {
    background: transparent !important;
}

#themeBtn:hover,
#settingsBtn:hover,
#languageBtn:hover,
#summaryBtn:hover,
#reportsBtn:hover,
#adminBtn:hover {
    background: rgba(148, 163, 184, 0.10) !important;
}

#rightLogo {
    margin-left: auto;

    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;

    min-width: 0;
}

#companySelect {
    height: 40px;
    min-width: 190px;

    margin: 0 !important;
    padding: 0 34px 0 12px;

    border: 1px solid var(--ao-border);
    border-radius: 8px;

    background-color: #ffffff;
    color: #111827;

    font: inherit;
    font-size: 14px;

    outline: none;

    transition:
        border-color 120ms ease,
        box-shadow 120ms ease;
}

#companySelect:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
}

#userInfo {
    margin-left: 8px !important;
    margin-right: 8px !important;

    color: var(--ao-text-soft) !important;

    font-size: 12px !important;
    line-height: 1.25;
}

#topLogo {
    display: block;

    height: 36px !important;
    width: auto;

    margin: 0 0 0 6px !important;

    object-fit: contain;
}

#centerLogo {
    pointer-events: none;
}

#emberLogo {
    max-height: 42px !important;
    width: auto;
    opacity: 0.92;
}

/* ========================= LAYOUT ========================= */

#container {
    display: flex;

    height: calc(100vh - 80px) !important;
    height: calc(100dvh - 80px) !important;

    min-height: 0;

    background: var(--ao-bg);
}

/* ========================= SIDEBAR ========================= */

#sidebar,
.lightTheme #sidebar,
.darkTheme #sidebar {
    width: 360px;
    flex: 0 0 360px;
    min-width: 0;

    overflow-x: hidden;
    overflow-y: auto;

    background: var(--ao-sidebar) !important;

    border-right: 1px solid var(--ao-border-soft) !important;

    transition:
        width 220ms ease,
        flex-basis 220ms ease,
        border-color 220ms ease;

    scrollbar-width: thin;
    scrollbar-color: #475569 transparent;
}

#sidebar.hidden {
    width: 0 !important;
    flex-basis: 0 !important;

    overflow: hidden;

    border-right-color: transparent !important;
}

#sidebar::-webkit-scrollbar {
    width: 8px;
}

#sidebar::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 10px;
    border: 2px solid var(--ao-sidebar);
}

#fleetTitle,
.lightTheme #fleetTitle,
.darkTheme #fleetTitle {
    position: sticky;
    top: 0;
    z-index: 20;

    padding: 18px 16px 13px;

    background:
        linear-gradient(
            180deg,
            rgba(17,24,39,0.98) 0%,
            rgba(17,24,39,0.95) 100%
        ) !important;

    color: var(--ao-muted) !important;

    border-bottom: 1px solid var(--ao-border-soft) !important;

    text-align: left !important;
    text-transform: uppercase;

    font-size: 12px !important;
    font-weight: 750 !important;
    letter-spacing: 0.09em;

    backdrop-filter: blur(8px);
}

#vehicleList {
    padding: 10px 10px 18px;
}

/* ========================= VEHICLE CARDS ========================= */

#vehicleList .vehicle {
    position: relative;

    width: 100%;

    margin: 0 0 8px !important;
    padding: 10px 12px 10px 16px !important;

    min-height: 58px;

    display: flex;
    align-items: center;

    border: 1px solid var(--ao-border) !important;
    border-radius: var(--ao-radius) !important;

    background: var(--ao-card) !important;
    color: var(--ao-muted) !important;

    box-shadow: none !important;

    cursor: pointer;

    font-size: 13px;
    font-weight: 500;

    transform: none !important;

    transition:
        background-color 120ms ease,
        border-color 120ms ease,
        box-shadow 120ms ease,
        transform 120ms ease;
}

#vehicleList .vehicle::before {
    content: "";

    position: absolute;

    left: -1px;
    top: 9px;
    bottom: 9px;

    width: 3px;

    border-radius: 0 3px 3px 0;

    background: var(--ao-offline);
}

#vehicleList .vehicle.online::before,
#vehicleList .vehicle.ui-online::before {
    background: var(--ao-green);
}

#vehicleList .vehicle.offline::before,
#vehicleList .vehicle.ui-offline::before {
    background: var(--ao-offline);
}

#vehicleList .vehicle.ui-warning::before {
    background: var(--ao-amber) !important;
}

#vehicleList .vehicle.ui-alarm::before {
    background: var(--ao-red) !important;
}

#vehicleList .vehicle.online,
#vehicleList .vehicle.offline,
#vehicleList .vehicle.ui-online,
#vehicleList .vehicle.ui-offline,
#vehicleList .vehicle.ui-warning,
#vehicleList .vehicle.ui-alarm {
    background: var(--ao-card) !important;
    color: var(--ao-muted) !important;
}

#vehicleList .vehicle.ui-warning {
    border-color: rgba(245, 158, 11, 0.34) !important;
}

#vehicleList .vehicle.ui-alarm {
    border-color: rgba(239, 68, 68, 0.42) !important;
}

#vehicleList .vehicle:hover {
    background: var(--ao-card-hover) !important;
    border-color: #3b4d67 !important;

    box-shadow:
        0 8px 22px rgba(2, 6, 23, 0.16) !important;

    transform: translateY(-1px) !important;
}

#vehicleList .vehicle.followingVehicle,
#vehicleList .vehicle.ui-following {
    border-color: rgba(96,165,250,0.62) !important;

    box-shadow:
        inset 0 0 0 1px rgba(96,165,250,0.12),
        0 8px 22px rgba(2,6,23,0.16) !important;
}

#vehicleList .vehicle b {
    color: var(--ao-text) !important;

    font-size: 15px;
    font-weight: 730;
    line-height: 1.25;
    letter-spacing: 0.01em;
}

#vehicleList .vehicle .aoVehicleMain {
    min-width: 0;
    line-height: 1.35;
}

#vehicleList .vehicle .aoVehicleActions {
    margin-left: auto;

    display: flex;
    align-items: center;

    padding-left: 10px;
}

#vehicleList .followBadge {
    display: inline-flex;
    align-items: center;

    margin-left: 7px;
    padding: 2px 6px;

    border: 1px solid rgba(96,165,250,0.35);
    border-radius: 5px;

    background: rgba(37,99,235,0.12);
    color: #93c5fd;

    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.07em;
}

#vehicleList .failCount {
    min-width: 18px;
    height: 18px;

    margin-left: 6px;
    padding: 0 5px;

    border-radius: 5px;

    background: rgba(239,68,68,0.16);
    color: #fecaca;

    border: 1px solid rgba(239,68,68,0.30);

    font-size: 10px;
    font-weight: 800;
}

#vehicleList .historyBtn {
    display: inline-flex;
    align-items: center;
    gap: 5px;

    min-height: 30px;

    padding: 5px 7px !important;

    border: 1px solid transparent !important;
    border-radius: 6px !important;

    background: transparent !important;
    color: var(--ao-text-soft) !important;

    box-shadow: none !important;

    font-size: 12px !important;
    font-weight: 650 !important;

    white-space: nowrap;

    transform: none !important;
}

#vehicleList .historyBtn::after {
    content: "›";

    position: relative;
    top: -0.5px;

    color: var(--ao-muted);

    font-size: 18px;
    font-weight: 400;
    line-height: 0.8;
}

#vehicleList .historyBtn:hover {
    background: rgba(148,163,184,0.10) !important;
    color: #ffffff !important;

    transform: none !important;
}

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

#map {
    position: relative;

    flex: 1 1 auto;
    min-width: 0;

    background: #dbe4ec;
}

#map .leaflet-bar {
    overflow: hidden;

    border: 1px solid rgba(15,23,42,0.18);
    border-radius: 8px;

    box-shadow: 0 8px 20px rgba(15,23,42,0.14);
}

#map .leaflet-bar a {
    width: 34px;
    height: 34px;
    line-height: 34px;

    border-bottom-color: rgba(15,23,42,0.10);

    font-size: 19px;
}

#map .leaflet-popup-content-wrapper {
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(2, 6, 23, 0.34);
}

#map .leaflet-popup-content {
    margin: 14px 16px;

    font-size: 13px;
    line-height: 1.45;
}

/* ========================= STATS ========================= */

#statsBar {
    position: absolute;

    left: 50%;
    bottom: 18px;

    transform: translateX(-50%);

    display: flex;
    align-items: stretch;

    gap: 0;

    padding: 10px 8px;

    background: rgba(15,23,42,0.94) !important;

    border: 1px solid rgba(148,163,184,0.16) !important;
    border-radius: 11px !important;

    backdrop-filter: blur(12px);

    box-shadow:
        0 12px 34px rgba(2,6,23,0.32) !important;

    z-index: 999;
}

#statsBar .statCard {
    min-width: 92px;

    padding: 2px 18px;

    border-right: 1px solid rgba(148,163,184,0.15);

    cursor: pointer;

    text-align: left;

    transition: background-color 120ms ease;
}

#statsBar .statCard:hover {
    background: rgba(148,163,184,0.08);
}

#statsBar .statCard:last-child {
    border-right: 0;
}

#statsBar .statTitle {
    margin: 0 0 5px;

    color: var(--ao-muted);

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 0.045em;
    text-transform: uppercase;
}

#statsBar .statValue {
    color: var(--ao-text);

    font-size: 21px;
    font-weight: 760;
    line-height: 1;
}

#statsBar .statValue.green {
    color: var(--ao-green);
}

#statsBar .statValue.orange {
    color: var(--ao-amber);
}

#statsBar .statValue.red {
    color: var(--ao-red);
}

/* ========================= ACCESSIBILITY ========================= */

#topbar button:focus-visible,
#vehicleList .historyBtn:focus-visible,
#companySelect:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.26);
}

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

@media (max-width: 1500px) {
    #topbar {
        padding-left: 14px;
        padding-right: 14px;
    }

    #topbar button {
        padding-left: 10px;
        padding-right: 10px;
        font-size: 13px;
    }

    #companySelect {
        min-width: 150px;
    }

    #sidebar,
    .lightTheme #sidebar,
    .darkTheme #sidebar {
        width: 340px;
        flex-basis: 340px;
    }
}

@media (max-width: 1180px) {
    #centerLogo {
        display: none !important;
    }

    #userInfo {
        display: none !important;
    }

    #topLogo {
        height: 30px !important;
    }

    #sidebar,
    .lightTheme #sidebar,
    .darkTheme #sidebar {
        width: 320px;
        flex-basis: 320px;
    }
}

@media (max-width: 920px) {
    #topbar {
        overflow-x: auto;
        overflow-y: hidden;
    }

    #leftControls,
    #rightLogo {
        flex: 0 0 auto;
    }

    #statsBar .statCard {
        min-width: 72px;
        padding-left: 10px;
        padding-right: 10px;
    }
}
