* {
    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 thanh công cụ */
.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);
}

.tool-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.5);
}




/* ========== 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);
    }
}


.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;
}

/* tách icon và text */


#measureQuickPanel .quick-measure-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    min-width: 16px;
}

#measureQuickPanel .quick-measure-text {
    display: inline-block;
    white-space: nowrap;
}

#drawQuickPanel .quick-draw-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    min-width: 16px;
}

#drawQuickPanel .quick-draw-text {
    display: inline-block;
    white-space: nowrap;
}

.gps-track-panel {
    position: absolute;
    left: 74px;
    top: 360px;
    width: min(320px, calc(100vw - 24px));
    z-index: 2060;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.gps-track-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(26, 115, 232, 0.95), rgba(79, 142, 247, 0.75));
    border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

.gps-track-panel__title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.gps-track-panel__close {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.35);
    color: #e2e8f0;
    cursor: pointer;
}

.gps-track-panel__close:hover {
    background: rgba(15, 23, 42, 0.6);
}

.gps-track-panel__body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gps-track-status {
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    padding: 8px 10px;
    color: #cbd5e1;
    font-size: 12px;
    background: rgba(30, 41, 59, 0.5);
}

.gps-track-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.gps-track-stat-card {
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.5);
    padding: 8px 6px;
    text-align: center;
}

.gps-track-stat-label {
    color: #94a3b8;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.gps-track-stat-value {
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
    margin-top: 4px;
}

.gps-track-mode-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gps-track-mode-label {
    color: #94a3b8;
    font-size: 11px;
}

.gps-track-mode-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    height: 22px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #0f172a;
    background: #22c55e;
}

.gps-track-mode-badge.fake {
    background: #f59e0b;
}

.gps-track-actions,
.gps-track-dev-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.gps-track-dev-row {
    grid-template-columns: 1fr;
}

.gps-track-btn {
    border: 1px solid transparent;
    border-radius: 8px;
    height: 34px;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(30, 41, 59, 0.6);
}

.gps-track-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.gps-track-btn.primary {
    background: rgba(26, 115, 232, 0.25);
    border-color: rgba(59, 130, 246, 0.55);
}

.gps-track-btn.warning {
    background: rgba(245, 158, 11, 0.22);
    border-color: rgba(245, 158, 11, 0.55);
}

.gps-track-btn.success {
    background: rgba(16, 185, 129, 0.22);
    border-color: rgba(16, 185, 129, 0.55);
}

.gps-track-btn.ghost {
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.55);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* tách icon và text */
/* ========== 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;
    }

    #measureQuickPanel .quick-measure-action {
        justify-content: center;
        padding: 8px;
        gap: 0;
    }

    #measureQuickPanel .quick-measure-text {
        display: none;
    }

    #measureQuickPanel .quick-measure-icon {
        width: auto;
        min-width: 0;
    }

    #drawQuickPanel .quick-draw-action {
        justify-content: center;
        padding: 8px;
        gap: 0;
    }

    #drawQuickPanel .quick-draw-text {
        display: none;
    }

    #drawQuickPanel .quick-draw-icon {
        width: auto;
        min-width: 0;
    }

    .gps-track-panel {
        left: 12px;
        right: 12px;
        width: auto;
        top: auto;
        bottom: 84px;
    }

    .gps-track-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

}

@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-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 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: fixed;
    inset: 0;
    z-index: 300000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.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;
} */

.draw-meta-dialog {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: min(460px, 100%);
    max-height: calc(100dvh - 32px);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    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: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.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-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    min-height: 0;
}

