* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --secondary: #34a853;
    --accent: #fbbc04;
    --danger: #ea4335;
    --dark: #1e2a3a;
    --dark-light: #2d3f55;
    --glass: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--dark);
    color: var(--text-light);
    overflow: hidden;
}

/* ========== HEADER ========== */
header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--dark-light) 100%);
    border-bottom: 1px solid var(--glass-border);
    padding: 2px 8px;
    
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;

}

/* ========== HEADER ========== */
.logo {
    width: 40px;
    height: 40px;
    /* background: linear-gradient(135deg, var(--primary), var(--secondary)); */
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
    overflow: hidden;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* ảnh phủ kín vùng 40x40 mà không bị méo tỷ lệ */
    display: block;
}

.brand-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    max-width: min(880px, 58vw);
    overflow: hidden;
}

.brand-name {
    line-height: 1.15;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: linear-gradient(90deg, #dbeafe 0%, #93c5fd 35%, #6ee7b7 70%, #dbeafe 100%);
    background-size: 220% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 18px rgba(96, 165, 250, 0.16);
    animation: brandShine 8s linear infinite;
}

/* Dòng 1 nhỏ hơn */
.brand-name:first-child {
    font-size: clamp(11px, 0.8vw, 15px);
    font-weight: 600;
    opacity: 0.95;

}

/* Dòng 2 lớn hơn */
.brand-name:nth-child(2) {
    font-size: clamp(13px, 1.02vw, 19px);
    font-weight: 700;
}

.marquee-track {
    display: inline-block;
    white-space: nowrap;
    min-width: max-content;
    animation: marqueeLoop 10s linear infinite;
    will-change: transform;
}

.marquee-track span {
    display: inline-block;
    color: #e2e8f0;
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.25);
    padding-right: 0;
}

@keyframes marqueeLoop {
    0% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(-100%);
    }
}

.header-center {
    display: flex;
    align-items: center;
    gap: 8px;
}



/* Toggle Switch 2D/3D */
.view-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 4px;
    gap: 4px;
}

.toggle-btn {
    padding: 8px 22px;
    border: none;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
}

.toggle-btn.active {
    background: linear-gradient(135deg, var(--primary), #4f8ef7);
    color: white;
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.5);
}

.toggle-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.toggle-btn .btn-icon {
    margin-right: 6px;
}



.header-actions {
    display: flex;
    gap: 8px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 12px;
}

.user-chip {
    height: 36px;
    max-width: 220px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.user-chip i {
    color: #9ec5ff;
}

.user-chip span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pro-badge {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(251, 188, 4, 0.55);
    background: rgba(251, 188, 4, 0.2);
    color: #ffe59a;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.3;
}

.login-btn {
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(26, 115, 232, 0.6);
    background: rgba(26, 115, 232, 0.18);
    color: #dbeafe;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.login-btn:hover {
    background: rgba(26, 115, 232, 0.3);
    border-color: rgba(26, 115, 232, 0.9);
    color: #fff;
    transform: translateY(-1px);
}


.logout-btn {
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(234, 67, 53, 0.55);
    background: rgba(234, 67, 53, 0.12);
    color: #ffd9d6;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(234, 67, 53, 0.22);
    border-color: rgba(234, 67, 53, 0.8);
    color: #fff;
    transform: translateY(-1px);
}

.icon-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-1px);
}



/* ========== MAIN ========== */
main {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map-2d {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#map-3d {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: none;
}

/* ========== TOOLBAR (floating) ========== */
.map-toolbar {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: calc(100vh - 140px);
    /* giới hạn chiều cao */
    overflow-y: auto;
    /* overflow-x: hidden; */
    padding: 6px 4px;
    /* Ẩn scrollbar nhưng vẫn scroll được */
    scrollbar-width: none;
    -ms-overflow-style: none;

    /* Bo viền mờ ở 2 đầu */
    -webkit-mask-image: linear-gradient(to bottom,
            transparent 0%,
            black 8%,
            black 92%,
            transparent 100%);
    mask-image: linear-gradient(to bottom,
            transparent 0%,
            black 8%,
            black 92%,
            transparent 100%);

}


.map-toolbar::-webkit-scrollbar {
    display: none;
}

.tool-btn {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    /* không bị co lại */
    background: var(--dark);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.25s;
    position: relative;
}


.tool-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateX(3px);
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.4);
}


