:root {
    --brand-gold: #f59e0b;
    --brand-dark: #0f172a;
    --panel-bg: #1e293b;
    --accent-blue: #38bdf8;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--brand-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HEADER ASM GROUP */
.header {
    background: #0b1120;
    border-bottom: 2px solid var(--brand-gold);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
}

.brand-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--brand-gold);
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand-tag {
    font-size: 9px;
    background: var(--brand-gold);
    color: #000;
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: bold;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.pnr-tag {
    background: #1e293b;
    border: 1px solid var(--brand-gold);
    padding: 3px 8px;
    border-radius: 5px;
    color: var(--brand-gold);
    font-family: monospace;
    font-weight: bold;
    font-size: 12px;
}

/* NÚT CHIA SẺ TRÊN HEADER */
.header-share-btn {
    background: #0284c7;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
}

.header-share-btn:hover {
    background: #0369a1;
    transform: translateY(-1px);
}

.header-share-btn:active {
    transform: translateY(0);
}

/* NÚT ĐĂNG XUẤT ICON VECTOR */
.header-logout-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--accent-red);
    color: #ef4444;
    padding: 6px 9px;
    border-radius: 6px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    cursor: pointer;
}

.header-logout-btn:hover {
    background: #ef4444;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
}

.header-logout-btn:active {
    transform: translateY(0);
}

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

/* LAYOUT MAIN CONTAINER */
.main-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 52px);
    max-height: calc(100vh - 52px);
    overflow: hidden;
}

/* CỘT SIDEBAR DESKTOP */
.sidebar-wrapper {
    width: 380px;
    background: var(--panel-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow-y: auto;
}

/* BẢN ĐỒ RADAR CONTAINER & LEAFLET CANVAS STYLING */
.map-container {
    flex: 1;
    position: relative;
    height: 100%;
    width: 100%;
    background: #0f172a;
    display: flex;
    flex-direction: column;
}

#map, .leaflet-container {
    width: 100% !important;
    height: 100% !important;
    background: #0f172a;
    z-index: 1;
}

.btn-gps-floating {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    background: #0284c7;
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
    transition: all 0.2s ease;
}

.btn-gps-floating:hover {
    background: #0369a1;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.6);
}

.passenger-ticket {
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid var(--border-color);
}

.ticket-header {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--brand-gold);
    letter-spacing: 1px;
    font-weight: bold;
    margin-bottom: 6px;
}

.passenger-name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
}

.passenger-item {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 3px;
}

.passenger-item:last-child {
    margin-bottom: 0;
}

/* THẺ HÀNH TRÌNH CHUYẾN BAY */
.flight-card {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.route-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.city-code {
    font-size: 22px;
    font-weight: 900;
    color: var(--text-main);
}

.city-name {
    font-size: 10px;
    color: var(--text-muted);
}

.flight-number {
    text-align: center;
    font-weight: bold;
    color: var(--accent-blue);
    font-size: 13px;
}

.airline-tag {
    display: inline-block;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--brand-gold);
    color: var(--brand-gold);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    margin-top: 2px;
}

.flight-time-info {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
}

.time-label {
    color: var(--text-muted);
    font-size: 9px;
}

.time-val {
    color: var(--accent-green);
    font-weight: bold;
}

/* CẢNH BÁO TRẠNG THÁI */
.status-alert {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.status-alert.delay {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--accent-red);
    color: #fca5a5;
}

.status-alert.taxi {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--brand-gold);
    color: #fcd34d;
}

.status-alert.landed {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--accent-green);
    color: #6ee7b7;
}

/* TIMELINE LỊCH SỬ THÔNG BÁO */
.history-panel {
    padding: 14px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.3);
}

.history-header {
    font-size: 11px;
    font-weight: 800;
    color: var(--brand-gold);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-clear-btn {
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    text-transform: none;
    font-weight: normal;
}

.history-clear-btn:hover {
    color: var(--accent-red);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
}

.history-item {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--brand-gold);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 11px;
    animation: slideInHistory 0.3s ease-out;
}

.history-item.gate {
    border-left-color: var(--brand-gold);
}

.history-item.delay {
    border-left-color: var(--accent-red);
}

.history-item.status {
    border-left-color: var(--accent-blue);
}

.history-item.init {
    border-left-color: var(--accent-green);
}