.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-image-drop {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #64748b;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}

.draw-image-drop:hover {
    border-color: #1a73e8;
    background: rgba(26, 115, 232, 0.04);
}

.draw-image-drop.dragover {
    border-color: #1a73e8;
    background: rgba(26, 115, 232, 0.08);
}

.draw-image-drop i {
    font-size: 24px;
    color: #94a3b8;
    margin-bottom: 2px;
}

.draw-image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.draw-image-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.draw-image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.draw-image-preview-item .draw-image-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.draw-image-preview-item .draw-image-remove:hover {
    background: #ef4444;
}

.draw-image-existing {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.draw-image-existing-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.draw-image-existing-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.draw-image-existing-item .draw-image-remove-existing {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.draw-image-existing-item .draw-image-remove-existing:hover {
    background: #ef4444;
}

.global-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    animation: toastFadeIn 0.25s ease-out;
    white-space: nowrap;
}

.global-toast.success {
    background: #065f46;
    color: #a7f3d0;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.global-toast.error {
    background: #7f1d1d;
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.global-toast.loading {
    background: #1e293b;
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.global-toast .toast-icon {
    font-size: 14px;
}

.global-toast .toast-icon.spin {
    animation: toastSpin 1s linear infinite;
}

@keyframes toastFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.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-modal {
        align-items: flex-start;
        padding: 10px;
    }

    .draw-meta-dialog {
        width: 100%;
        max-height: calc(100dvh - 20px);
    }

    .draw-meta-body {
        padding: 12px;
    }

    .draw-meta-actions {
        padding: 0 12px 12px;
    }

    .draw-meta-inline-grid,
    .draw-meta-inline-grid.three-col {
        grid-template-columns: 1fr;
    }
}

/* start routing */
/* ========== ROUTE PANEL ========== */
.route-panel {
    position: absolute;
    top: 120px;
    right: 70px;
    width: min(310px, calc(100vw - 24px));
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 1300;
    overflow: hidden;
}

.route-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.24);
    background: linear-gradient(135deg, rgba(26, 115, 232, 0.9), rgba(59, 130, 246, 0.72));
}

.route-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

.route-panel-close {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.route-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.route-panel-body {
    padding: 14px;
}

.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 {
    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-divider {
    height: 1px;
    background: rgba(148, 163, 184, 0.25);
    margin: 12px 0;
}

.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-clear-btn {
    width: 100%;
    margin-top: 6px;
    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;
}

.route-clear-btn:hover {
    background: #e74c3c;
    color: #ffffff;
}

.route-results {
    margin-top: 10px;
}

.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;
}

@media (max-width: 992px) {
    .route-panel {
        right: 12px;
        top: 96px;
    }
}

@media (max-width: 768px) {
    .route-panel {
        left: 12px;
        right: 12px;
        top: 84px;
        width: auto;
        max-height: calc(100vh - 150px);
        overflow-y: auto;
    }

    .route-panel-title {
        font-size: 13px;
    }

    .route-panel-body {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .route-panel {
        top: 78px;
        border-radius: 10px;
    }

    .route-panel-header {
        padding: 10px 12px;
    }
}

/* end routing */

/* start search header */
/* ========== GEOCODER / SEARCH ========== */
.header-search {
    position: relative;
    flex: 0 1 340px;
    min-width: 0;
}

.mobile-search-btn {
    display: none;
}

.mobile-search-close-btn {
    display: none;
    border: 1px solid rgba(248, 113, 113, 0.45);
    background: rgba(248, 113, 113, 0.16);
    color: #fecaca;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 10px;
    height: 28px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.mobile-search-close-btn:hover {
    background: rgba(248, 113, 113, 0.26);
    border-color: rgba(248, 113, 113, 0.7);
    color: #fee2e2;
}

.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 {
        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;
    }

    .mobile-search-btn {
        display: flex;
    }

    .header-search {
        display: none;
        flex: 1 1 100%;
        order: 3;
        margin-top: 8px;
    }

    .header-search.mobile-visible {
        display: block;
    }

    .search-clear-btn {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: rgba(148, 163, 184, 0.14);
        color: #cbd5e1;
        font-size: 11px;
        padding: 0;
    }



    .mobile-search-close-btn {
        display: inline-flex;
    }
}

/* 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-images {
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 10px;
}

.wms-popup-images-title {
    color: #93c5fd;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wms-popup-images-title i {
    font-size: 11px;
}

.wms-popup-images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.wms-popup-image-btn {
    display: block;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    padding: 0;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.25);
    transition: border-color 0.2s, transform 0.15s;
    cursor: zoom-in;
}

.wms-popup-image-btn:hover {
    border-color: #60a5fa;
    transform: scale(1.05);
}

.wms-popup-image-btn:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.wms-popup-images-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.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;
}



.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-image-viewer {
    position: fixed;
    inset: 0;
    z-index: 3000000;
    display: none;
    align-items: center;
    justify-content: center;
}

.wms-image-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.82);
    backdrop-filter: blur(2px);
}

.wms-image-viewer-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 1040px);
    height: min(86vh, 780px);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.wms-image-viewer-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.wms-image-viewer-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(15, 23, 42, 0.65);
    color: #e2e8f0;
    cursor: pointer;
}

.wms-image-viewer-close:hover {
    background: rgba(30, 41, 59, 0.95);
}

.wms-image-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(15, 23, 42, 0.62);
    color: #e2e8f0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wms-image-viewer-nav.prev {
    left: 12px;
}

.wms-image-viewer-nav.next {
    right: 12px;
}

.wms-image-viewer-nav:hover:not(:disabled) {
    background: rgba(37, 99, 235, 0.48);
    border-color: rgba(147, 197, 253, 0.75);
}

.wms-image-viewer-nav:disabled {
    opacity: 0.45;
    cursor: default;
}

.wms-image-viewer-counter {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

@media (max-width: 768px) {
    .wms-image-viewer-dialog {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: none;
    }

    .wms-image-viewer-nav {
        width: 38px;
        height: 38px;
    }
}

.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;
}




/* ========== 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 ===================== */


.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-panel {
    position: absolute;
    top: 120px;
    right: 70px;
    width: min(340px, calc(100vw - 24px));
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 1300;
}

.legend-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.24);
    background: linear-gradient(135deg, rgba(26, 115, 232, 0.9), rgba(59, 130, 246, 0.72));
}

.legend-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

.legend-panel-close {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.legend-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.legend-panel-body {
    padding: 10px;
}

.legend-panel-content {
    padding: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    animation: legendFadeIn 0.25s ease;
}

.legend-panel-img-wrap {
    width: 100%;
    text-align: center;
}

.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;
}

@media (max-width: 992px) {
    .legend-panel {
        right: 12px;
        top: 96px;
    }
}

@media (max-width: 768px) {
    .legend-panel {
        left: 12px;
        right: 12px;
        top: 84px;
        width: auto;
        max-height: calc(100vh - 150px);
    }

    .legend-panel-title {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .legend-panel {
        top: 78px;
        border-radius: 10px;
    }

    .legend-panel-header {
        padding: 10px 12px;
    }

    .legend-panel-body {
        padding: 8px;
    }
}



/* ===================== END LEGEND PANEL ===================== */

/* popup giới thiệu */
/* ===== INTRO POPUP ===== */
.intro-overlay {
    position: fixed;
    /* đổi từ absolute -> fixed để phủ toàn viewport */
    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;
    z-index: 500000;
    /* cao hơn header/footer và các panel khác */
}

.intro-overlay.is-visible {
    display: flex;
    animation: introFadeIn 0.25s ease;
}

.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;
    z-index: 100001;
}

.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;
}