/* ========== LAYER PANEL ========== */
.layer-panel {
    position: absolute;
    right: 16px;
    top: 16px;
    width: 240px;
    background: rgba(30, 42, 58, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    z-index: 100;
    overflow: hidden;
    box-shadow: var(--shadow);
    display: none;
}

.layer-panel.visible {
    display: block !important;
    animation: slideInLeft 0.25s ease;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#layerToggleBtn.active {
    background: rgba(26, 115, 232, 0.35);
    color: #fff;
}


.panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title i {
    color: var(--primary);
}

.panel-toggle {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.2s;
}

.panel-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.panel-body {
    padding: 12px;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    transition: background 0.2s;
    cursor: pointer;
}

.layer-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.layer-item input[type="radio"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--glass-border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.layer-item input[type="radio"]:checked {
    border-color: var(--primary);
    background: radial-gradient(circle, var(--primary) 50%, transparent 50%);
    box-shadow: 0 0 8px rgba(26, 115, 232, 0.5);
}

.layer-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.layer-name {
    font-size: 12px;
    color: var(--text-light);
    flex: 1;
}

/* ========== SCALE / ZOOM INFO ========== */
.map-info-bar {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 42, 58, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 12px;
    color: var(--text-muted);
    z-index: 100;
    box-shadow: var(--shadow);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-item i {
    color: var(--primary);
    font-size: 11px;
}

.info-item strong {
    color: var(--text-light);
}

/* ========== VIEW BADGE ========== */
.view-badge {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary), #4f8ef7);
    color: white;
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(26, 115, 232, 0.5);
    letter-spacing: 1px;
    text-transform: uppercase;
    pointer-events: none;
}

/* ========== TRANSITION OVERLAY ========== */
.transition-overlay {
    position: absolute;
    inset: 0;
    background: var(--dark);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.transition-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

/* ========== FOOTER ========== */
footer {
    background: var(--primary-dark);
    border-top: 1px solid var(--glass-border);
    padding: 0 24px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    flex-shrink: 0;

    /* GIỮ SÓNG BÊN TRONG FOOTER */
    position: relative;
    overflow: hidden;
}

/* 2. NÂNG LỚP TEXT LÊN TRÊN CÙNG ĐỂ KHÔNG BỊ SÓNG CHE MẤT */
footer .footer-left,
footer .footer-center {
    position: relative;
    z-index: 2;
}

/* 3. TẠO 2 LỚP SÓNG CHUYỂN ĐỘNG */
footer::before,
footer::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Nằm dưới chữ, nằm trên background */
    pointer-events: none;
    /* Không cản trở việc click vào link */
    background-repeat: repeat-x;
}

/* Lớp sóng 1 (Mờ hơn, gợn sóng ngắn, chạy từ trái sang phải) */
footer::before {
    /* Mã hóa SVG base64 siêu nhẹ */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='42'%3E%3Cpath d='M0 25 Q 50 10, 100 25 T 200 25 V 42 H 0 Z' fill='rgba(255, 255, 255, 0.05)'/%3E%3C/svg%3E");
    background-size: 200px 100%;
    animation: moveWave 15s linear infinite;
}

/* Lớp sóng 2 (Rõ hơn một chút, gợn sóng dài, chạy ngược lại) */
footer::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='42'%3E%3Cpath d='M0 28 Q 62.5 15, 125 28 T 250 28 V 42 H 0 Z' fill='rgba(255, 255, 255, 0.08)'/%3E%3C/svg%3E");
    background-size: 250px 100%;
    animation: moveWave 10s linear infinite reverse;
}

/* 4. KEYFRAME CHUYỂN ĐỘNG MƯỢT MÀ */
@keyframes moveWave {
    0% {
        background-position-x: 0;
    }

    100% {
        /* 1000px là Bội chung nhỏ nhất của 200px và 250px giúp cả 2 vòng lặp (loop) không bị giật lag khi reset */
        background-position-x: 1000px;
    }
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 11px;
    color: var(--text-muted);
}

.footer-left a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-left a:hover {
    color: var(--primary);
}

.footer-sep {
    color: rgba(255, 255, 255, 0.15);
}

.footer-center {
    font-size: 11px;
    color: var(--text-muted);
}

.footer-center i {
    color: var(--danger);
    margin: 0 2px;
}


/* ========== OL OVERRIDES ========== */
.ol-zoom {
    display: none;
}

.ol-attribution {
    background: rgba(30, 42, 58, 0.85) !important;
    border-radius: 8px 0 0 0 !important;
    color: var(--text-muted) !important;
    font-size: 10px !important;
}

.ol-attribution a {
    color: var(--primary) !important;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .header-center {
        display: none;
    }

    .coord-display {
        display: none;
    }


    .brand-name {
        display: none;
    }

    .brand-block {
        max-width: 62vw;
    }

    .brand-sub {
        display: block;
    }

    .brand-sub.marquee {
        display: block;
        max-width: 52vw;
        padding: 2px 8px;
    }

    .marquee-track {
        animation-duration: 8s;
    }

    .layer-panel {
        display: none;
    }

    header {
        padding: 0 12px;
    }

    .mobile-toggle {
        display: flex !important;
    }



    .footer-left strong {
        display: none;
    }

    .user-chip {
        display: none;
    }

    .logout-btn span {
        max-width: 170px;
    }

}

@media (max-width: 480px) {
    .footer-center {
        display: none;
    }

    footer {
        padding: 0 12px;
    }
}

/* Mobile center toggle */
.mobile-toggle {
    display: none;
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    background: linear-gradient(135deg, var(--primary), #4f8ef7);
    border: none;
    border-radius: 50px;
    padding: 8px 16px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(26, 115, 232, 0.5);
    font-family: 'Inter', sans-serif;
    gap: 8px;
    align-items: center;
}



/* Ẩn logo cesium ở góc dưới bên trái */
.cesium-widget-credits {
    display: none !important;
}



/* Start Compass trong 3d map */
.cesium-compass {
    position: absolute;
    top: 80px;
    right: 10px;
    width: 125px;
    height: 125px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    z-index: 1000;
}

.out-ring-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(38, 38, 38, 0.75);
}

.out-ring,
.gyro,
.rotation_marker {
    position: absolute;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
}

.out-ring {
    transition: transform 0.3s ease;
}

.gyro-active {
    opacity: 0.8;
}

.rotation_marker {
    pointer-events: none;
}

/* End Compass trong 3d map */

/* Start convert tọa độ */
.convert-panel {
    position: absolute;
    top: 80px;
    left: 80px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    width: 380px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
    max-height: calc(100vh - 180px);
    /* Trừ header (64px) + footer (42px) + padding */

}


.convert-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, #1a73e8, #4f8ef7);
    border-radius: 8px 8px 0 0;
    margin: -20px -20px 15px -20px;
}