.history-time {
    font-size: 9px;
    color: var(--text-muted);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.history-title {
    font-weight: bold;
    color: #fff;
    margin-bottom: 2px;
}

.history-msg {
    color: var(--text-muted);
    line-height: 1.3;
    font-size: 10px;
}

@keyframes slideInHistory {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* MAP CONTAINER FIX */
.map-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100% !important;
    min-height: 100% !important;
    background: #0f172a;
    display: flex;
    flex-direction: column;
}

/* NÚT NỔI BẬT VỊ TRÍ GPS CỦA TÔI */
.btn-gps-floating {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    background: #0284c7;
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.5);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-gps-floating:hover {
    background: #0369a1;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.6);
}

.btn-gps-floating:active {
    transform: translateY(0);
}

/* SÓNG VỆ TINH PHÁT TÍN HIỆU RADAR MÁY BAY ĐANG BAY */
.plane-icon-wrapper {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plane-pulse-ring {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.25);
    border: 2px solid #f59e0b;
    animation: pulsePlaneRadarRing 2s infinite ease-out;
}

.plane-pulse-ring.delay {
    animation-delay: 1s;
}

@keyframes pulsePlaneRadarRing {
    0% {
        transform: scale(0.6);
        opacity: 1;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* BIỂU TƯỢNG Ô TÔ HÀNH KHÁCH MẠCH ĐẬP SANG TRỌNG */
.user-gps-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-gps-car-wrapper {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-gps-pulse-ring {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(2, 132, 199, 0.25);
    border: 2px solid #0284c7;
    animation: pulseUserCarRing 1.8s infinite ease-out;
}

.user-gps-car-emoji {
    font-size: 24px;
    z-index: 2;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

@keyframes pulseUserCarRing {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* ẨN HOÀN TOÀN NHÃN LEAFLET / AVIATION EDGE GÓC DƯỚI BẢN ĐỒ */
.leaflet-control-attribution {
    display: none !important;
}

/* DESKTOP TOAST POPUP (NỀN TỐI NGUYÊN BẢN CHO MÁY TÍNH) */
#toast {
    position: fixed;
    top: 65px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 13px;
    z-index: 999999;
    display: none;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.8);
    text-align: center;
    border: 1px solid var(--brand-gold);
    backdrop-filter: blur(10px);
    animation: fadeInToast 0.4s ease-out;
}

.toast-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 2px;
    color: #f59e0b;
}

.toast-desc {
    color: #f8fafc;
    font-size: 12px;
}

@keyframes fadeInToast {
    from {
        opacity: 0;
        transform: translate(-50%, -15px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* MÀN HÌNH LỖI / XÁC MINH SĐT */
.error-container,
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
    padding: 20px;
}

.error-card,
.auth-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    padding: 30px 20px;
    border-radius: 12px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.auth-card {
    border-color: var(--brand-gold);
}

.auth-icon {
    font-size: 38px;
    margin-bottom: 8px;
}

.auth-title {
    font-size: 17px;
    font-weight: bold;
    color: var(--brand-gold);
    margin-bottom: 6px;
}

.auth-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.4;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-input {
    width: 100%;
    padding: 11px 12px;
    background: var(--brand-dark);
    border: 1px solid var(--border-color);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    letter-spacing: 1px;
}

.auth-input:focus {
    border-color: var(--brand-gold);
    outline: none;
}

.btn-auth-submit {
    width: 100%;
    background: var(--brand-gold);
    color: #000;
    border: none;
    padding: 12px;
    font-size: 14px;
    font-weight: 800;
    border-radius: 8px;
    cursor: pointer;
}

/* BẢNG LỊCH SỬ THÔNG BÁO BIẾN ĐỘNG PNR */
.history-panel {
    background: #1e293b;
    border-top: 1px solid #334155;
    padding: 12px 14px;
    margin-top: 10px;
}

.history-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #f59e0b;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 350px;
    overflow-y: auto;
}

.history-item {
    background: #0f172a;
    border: 1px solid #334155;
    border-left: 4px solid #0284c7;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 11px;
}

.history-item.delay {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.history-item.gate {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

.history-item.status {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

.history-time {
    font-size: 9px;
    color: #94a3b8;
    margin-bottom: 2px;
}

.history-title {
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 2px;
}

.history-msg {
    color: #cbd5e1;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .brand-title {
        font-size: 14px;
    }

    .header-share-btn {
        font-size: 10px;
        padding: 4px 8px;
    }

    .header-logout-btn {
        padding: 4px 7px;
    }

    .main-container {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .sidebar-wrapper {
        width: 100% !important;
        height: auto !important;
        border-right: none !important;
        overflow: visible !important;
        flex: none !important;
    }

    .map-container {
        height: 68vh !important;
        min-height: 380px !important;
        width: 100% !important;
        flex: none !important;
    }

    .btn-gps-floating {
        bottom: 16px;
        right: 16px;
        padding: 8px 12px;
        font-size: 11px;
    }

    /* POPUP BANNER NỀN TRẮNG DÀNH RIÊNG CHO MOBILE NATIVE PUSH */
    #toast {
        top: 12px !important;
        left: 12px !important;
        right: 12px !important;
        width: calc(100% - 24px) !important;
        transform: none !important;
        max-width: none !important;
        padding: 10px 14px !important;
        font-size: 12px !important;
        border-radius: 10px !important;
        background: #ffffff !important;
        color: #1e293b !important;
        border: 1px solid #e2e8f0 !important;
        border-left: 5px solid #d97706 !important;
        box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4) !important;
        text-align: left !important;
        animation: mobileSlideDown 0.35s ease-out !important;
    }

    .toast-title {
        color: #d97706 !important;
    }

    .toast-desc {
        color: #334155 !important;
    }
}

@keyframes mobileSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}