.intro-close:hover {
    color: #fff;
    border-color: rgba(248, 113, 113, 0.6);
    background: rgba(127, 29, 29, 0.35);
}

.intro-head {
    margin-bottom: 12px;
    padding-right: 38px;
}

.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);
}

.intro-head h2 {
    font-size: 22px;
    line-height: 1.3;
    color: #f8fafc;
}

.intro-body p {
    font-size: 14px;
    line-height: 1.65;
    color: #dbeafe;
    margin-bottom: 10px;
}

.intro-body ul {
    margin: 6px 0 10px 18px;
    display: grid;
    gap: 8px;
}

.intro-body li {
    font-size: 14px;
    line-height: 1.65;
    color: #cbd5e1;
}

.intro-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.intro-register,
.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;
}

.intro-register {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #f0fdf4;
    border: 1px solid rgba(134, 239, 172, 0.45);
}

.intro-register:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.intro-start {
    background: rgba(148, 163, 184, 0.15);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.intro-start:hover {
    background: rgba(148, 163, 184, 0.25);
}

@keyframes introFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .intro-overlay {
        padding: 10px;
    }

    .intro-modal {
        max-height: calc(100vh - 125px);
        padding: 16px 14px 14px;
        border-radius: 12px;
    }

    .intro-head h2 {
        font-size: 18px;
    }

    .intro-body p,
    .intro-body li {
        font-size: 13px;
    }

    .intro-actions {
        flex-direction: column;
    }

    .intro-register,
    .intro-start {
        width: 100%;
        text-align: center;
    }
}

/* ===== END INTRO POPUP ===== */
/* popup giới thiệu */


/* tool vẽ */
.center-tools-bar {
    position: absolute;
    left: 50%;
    top: 10px;
    transform: translateX(-50%);
    z-index: 120;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.86);
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.center-tools-bar .tool-btn:hover {
    transform: translateY(-2px);
}