.convert-panel .panel-title {
    color: white;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.convert-panel .panel-close {
    width: auto;
    /* ghi đè width: 100% từ .convert-panel button */
    margin-top: 0;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.convert-panel .panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
}


.convert-panel .section {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.convert-panel .section h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 14px;
}

.convert-panel label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 3px;
}

.convert-panel input,
.convert-panel select {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.convert-panel input:focus,
.convert-panel select:focus {
    outline: none;
    border-color: #3498db;
}

.convert-panel button {
    width: 100%;
    padding: 10px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 5px;
}

.convert-panel button:hover {
    background: #2980b9;
}

.convert-panel button.secondary {
    background: #27ae60;
}

.convert-panel button.secondary:hover {
    background: #229954;
}

.result-box {
    background: #e8f6ff;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 13px;
    color: #2c3e50;
}


.tab-buttons {
    display: flex;
    margin-bottom: 15px;
}

.tab-buttons button {
    flex: 1;
    padding: 8px;
    border: none;
    background: #839da3;
    cursor: pointer;
    font-size: 12px;
    margin-right: 2px;
}

.tab-buttons button.active {
    background: #3498db;
    color: white;
}

.tab-buttons button:first-child {
    border-radius: 5px 0 0 5px;
}

.tab-buttons button:last-child {
    border-radius: 0 5px 5px 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.convert-panel::-webkit-scrollbar {
    width: 6px;
}

.convert-panel::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.convert-panel::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 3px;
}

.convert-panel::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}


.panel-close-btn:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

/* End convert tọa độ */

/* ===================== MEASURE PANEL ===================== */
.measure-panel {
    position: absolute;
    top: 60px;
    right: 70px;
    width: 280px;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    z-index: 1000;
    display: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
    animation: slideIn 0.2s ease;
}

.measure-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, #1a73e8, #4f8ef7);
    border-radius: 12px 12px 0 0;
}

.measure-panel .panel-title {
    color: white;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.measure-panel .panel-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.measure-panel .panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.measure-panel .panel-body {
    padding: 14px;
}

.measure-note {
    font-size: 12px;
    color: #888;
    background: #f0f7ff;
    border-left: 3px solid #1a73e8;
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 12px;
}

.measure-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.measure-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 14px;
    border: 1.5px solid #e3eaf5;
    border-radius: 8px;
    background: #f8faff;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.measure-btn i {
    font-size: 16px;
    color: #1a73e8;
    margin-bottom: 2px;
}

.measure-btn span {
    font-size: 13px;
    font-weight: 600;
    color: #1e2a3a;
}

.measure-btn small {
    font-size: 11px;
    color: #888;
    line-height: 1.3;
}

.measure-btn:hover {
    background: #e8f0fe;
    border-color: #1a73e8;
    transform: translateX(2px);
}

.measure-btn.active {
    background: #1a73e8;
    border-color: #1a73e8;
}

.measure-btn.active i,
.measure-btn.active span,
.measure-btn.active small {
    color: white;
}

.measure-divider {
    height: 1px;
    background: #eee;
    margin: 12px 0;
}

.measure-clear-btn {
    width: 100%;
    padding: 9px;
    background: #fff0f0;
    border: 1.5px solid #e74c3c;
    color: #e74c3c;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.measure-clear-btn:hover {
    background: #e74c3c;
    color: white;
}

.measure-results {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.measure-result-item {
    background: #f0f7ff;
    border-radius: 8px;
    padding: 8px 12px;
    border-left: 3px solid #1a73e8;
    font-size: 12px;
    color: #1e2a3a;
}

.measure-result-item .result-title {
    font-weight: 700;
    margin-bottom: 3px;
    color: #1a73e8;
}

.measure-result-item .result-value {
    font-size: 14px;
    font-weight: 600;
    color: #e74c3c;
}

/* Tooltip kết quả đo trên bản đồ: thêm outline để dễ đọc trên mọi nền */
.ol-tooltip,
.ol-tooltip-measure,
.ol-tooltip-static {
    font-weight: 700;
    color: #ffffff;
    -webkit-text-stroke: 0.65px rgba(0, 0, 0, 0.85);
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.85),
        1px -1px 0 rgba(0, 0, 0, 0.85),
        -1px 1px 0 rgba(0, 0, 0, 0.85),
        1px 1px 0 rgba(0, 0, 0, 0.85),
        0 0 8px rgba(0, 0, 0, 0.4);
}

/* ===================== DRAW META MODAL ===================== */
.draw-meta-modal {
    position: absolute;
    inset: 0;
    z-index: 2100;
}

.draw-meta-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.58);
    backdrop-filter: blur(2px);
}

.draw-meta-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(460px, calc(100vw - 30px));
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.34);
    animation: drawMetaIn 0.2s ease;
}

@keyframes drawMetaIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.draw-meta-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: linear-gradient(135deg, #1a73e8, #4f8ef7);
}

.draw-meta-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.draw-meta-close {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-size: 14px;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    transition: background 0.2s;
}

.draw-meta-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.draw-meta-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.draw-meta-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.draw-meta-field label {
    color: #334155;
    font-size: 12px;
    font-weight: 600;
}

.draw-meta-field input,
.draw-meta-field textarea,
.draw-meta-field select {
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 10px;
    font-size: 13px;
    color: #0f172a;
    background: #f8fbff;
    font-family: 'Inter', sans-serif;
}

.draw-meta-field input:focus,
.draw-meta-field textarea:focus,
.draw-meta-field select:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.14);
    background: #ffffff;
}

.draw-meta-field input[type="color"] {
    padding: 4px;
    height: 38px;
}

.draw-meta-field textarea {
    resize: vertical;
    min-height: 90px;
    max-height: 220px;
}

.draw-meta-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 14px 14px;
}

.draw-meta-btn {
    border: none;
    border-radius: 8px;
    padding: 9px 13px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.draw-meta-btn.secondary {
    color: #475569;
    background: #edf2f7;
}

.draw-meta-btn.secondary:hover {
    background: #dde5ef;
}

.draw-meta-btn.primary {
    color: #fff;
    background: linear-gradient(135deg, #1a73e8, #4f8ef7);
}

.draw-meta-btn.primary:hover {
    filter: brightness(1.05);
}

.draw-meta-symbol-block {
    border: 1px solid #e4ebf5;
    border-radius: 10px;
    padding: 10px;
    background: #f8fbff;
}

.draw-meta-symbol-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 700;
}

.draw-meta-symbol-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.draw-meta-inline-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.draw-meta-inline-grid.three-col {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 560px) {

    .draw-meta-inline-grid,
    .draw-meta-inline-grid.three-col {
        grid-template-columns: 1fr;
    }
}

/* start routing */
/* ========== ROUTE PANEL ========== */
.route-api-key-input {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #e3eaf5;
    border-radius: 8px;
    font-size: 12px;
    background: #f8faff;
    color: #1e2a3a;
    outline: none;
    margin-bottom: 10px;
    font-family: 'Inter', sans-serif;
}

.route-api-key-input:focus {
    border-color: #1a73e8;
}

.route-profile-select {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #e3eaf5;
    border-radius: 8px;
    background: #f8faff;
    color: #1e2a3a;
    font-size: 12px;
    margin-bottom: 10px;
    outline: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.route-point-group {
    margin-bottom: 8px;
}

.route-point-label {
    font-size: 11px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 5px;
}

.route-badge {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.start-badge {
    background: #27ae60;
}

.end-badge {
    background: #e74c3c;
}

.route-input-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.route-input {
    flex: 1;
    padding: 8px 10px;
    border: 1.5px solid #e3eaf5;
    border-radius: 8px;
    font-size: 12px;
    background: #f8faff;
    color: #1e2a3a;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.route-input:focus {
    border-color: #1a73e8;
}

.route-pick-btn {
    width: 36px;
    height: 36px;
    background: #f0f7ff;
    border: 1.5px solid #1a73e8;
    border-radius: 8px;
    color: #1a73e8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.route-pick-btn:hover,
.route-pick-btn.active {
    background: #1a73e8;
    color: white;
}

.route-swap-btn {
    width: 100%;
    padding: 7px;
    background: #f0f4ff;
    border: 1.5px solid #c5d5f5;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    color: #1a73e8;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 10px;
    font-family: 'Inter', sans-serif;
}

.route-swap-btn:hover {
    background: #1a73e8;
    color: white;
}

.route-calc-btn {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #1a73e8, #4f8ef7);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

.route-calc-btn:hover {
    background: linear-gradient(135deg, #1557b0, #1a73e8);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.4);
}

.route-result-box {
    background: #f0f7ff;
    border-radius: 8px;
    padding: 12px;
    border-left: 3px solid #1a73e8;
    margin-bottom: 8px;
}

.route-result-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #1e2a3a;
    margin-bottom: 5px;
}

.route-result-row:last-child {
    margin-bottom: 0;
}

.route-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #1a73e8;
    padding: 12px;
    background: #f0f7ff;
    border-radius: 8px;
}

.route-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: #e74c3c;
    padding: 12px;
    background: #fff0f0;
    border-radius: 8px;
    border-left: 3px solid #e74c3c;
    line-height: 1.5;
}

.route-steps-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: #e8f0fe;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    color: #1a73e8;
    font-weight: 600;
    margin-top: 6px;
    user-select: none;
    transition: background 0.2s;
}

.route-steps-toggle:hover {
    background: #d0e4fc;
}

.route-steps {
    margin-top: 4px;
    max-height: 220px;
    overflow-y: auto;
    background: #fafbff;
    border-radius: 8px;
    border: 1px solid #e3eaf5;
}

.route-step {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 11px;
    color: #444;
}

.route-step:last-child {
    border-bottom: none;
}

.step-num {
    background: #1a73e8;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.step-text {
    flex: 1;
    line-height: 1.5;
}

.step-dist {
    color: #1a73e8;
    font-weight: 600;
    white-space: nowrap;
    font-size: 10px;
}

/* end routing */

/* start search header */
/* ========== GEOCODER / SEARCH ========== */
.header-search {
    position: relative;
    flex: 0 1 340px;
    min-width: 0;
}

.search-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 0 14px;
    gap: 8px;
    transition: border-color 0.2s, background 0.2s;
    height: 38px;
}

.search-wrapper:focus-within {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
}

.search-icon {
    color: var(--text-muted);
    font-size: 13px;
    flex-shrink: 0;
}

.geocoder-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-light);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    min-width: 0;
}