.draw-export-menu {
    position: relative;
    display: inline-flex;
}

.draw-export-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.98);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    z-index: 1300;
}

.draw-export-dropdown button {
    border: 1px solid rgba(16, 185, 129, 0.32);
    background: rgba(30, 41, 59, 0.6);
    color: #6ee7b7;
    border-radius: 8px;
    padding: 7px 9px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.draw-export-dropdown button:hover {
    background: rgba(16, 185, 129, 0.22);
    color: #d1fae5;
    border-color: rgba(110, 231, 183, 0.72);
}

/* tool vẽ */

/* drawings table panel */
.drawings-table-panel {
    position: absolute;
    top: 120px;
    right: 70px;
    width: min(560px, calc(100vw - 24px));
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.3);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
    z-index: 1300;
    overflow: hidden;
}

.drawings-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    background: linear-gradient(135deg, rgba(26, 115, 232, 0.9), rgba(59, 130, 246, 0.75));
}

.drawings-table-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

.drawings-table-close {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.drawings-table-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.drawings-table-body {
    max-height: 420px;
    overflow: auto;
    padding: 10px;
}

.drawings-table-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.drawings-table-refresh-btn {
    margin: 0;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(26, 115, 232, 0.45);
    background: rgba(30, 41, 59, 0.55);
    color: #60a5fa;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.drawings-table-refresh-btn:hover {
    background: rgba(26, 115, 232, 0.28);
    color: #dbeafe;
    border-color: rgba(96, 165, 250, 0.75);
}

.drawings-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
}

.drawings-table-grid {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
}

.drawings-table-grid thead tr {
    background: rgba(30, 41, 59, 0.8);
    color: #e2e8f0;
    font-size: 12px;
    text-align: left;
}

.drawings-table-grid th,
.drawings-table-grid td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    font-size: 12px;
    color: #e2e8f0;
    vertical-align: top;
}

.drawings-table-grid tbody tr:hover {
    background: rgba(26, 115, 232, 0.15);
}

.drawings-table-empty {
    padding: 12px !important;
    text-align: center;
    color: #94a3b8 !important;
}

.drawings-table-body::-webkit-scrollbar {
    width: 6px;
}

.drawings-table-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.drawings-table-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.drawings-table-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

@media (max-width: 992px) {
    .drawings-table-panel {
        right: 12px;
        top: 96px;
        width: min(640px, calc(100vw - 24px));
    }
}

@media (max-width: 768px) {
    .drawings-table-panel {
        left: 12px;
        right: 12px;
        top: 84px;
        width: auto;
        max-height: calc(100vh - 150px);
    }

    .drawings-table-body {
        max-height: calc(100vh - 220px);
        padding: 8px;
    }

    .drawings-table-title {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .drawings-table-panel {
        top: 78px;
        border-radius: 10px;
    }

    .drawings-table-header {
        padding: 10px 12px;
    }

    .drawings-table-grid {
        min-width: 460px;
    }

    .drawings-table-grid th,
    .drawings-table-grid td {
        padding: 7px 8px;
        font-size: 11px;
    }
}

/* end drawings table panel */

@media (max-width: 768px) {
    .header-user {
        margin-left: auto;
        display: inline-flex;
        align-items: center;
        flex-wrap: nowrap;
        white-space: nowrap;
        gap: 6px;
        flex: 0 0 auto;
    }

    .login-btn,
    .logout-btn {
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
        padding: 0 10px;
        gap: 6px;
    }

    .login-btn span,
    .logout-btn span {
        white-space: nowrap;
    }

    .brand-block {
        min-width: 0;
        max-width: calc(100vw - 170px);
    }


}

/* ===== WEATHER PANEL ===== */
.weather-panel {
    position: absolute;
    top: 120px;
    right: 70px;
    width: min(340px, calc(100vw - 24px));
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 1300;
}

.weather-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.24);
    background: linear-gradient(135deg, rgba(26, 115, 232, 0.9), rgba(59, 130, 246, 0.72));
    cursor: grab;
}

.weather-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