.geocoder-input::placeholder {
    color: var(--text-muted);
}

.search-clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    font-size: 12px;
    flex-shrink: 0;
    transition: color 0.2s;
}

.search-clear-btn:hover {
    color: var(--text-light);
}

.geocoder-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(30, 42, 58, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    z-index: 2000;
    display: none;
    animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.geocoder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.geocoder-item:last-child {
    border-bottom: none;
}

.geocoder-item:hover,
.geocoder-item.active {
    background: rgba(26, 115, 232, 0.2);
}

.geocoder-item-icon {
    color: var(--primary);
    font-size: 13px;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}

.geocoder-item-text {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.geocoder-no-result {
    padding: 14px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.geocoder-loading {
    padding: 14px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.geocoder-loading i {
    animation: spin 0.8s linear infinite;
}

@media (max-width: 768px) {
    .header-search {
        display: block;
        flex: 1 1 100%;
        order: 3;
        margin-top: 8px;
    }

    header {
        height: auto;
        min-height: 64px;
        padding: 8px 12px;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .header-left {
        flex: 1 1 auto;
        min-width: 0;
    }

    .header-user {
        margin-left: auto;
    }

    .geocoder-input {
        font-size: 12px;
    }
}

/* end search header */

/* ========== WMS FEATURE INFO POPUP ========== */
.wms-popup {
    position: absolute;
    background: rgba(30, 42, 58, 0.97);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(26, 115, 232, 0.4);
    border-radius: 10px;
    padding: 0;
    z-index: 2000;
    min-width: 220px;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    animation: fadeInUp 0.18s ease;
    pointer-events: auto;
}

.wms-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.wms-popup-title {
    font-size: 13px;
    font-weight: 600;
    color: #60a5fa;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wms-popup-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s;
}

.wms-popup-close:hover {
    color: #e74c3c;
}

/* .wms-popup-body {
    padding: 10px 14px 12px;
    font-size: 12px;
    color: var(--text-light);
    max-height: 240px;
    overflow-y: auto;
} */

.wms-popup-body {
    padding: 10px 14px 12px;
    font-size: 12px;
    color: var(--text-light);
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
}


.wms-popup-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.wms-popup-tab {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11px;
    line-height: 1.2;
    cursor: pointer;
}

.wms-popup-tab:hover {
    border-color: rgba(96, 165, 250, 0.65);
    color: #e2e8f0;
}

.wms-popup-tab.active {
    background: rgba(26, 115, 232, 0.32);
    color: #ffffff;
    border-color: rgba(96, 165, 250, 0.8);
}

.wms-popup-tab-subtitle {
    color: #93c5fd;
    font-size: 11px;
    margin-bottom: 7px;
    word-break: break-word;
}

.wms-popup-tab-panel {
    display: block;
}

.wms-popup-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.wms-popup-row:last-child {
    border-bottom: none;
}

.wms-popup-key {
    color: #94a3b8;
    flex-shrink: 0;
    font-weight: 500;
}

.wms-popup-val {
    color: #e2e8f0;
    text-align: right;
    word-break: break-all;
}

.wms-popup-loading {
    color: #60a5fa;
    text-align: center;
    padding: 10px 0;
}

.wms-popup-error {
    color: #f87171;
    font-size: 12px;
    text-align: center;
    padding: 8px 0;
}

#infoToggleBtn.active {
    background: rgba(26, 115, 232, 0.35);
    color: #fff;
}

#editToggleBtn.active {
    background: rgba(251, 188, 4, 0.35);
    color: #fff7d1;
    border-color: rgba(251, 188, 4, 0.7);
}


.wms-popup-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.wms-popup-nav-btn {
    border: 1px solid rgba(96, 165, 250, 0.45);
    background: rgba(30, 64, 175, 0.25);
    color: #dbeafe;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.wms-popup-nav-btn:hover {
    background: rgba(59, 130, 246, 0.35);
    border-color: rgba(147, 197, 253, 0.75);
}

.wms-popup-nav-indicator {
    font-size: 11px;
    color: #93c5fd;
    font-weight: 600;
    min-width: 36px;
    text-align: center;
}

.wms-popup-body::-webkit-scrollbar {
    width: 6px;
}

.wms-popup-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.wms-popup-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.wms-popup-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* End WMS FEATURE INFO POPUP */

/* Toolbar Toggle Button */
.toolbar-toggle-btn {
    position: absolute;
    left: 65px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    width: 20px;
    height: 48px;
    background: rgba(30, 42, 58, 0.92);
    border: 1px solid var(--glass-border);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.25s;
    opacity: 0.6;
}

.toolbar-toggle-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.map-toolbar.hidden {
    transform: translateX(-110%) translateY(-50%);
    opacity: 0;
    pointer-events: none;
}

.toolbar-toggle-btn.collapsed {
    left: 8px;
}




/* ========== CHART PANEL ========== */
.chart-shape-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chart-shape-btn:hover {
    background: rgba(26, 115, 232, 0.2);
    border-color: rgba(26, 115, 232, 0.5);
    color: #e2e8f0;
}

.chart-shape-btn.active {
    background: rgba(26, 115, 232, 0.3);
    border-color: #1a73e8;
    color: #60a5fa;
    font-weight: 600;
}

#wfsChart {
    border-radius: 8px;
}

/* ========== END CHART PANEL ========== */


/* ========== WFS DATA TABLE PANEL ========== */
.wfs-th {
    padding: 8px 10px;
    text-align: left;
    color: #93c5fd;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    user-select: none;
}

.wfs-tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.15s;
    cursor: pointer;
}

.wfs-tr:hover {
    background: rgba(26, 115, 232, 0.18) !important;
}

.wfs-tr.highlighted {
    background: rgba(26, 115, 232, 0.35) !important;
    outline: 1px solid rgba(26, 115, 232, 0.8);
}

.wfs-td {
    padding: 6px 10px;
    color: #cbd5e1;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.wfs-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.wfs-zoom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    border: 1px solid rgba(26, 115, 232, 0.4);
    background: rgba(26, 115, 232, 0.1);
    color: #60a5fa;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.wfs-zoom-btn:hover {
    background: rgba(26, 115, 232, 0.4);
    color: white;
    border-color: #1a73e8;
}

/* Pagination buttons */
.wfs-page-btn {
    min-width: 28px;
    height: 26px;
    padding: 0 6px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}

.wfs-page-btn:hover {
    background: rgba(26, 115, 232, 0.25);
    border-color: rgba(26, 115, 232, 0.5);
    color: #60a5fa;
}

.wfs-page-btn.active {
    background: rgba(26, 115, 232, 0.4);
    border-color: #1a73e8;
    color: white;
    font-weight: 600;
}

/* Scrollbar cho bảng */
#wfsTablePanel ::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

#wfsTablePanel ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

#wfsTablePanel ::-webkit-scrollbar-thumb {
    background: rgba(26, 115, 232, 0.4);
    border-radius: 3px;
}

#wfsTablePanel ::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 115, 232, 0.7);
}

/* ========== END WFS DATA TABLE PANEL ========== */


/* ===================== STREET VIEW / MAPILLARY ===================== */
#streetViewToggleBtn.active {
    background: rgba(26, 115, 232, 0.25);
    color: #60a5fa;
    border-color: rgba(26, 115, 232, 0.5);
}

.mly-viewer {
    width: 100% !important;
    height: 100% !important;
}

#streetViewPanel {
    transition: opacity 0.2s ease;
}

.sv-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
    gap: 10px;
    font-size: 13px;
}

.sv-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ef4444;
    gap: 10px;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}


/* Ẩn attribution của Mapillary */
.mapillary-attribution-container {
    display: none !important;
}

/* ===================== END STREET VIEW ===================== */


/* ===================== LEGEND PANEL ===================== */
.legend-dropdown-group {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
}


.legend-dropdown-content {
    padding: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    animation: legendFadeIn 0.25s ease;
}

@keyframes legendFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.legend-img-wrap {
    width: 100%;
    text-align: center;
}

.legend-img {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* cursor: zoom-in; */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}



/* ===================== END LEGEND PANEL ===================== */

/* ========== TOURIST PANEL ========== */

/* ========== TOURIST PANEL ========== */
/* ========== TOURIST PANEL STYLE (CLEAN) ========== */
#touristPanel {
    /* 1. Vị trí và Kích thước */
    position: fixed;
    top: 200px;
    left: 100px;
    width: 250px;
    max-height: 60vh;
    /* Giới hạn chiều cao tối đa trên màn hình lớn */
    z-index: 1001;
    /* Nằm trên các layer bản đồ */

    /* 2. Hiển thị */
    flex-direction: column;
    /* Chia Header và Body theo chiều dọc */

    /* 3. Giao diện */
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: none;
}