.weather-panel-close {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.weather-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.weather-panel-body {
    padding: 14px;
}

.weather-location {
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.weather-location i {
    color: #f87171;
    font-size: 11px;
}

.weather-current {
    margin-bottom: 16px;
}

.weather-current-main {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 4px;
}

.weather-current-icon {
    font-size: 42px;
    color: #fbbf24;
}

.weather-current-temp {
    font-size: 36px;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1;
}

.weather-current-desc {
    color: #cbd5e1;
    font-size: 13px;
    margin-bottom: 12px;
    padding-left: 2px;
}

.weather-current-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
}

.weather-detail-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
}

.weather-detail-item i {
    color: #60a5fa;
    font-size: 11px;
    width: 14px;
    text-align: center;
}

.weather-detail-item span {
    flex: 1;
}

.weather-detail-item strong {
    color: #e2e8f0;
    font-weight: 600;
}

.weather-forecast-title {
    color: #93c5fd;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    display: flex;
    align-items: center;
    gap: 6px;
}

.weather-forecast {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.weather-forecast-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 12px;
}

.weather-forecast-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.weather-forecast-day {
    color: #e2e8f0;
    font-weight: 600;
    min-width: 52px;
}

.weather-forecast-icon {
    font-size: 14px;
    color: #fbbf24;
    width: 18px;
    text-align: center;
}

.weather-forecast-desc {
    flex: 1;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weather-forecast-range {
    color: #e2e8f0;
    font-size: 12px;
    white-space: nowrap;
}

.weather-forecast-pop {
    color: #60a5fa;
    font-size: 11px;
    white-space: nowrap;
}

.weather-forecast-pop i {
    font-size: 9px;
}

.weather-refresh-btn {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.1);
    color: #93c5fd;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.weather-refresh-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.55);
}

.weather-loading {
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
    padding: 24px 0;
}

.weather-loading i {
    margin-right: 6px;
}

.weather-error {
    color: #fca5a5;
    font-size: 13px;
    text-align: center;
    padding: 18px 0;
}

.weather-error i {
    margin-right: 6px;
}

 

.weather-panel::-webkit-scrollbar {
    width: 6px;
}

.weather-panel::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.weather-panel::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 3px;
}

.weather-panel::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}


/* ẩn option cho copy print */
.ol-saveas{
    display: none !important;
}
/* ẩn option cho copy print */

/* fix scrollbar khi in bản đồ với ol-ext print */

/* ===== SAP NHAP TREE PANEL ===== */
.sapnhap-panel {
    position: absolute;
    top: 120px;
    right: 426px;
    width: min(420px, calc(100vw - 24px));
    max-height: 82vh;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 1300;
    overflow: hidden;
}

.sapnhap-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.24);
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.95), rgba(5, 150, 105, 0.86));
    cursor: grab;
}

.sapnhap-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

.sapnhap-panel-close {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sapnhap-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sapnhap-panel-body {
    display: grid;
    grid-template-rows: auto auto minmax(220px, 1fr) minmax(120px, auto);
    gap: 10px;
    padding: 12px;
    max-height: calc(82vh - 56px);
}

.sapnhap-search-row {
    display: grid;
    grid-template-columns: 1fr 36px;
    gap: 8px;
}

.sapnhap-search-row input {
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.65);
    color: #e2e8f0;
    font-size: 13px;
    outline: none;
}

.sapnhap-search-row input:focus {
    border-color: rgba(45, 212, 191, 0.9);
    box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.22);
}

.sapnhap-search-row button {
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    background: rgba(51, 65, 85, 0.55);
    color: #e2e8f0;
    cursor: pointer;
}

.sapnhap-search-row button:hover {
    background: rgba(71, 85, 105, 0.65);
}

.sapnhap-tree-meta {
    font-size: 11px;
    color: #94a3b8;
}

.sapnhap-tree-container {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 10px;
    padding: 8px;
    overflow: auto;
    background: rgba(15, 23, 42, 0.52);
}

.sapnhap-tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sapnhap-province-node {
    margin-bottom: 6px;
}

.sapnhap-node-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sapnhap-node-row.is-selected .sapnhap-node-main {
    border-color: rgba(45, 212, 191, 0.82);
    background: rgba(13, 148, 136, 0.2);
}

.sapnhap-node-toggle {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(51, 65, 85, 0.5);
    color: #cbd5e1;
    cursor: pointer;
    flex-shrink: 0;
}

.sapnhap-node-toggle:hover {
    background: rgba(71, 85, 105, 0.6);
}

.sapnhap-node-main {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.58);
    color: #e2e8f0;
    cursor: pointer;
    text-align: left;
    padding: 7px 9px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.sapnhap-node-main:hover {
    background: rgba(51, 65, 85, 0.62);
}