#touristPanel.visible {
    display: flex;
    /* Hiện khi có class .visible */
}

/* Header cố định */
#touristPanel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #1a73e8, #1557b0);
    color: white;
    flex-shrink: 0;
    /* Không cho phép header bị co lại */
}

#touristPanel .panel-title {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

#touristPanel .panel-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#touristPanel .panel-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Body có thanh cuộn */
#touristPanel .panel-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;

    flex: 1;
    /* Chiếm toàn bộ không gian còn lại */
    overflow-y: auto;
    /* QUAN TRỌNG: Hiện thanh cuộn tại đây */
    min-height: 0;
    /* QUAN TRỌNG: Ép flex con phải cuộn */

    background: #ffffff;
}

/* Tùy chỉnh thanh cuộn cho mượt và nhỏ gọn */
#touristPanel .panel-body::-webkit-scrollbar {
    width: 6px;
}

#touristPanel .panel-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

#touristPanel .panel-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

#touristPanel .panel-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Các thành phần nội dung */
.tourist-note {
    font-size: 12px;
    line-height: 1.5;
    color: #475569;
    background: #eff6ff;
    border-left: 4px solid #1a73e8;
    padding: 10px;
    border-radius: 4px;
}

.tourist-province {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.tourist-province summary {
    padding: 12px;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tourist-province summary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    transition: transform 0.2s;
}

.tourist-province[open] summary::after {
    transform: rotate(180deg);
}

.tourist-links {
    padding: 0 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tourist-link {
    font-size: 12px;
    color: #334155;
    text-decoration: none;
    padding: 8px 10px;
    background: rgb(192, 244, 184);
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: all 0.2s;
}

.tourist-link:hover {
    background: #f1f5f9;
    color: #1a73e8;
    border-color: #1a73e8;
    padding-left: 14px;
    /* Hiệu ứng trượt nhẹ khi hover */
}


/* End tour list panel */

/* point HN popup info */
/* Container chính */
.tourist-popup-container {
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

/* Phần Ảnh và Tiêu đề đè lên ảnh */
.tourist-popup-image {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.tourist-popup-title-overlay {
    width: 100%;
    padding: 20px 15px 10px 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.tourist-popup-header-simple {
    padding: 15px;
    font-weight: 700;
    font-size: 18px;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
}

/* Nội dung bên dưới */
.tourist-popup-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Các dòng thông tin địa chỉ, giờ... */
.tourist-info-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #475569;
}

.tourist-info-item i {
    color: #944d2c;
    /* Màu nâu đỏ giống đền Quán Thánh */
    width: 16px;
    margin-top: 2px;
}

/* Audio Player */
.tourist-popup-audio audio {
    width: 100%;
    height: 32px;
    margin: 5px 0;
}

/* Mô tả */
.tourist-popup-description {
    font-size: 13px;
    line-height: 1.6;
    color: #334155;
    margin-top: 5px;
    border-top: 1px dashed #e2e8f0;
    padding-top: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    /* Giới hạn số dòng */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Nút bấm hành động */
.tourist-popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.tourist-popup-actions button {
    flex: 1;
    padding: 8px 5px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-explore {
    background: #7c2d12;
    /* Màu nâu đậm */
    color: #fff;
}

.btn-explore:hover {
    background: #9a3412;
}

.btn-direction {
    background: #065f46;
    /* Màu xanh lá chỉ đường */
    color: #fff;
}

.btn-direction:hover {
    background: #047857;
}


/* Container chứa link hành trình */
.tourist-popup-tourname {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #e2e8f0;
}

/* Style cho thẻ hành trình */
.tourist-popup-tourname a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: #fef2f2;
    /* Màu nền đỏ/nâu cực nhạt */
    color: #991b1b !important;
    /* Màu đỏ đô sang trọng */
    border: 1px solid #fee2e2;
    border-radius: 20px;
    /* Bo tròn dạng viên thuốc */
    font-size: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
}

/* Thêm icon trước tên hành trình bằng CSS */
.tourist-popup-tourname a::before {
    content: "\f558";
    /* Icon map-signs trong FontAwesome */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

/* Hiệu ứng khi di chuột vào */
.tourist-popup-tourname a:hover {
    background-color: #fee2e2;
    border-color: #fca5a5;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}


/* point HN  */

/* list point */

.tour-points-list {
    margin: -2px 0 6px 12px;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tour-point-item {
    width: 100%;
    text-align: left;
    font-size: 11px;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
}

.tour-point-item:hover {
    border-color: #1a73e8;
    background: #eff6ff;
    color: #1a73e8;
}

/* list point */

/* tối ưu lộ trình */
/* ===== TOUR OPTIMIZE PANEL (standalone, not measure-panel) ===== */
.tour-optimize-panel {
    display: none;
    position: absolute;
    top: 140px;
    right: 390px;
    width: 340px;
    z-index: 1150;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(165deg, rgba(10, 23, 43, 0.96), rgba(20, 46, 80, 0.94));
    border: 1px solid rgba(125, 211, 252, 0.28);
    box-shadow: 0 14px 36px rgba(2, 8, 20, 0.45);
    backdrop-filter: blur(12px);
}

.tour-optimize-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.03);
}

.tour-optimize-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #e2f3ff;
    letter-spacing: 0.2px;
}

.tour-optimize-title i {
    color: #38bdf8;
}

.tour-optimize-close {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tour-optimize-close:hover {
    background: rgba(248, 113, 113, 0.2);
    color: #fecaca;
}

.tour-optimize-body {
    padding: 12px;
}

.tour-optimize-note {
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.55;
    color: #cfe6ff;
    background: rgba(56, 189, 248, 0.08);
    border: 1px dashed rgba(56, 189, 248, 0.28);
    border-radius: 10px;
    padding: 8px 10px;
}

.tour-optimize-results {
    max-height: 220px;
    overflow: auto;
    margin-bottom: 10px;
    padding-right: 4px;
}

.tour-optimize-results::-webkit-scrollbar {
    width: 6px;
}

.tour-optimize-results::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 999px;
}

.tour-optimize-actions {
    display: flex;
    gap: 8px;
}

.tour-optimize-btn {
    flex: 1;
    border: 1px solid rgba(59, 130, 246, 0.45);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(14, 165, 233, 0.18));
    color: #e0f2fe;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tour-optimize-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(125, 211, 252, 0.65);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(14, 165, 233, 0.3));
}

.tour-optimize-btn.danger {
    border-color: rgba(248, 113, 113, 0.5);
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.28), rgba(248, 113, 113, 0.2));
    color: #fee2e2;
}

.tour-optimize-btn.danger:hover {
    border-color: rgba(252, 165, 165, 0.75);
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.42), rgba(248, 113, 113, 0.32));
}

@media (max-width: 768px) {
    .tour-optimize-panel {
        right: 10px;
        left: 10px;
        width: auto;
        top: 120px;
    }


}

/* tối ưu lộ trình */

/* popup giới thiệu */
/* ===== INTRO POPUP ===== */
.travel-intro-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 10%, rgba(26, 115, 232, 0.18), rgba(15, 23, 42, 0.78) 55%);
    backdrop-filter: blur(3px);
    padding: 20px;
    /* height: 30%;
    max-height: 40%; */
    z-index: 10000;
    /* top:80px */
}

.travel-intro-overlay.is-visible {
    display: flex;
    animation: introFadeIn 0.25s ease;
}

.travel-intro-modal {
    position: relative;
    width: min(820px, 100%);
    max-height: calc(100vh - 120px);
    overflow: auto;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.96));
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.45);
    color: #e2e8f0;
    padding: 22px 22px 18px;
}

.travel-intro-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(30, 41, 59, 0.7);
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.travel-intro-close:hover {
    color: #fff;
    border-color: rgba(248, 113, 113, 0.6);
    background: rgba(127, 29, 29, 0.35);
}

.travel-intro-head {
    margin-bottom: 12px;
    padding-right: 38px;
}

.travel-intro-badge {
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #bfdbfe;
    border: 1px solid rgba(96, 165, 250, 0.45);
    background: rgba(30, 64, 175, 0.28);
}

.travel-intro-head h2 {
    font-size: 22px;
    line-height: 1.3;
    color: #f8fafc;
}

.travel-intro-body p {
    font-size: 14px;
    line-height: 1.65;
    color: #dbeafe;
    margin-bottom: 10px;
}

.travel-intro-body ul {
    margin: 6px 0 10px 18px;
    display: grid;
    gap: 8px;
}

.travel-intro-body li {
    font-size: 14px;
    line-height: 1.65;
    color: #cbd5e1;
}

.travel-intro-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.travel-intro-register,
.travel-intro-start {
    border-radius: 10px;
    border: none;
    cursor: pointer;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.travel-intro-register {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #f0fdf4;
    border: 1px solid rgba(134, 239, 172, 0.45);
}

.travel-intro-register:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.travel-intro-start {
    background: rgba(148, 163, 184, 0.15);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.travel-intro-start:hover {
    background: rgba(148, 163, 184, 0.25);
}

@keyframes introFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .travel-intro-overlay {
        padding: 10px;
    }

    .travel-intro-modal {
        max-height: calc(100vh - 125px);
        padding: 16px 14px 14px;
        border-radius: 12px;
    }

    .travel-intro-head h2 {
        font-size: 18px;
    }

    .travel-intro-body p,
    .travel-intro-body li {
        font-size: 13px;
    }

    .travel-intro-actions {
        flex-direction: column;
    }

    .travel-intro-register,
    .travel-intro-start {
        width: 100%;
        text-align: center;
    }
}

/* ===== END INTRO POPUP ===== */
/* popup giới thiệu */