.sapnhap-node-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sapnhap-node-code {
    color: #93c5fd;
    font-size: 11px;
    flex-shrink: 0;
}

.sapnhap-node-count {
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(20, 184, 166, 0.22);
    color: #99f6e4;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
    flex-shrink: 0;
}

.sapnhap-children {
    list-style: none;
    margin: 6px 0 2px 28px;
    padding: 0;
    display: grid;
    gap: 5px;
}

.sapnhap-child-btn {
    background: rgba(30, 41, 59, 0.34);
}

.sapnhap-child-btn.is-selected {
    border-color: rgba(34, 197, 94, 0.8);
    background: rgba(22, 163, 74, 0.2);
}

.sapnhap-child-empty {
    font-size: 11px;
    color: #94a3b8;
    padding: 4px 2px;
}

.sapnhap-tree-empty {
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
    padding: 16px 8px;
}

.sapnhap-detail {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 10px;
    padding: 10px;
    background: rgba(15, 23, 42, 0.5);
    overflow: auto;
}

.sapnhap-detail-empty {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    padding: 8px 0;
}

.sapnhap-detail-title {
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 8px;
}

.sapnhap-detail-title span {
    color: #93c5fd;
    font-size: 12px;
}

.sapnhap-detail-row {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.5;
    margin-bottom: 4px;
}

.sapnhap-detail-text {
    margin-top: 5px;
    border-radius: 8px;
    padding: 8px;
    background: rgba(30, 41, 59, 0.62);
    color: #e2e8f0;
    font-size: 12px;
    line-height: 1.5;
}

@media (max-width: 1024px) {
    .sapnhap-panel {
        right: 70px;
    }
}

@media (max-width: 768px) {
    .sapnhap-panel {
        top: 84px;
        left: 12px;
        right: 12px;
        width: auto;
        max-height: calc(100vh - 126px);
    }

    .sapnhap-panel-body {
        max-height: calc(100vh - 184px);
    }
}

/* ===== END SAP NHAP TREE PANEL ===== */
/* Đoạn CSS bên trong khối này sẽ chỉ được kích hoạt khi trình duyệt chuyển sang chế độ in */
@media print {
    body.ol-print-document .ol-ext-print-dialog > form {
        overflow: hidden !important;
    }
    
    body.ol-print-document .ol-ext-print-dialog .ol-print-map,
    body.ol-print-document .ol-ext-print-dialog .ol-print-map .ol-page {
        overflow: hidden !important;
    }
}

/* fix scrollbar khi in bản đồ với ol-ext print */

/* ===== DYNAMIC LAYER UI ===== */
.dyn-layer-field-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px 8px;
    border: 1px solid rgba(148,163,184,0.2);
    border-radius: 8px;
    background: rgba(30,41,59,0.4);
}

.dyn-layer-field-row .dyn-field-name {
    flex: 1;
    min-width: 100px;
    background: rgba(15,23,42,0.6);
    border: 1px solid rgba(148,163,184,0.28);
    border-radius: 6px;
    padding: 6px 8px;
    color: #e2e8f0;
    font-size: 12px;
    outline: none;
}

.dyn-layer-field-row .dyn-field-name:focus {
    border-color: rgba(96,165,250,0.7);
    box-shadow: 0 0 0 2px rgba(96,165,250,0.15);
}

.dyn-layer-field-row .dyn-field-type {
    width: 110px;
    background: rgba(15,23,42,0.6);
    border: 1px solid rgba(148,163,184,0.28);
    border-radius: 6px;
    padding: 6px 8px;
    color: #e2e8f0;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.dyn-layer-field-row .dyn-field-required {
    width: 14px;
    height: 14px;
    accent-color: #1a73e8;
    cursor: pointer;
}

.dyn-attr-input {
    width: 100%;
    background: rgba(15,23,42,0.6);
    border: 1px solid rgba(148,163,184,0.28);
    border-radius: 6px;
    padding: 8px 10px;
    color: #e2e8f0;
    font-size: 12px;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.dyn-attr-input:focus {
    border-color: rgba(96,165,250,0.7);
    box-shadow: 0 0 0 2px rgba(96,165,250,0.15);
}

.dyn-attr-input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #1a73e8;
    cursor: pointer;
}
/* ===== END DYNAMIC LAYER UI ===== */
