/* d:\dung_chung\phuquy_travel\static\css\location_list.css */

/* --- 1. GLOBAL LAYOUT & RESETS --- */
/* Cố định chiều cao trang web (App-like) - Chống rung lắc/kéo trang */
html, body { 
    height: 100%; 
    width: 100%; 
    overflow: hidden; /* Khóa cuộn toàn trang */
    position: fixed; /* Ghim chặt body vào màn hình */
    inset: 0;
    background-color: #f9fafb;
    display: flex; /* Dùng Flex để chia Navbar và Content */
    flex-direction: column;
    /* Xử lý vùng an toàn (Tai thỏ) */
    overscroll-behavior: none; /* Chặn kéo trang */
}
/* [FIX] Chỉ áp dụng padding-top cho body để tránh nhân đôi khoảng cách */
body { padding-top: env(safe-area-inset-top) !important; }

/* [FIX] Desktop: Khôi phục padding-top để nội dung không bị Navbar che khuất */
@media (min-width: 992px) {
    body { padding-top: var(--site-header-height, 76px) !important; }
    html { padding-top: 0 !important; }
}

/* Reset Main Container để full màn hình */
.main-content-wrapper {
    flex: 1; /* Chiếm toàn bộ không gian còn lại dưới Navbar */
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important; /* [FIX] Đảm bảo chiều cao 100% để map không bị collapse */
    overflow: hidden; /* Ngăn cuộn ở container chính */
    position: relative; /* [FIX] Thêm relative để làm mốc tọa độ cho các phần tử con tuyệt đối (như thanh lọc) */
}

/* Map keeps a full-height canvas; mobile navigation is coordinated globally. */
footer{ display: none !important; }

/* Ẩn Navbar trên cùng để tạo cảm giác App (Immersive) trên Mobile */
@media (max-width: 991.98px) {
    #mainNavbar { display: none !important; }
    body { padding-top: 0 !important; }
}

/* --- 2. MAP CONTAINER & MARKERS --- */
#map {
    width: 100%;
    height: 100%;
    background-color: #e5e7eb;
}

/* Markers describe places. Their 44px target surrounds a compact 24px glyph. */
.custom-leaflet-marker { background: none; border: 0; }
.custom-marker-layout { position: relative; width: 44px; height: 44px; }
.marker-icon-wrapper {
    position: absolute; inset: 10px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 2px solid white; color: white; background: #475569;
    font-size: 10px; box-shadow: 0 2px 5px rgb(15 23 42 / 20%);
}
.map-kind-sights .marker-icon-wrapper { background: #0369a1; }
.map-kind-beaches .marker-icon-wrapper { background: #0f766e; }
.map-kind-food .marker-icon-wrapper { background: #9a3412; }
.map-kind-drinks .marker-icon-wrapper { background: #78543c; }
.map-kind-meeting .marker-icon-wrapper { background: #334155; }
.map-kind-stays .marker-icon-wrapper { background: #6d5483; }
.marker-label {
    position: absolute; left: 36px; top: 50%; transform: translateY(-50%);
    width: max-content; max-width: 180px; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; font-size: 12px; font-weight: 650; line-height: 1.4; color: #172b43;
    background: rgb(255 255 255 / 94%); padding: 2px 5px; border-radius: 3px;
    visibility: hidden; pointer-events: none;
}
.label-left .marker-label { left: auto; right: 36px; }
.label-visible .marker-label, .custom-leaflet-marker:hover .marker-label,
.custom-leaflet-marker:focus-visible .marker-label { visibility: visible; }
.is-selected .marker-icon-wrapper { outline: 2px solid #0c4a6e; outline-offset: 2px; }
.custom-leaflet-marker:focus-visible { outline: 2px solid #0369a1; border-radius: 50%; }
.map-cluster { background: transparent; border: none; }
.map-cluster > span:first-child {
    display: flex; align-items: center; justify-content: center; width: 38px; height: 38px;
    margin: 3px; border-radius: 50%; background: #174d68; color: white; font-size: 14px;
    font-weight: 700; border: 2px solid white; box-shadow: 0 2px 6px rgb(15 23 42 / 22%);
}
.map-cluster:hover > span:first-child { background: #0c3b53; }
.map-cluster:focus-visible { outline: 2px solid #0369a1; border-radius: 50%; }

/* Hiệu ứng Highlight thẻ khi click Marker */
@keyframes highlight-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
    50% { transform: scale(1.02); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
.card-highlighted {
    background-color: #eff6ff !important;
    border-color: var(--primary-color) !important;
    animation: highlight-pulse 0.6s ease-in-out;
}

/* --- 4. MOBILE SPECIFIC STYLES & BOTTOM SHEET 2-NẤC (Zero-Waste Vertical Optimization) --- */
@media (max-width: 991.98px) {
    /* Khung Bottom Sheet chứa danh sách địa điểm trên Mobile */
    #desktop-sidebar {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: var(--mobile-bottom-space, 65px) !important; /* Above the active bottom surface, including safe area. */
        top: auto !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        z-index: 1050 !important;
        background: #ffffff !important;
        border-top-left-radius: 14px !important;
        border-top-right-radius: 14px !important;
        box-shadow: 0 -3px 12px rgba(15, 23, 42, 0.08) !important;
        border: none !important;
        pointer-events: none !important;
        transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

/* Handle Bar ở đầu Bottom Sheet: Siêu tinh gọn 26px */
    #mobile-bottom-sheet-handle {
        pointer-events: auto !important;
        background: #ffffff !important;
        border-top-left-radius: 14px !important;
        border-top-right-radius: 14px !important;
        border-bottom: 1px solid #f1f5f9 !important;
        padding: 3px 12px 2px 12px !important;
        cursor: pointer !important;
        user-select: none !important;
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        box-shadow: none !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    .sheet-drag-pill {
        width: 28px !important;
        height: 3px !important;
        background-color: #cbd5e1 !important;
        border-radius: 10px !important;
        margin: 0 auto 2px auto !important;
        display: block !important;
    }

    /* Nấc 1: Horizontal Snap Slider ôm sát thẻ 94px, triệt tiêu mọi khoảng trắng thừa */
    #location-list-container {
        pointer-events: auto !important;
        background: #ffffff !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        gap: 8px !important;
        padding: 4px 10px 4px 10px !important;
        margin: 0 !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        scroll-snap-type: x mandatory !important;
        scrollbar-width: none !important;
        -webkit-overflow-scrolling: touch !important;
    }
    #location-list-container::-webkit-scrollbar { display: none !important; }

    /* Thẻ Card trên Mobile: Tinh gọn 94px chiều cao, ôm trọn thông tin */
    .location-card {
        height: 94px !important;
        min-height: 94px !important;
        max-height: 94px !important;
        border-radius: 10px !important;
    }

    .location-card-thumb {
        width: 94px !important;
        min-width: 94px !important;
        max-width: 94px !important;
        height: 94px !important;
        min-height: 94px !important;
        max-height: 94px !important;
    }

    .location-card-content {
        padding: 5px 8px 5px 8px !important;
    }

    .location-card-title {
        font-size: 0.88rem !important;
        margin: 0 0 2px 0 !important;
    }

    .mobile-card-item {
        scroll-snap-align: center !important;
        flex-shrink: 0 !important;
        width: 86vw !important;
        max-width: 320px !important;
        margin-bottom: 0 !important;
    }

    /* Ẩn thẻ Lịch trình ở Nấc 1 để container ôm khít 94px, chỉ hiện ở Nấc 2 */
    #itinerary-card-wrapper { display: none !important; }
    body.mobile-sheet-expanded #itinerary-card-wrapper { display: block !important; order: -1; margin-bottom: 8px !important; }

    /* Nấc 2: Mở rộng (Expanded 75vh) */
    body.mobile-sheet-expanded #desktop-sidebar {
        max-height: 75vh !important;
        height: 75vh !important;
        pointer-events: auto !important;
        box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.2) !important;
    }

    body.mobile-sheet-expanded #location-list-container {
        flex-direction: column !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: calc(75vh - 28px) !important;
        padding: 8px 10px 18px 10px !important;
        gap: 8px !important;
    }

    body.mobile-sheet-expanded .mobile-card-item {
        width: 100% !important;
        max-width: 100% !important;
        scroll-snap-align: none !important;
    }

    /* Sidebar Drawer */
    .sidebar-drawer {
        transition: transform 0.3s ease-in-out;
        will-change: transform;
    }
    .sidebar-open { overflow: hidden; }

    /* Sticky Breadcrumb */
    .modern-breadcrumb {
        position: sticky; top: 0; z-index: 1020;
        width: 100% !important; max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important;
        border-radius: 0; border: none;
        background-color: #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.05);
        padding: 8px 12px; margin-bottom: 12px;
    }

    .action-group { flex-grow: 1; display: flex; align-items: center; height: 100%; padding: 10px 0; }
    .cta-button-mobile {
        width: 100%; height: 40px; border-radius: 20px;
        display: flex; flex-direction: column; justify-content: center; align-items: center;
        padding: 0; font-size: 0.9rem; font-weight: 700;
    }
    .cta-button-mobile .action-text { display: flex; align-items: center; gap: 5px; }

    /* Ẩn widget AI Concierge trôi nổi trên mobile map để không che khuất card */
    .ai-concierge-root {
        display: none !important;
    }
}

/* --- 5. NAVIGATION MODE (Chế độ Dẫn đường) --- */
body.nav-mode-active #location-list-container,
body.nav-mode-active #sidebar-drawer,
body.nav-mode-active .sidebar-drawer,
body.nav-mode-active #desktop-sidebar,
body.nav-mode-active #sidebar-backdrop,
body.nav-mode-active nav,
body.nav-mode-active header,
body.nav-mode-active .navbar,
body.nav-mode-active .map-filter-bar-container{ display: none !important; }

body.nav-mode-active #map-container-wrapper {
    position: absolute !important; top: 0; left: 0;
    width: 100% !important; height: 100% !important; z-index: 9999;
}

/* [NEW] Custom Tooltip cho nút điều khiển bản đồ */
.map-control-btn {
    position: relative; /* Để định vị tooltip con */
}
/* [FIX] Không hiện tooltip khi nút đang active (đang mở menu) để tránh che lấp */
.map-control-btn:not(.active):hover::after {
    content: attr(title); /* Lấy nội dung từ thẻ title */
    position: absolute;
    right: 110%; /* Hiển thị bên trái nút */
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(31, 41, 55, 0.9); /* Màu nền tối */
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    opacity: 0;
    animation: fadeInTooltip 0.2s forwards;
}
@keyframes fadeInTooltip { to { opacity: 1; } }
/* Ẩn title mặc định của trình duyệt khi hover để tránh bị trùng (cần JS hỗ trợ hoặc chấp nhận hiển thị kép nhẹ) */


/* --- 6. LIST VIEW MODE (Chế độ Danh sách dọc) --- */
body.list-view-active #map-container { display: none; }
@media (min-width: 992px) { body.list-view-active #map-container { display: block; } }

body.list-view-active #location-list-container {
    flex-direction: column !important; align-items: stretch !important;
    height: 100% !important; padding-top: 60px !important; padding-bottom: 80px !important;
    background-color: #f9fafb !important; overflow-y: auto !important;
    margin-top: 0 !important; overscroll-behavior-y: contain;
}

body.list-view-active .mobile-card-item {
    width: 100% !important; margin-right: 0 !important; margin-bottom: 16px !important;
}
body.list-view-active .itinerary-card-inner { height: auto !important; }
body.list-view-active .itinerary-content { overflow: visible !important; }

body.list-view-active #mobile-list-handle-btn {
    position: absolute !important; bottom: 80px !important; z-index: 1000 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
    background-color: var(--primary-color) !important; color: white !important; border: none !important;
}
body.nav-mode-active #mobile-list-handle-container { display: none !important; }

/* --- 7. CONTROLS & FILTERS --- */
/* Map Custom Controls */
/* Filter Bar */
.map-filter-bar-container {
    position: absolute; top: 10px; left: 12px; right: 12px; z-index: 1005;
    flex-direction: column; gap: 6px; pointer-events: none;
}
.map-mobile-search { display: flex; align-items: center; gap: 8px; background: white;
    border: 1px solid #d9e2ea; border-radius: 10px; padding: 0 12px; pointer-events: auto; }
.map-mobile-search > i { color: #52677e; }
.map-mobile-search input { width: 100%; min-width: 0; min-height: 44px; border: none;
    background: transparent; color: #172b43; font-size: 14px; outline: none; }
.map-mobile-search:focus-within { outline: 2px solid #0369a1; outline-offset: 1px; }
.map-mobile-search button { min-width: 44px; min-height: 44px; border: none; background: none; color: #475569; }
.map-mobile-filters { display: flex; gap: 6px; overflow-x: auto; pointer-events: auto;
    touch-action: pan-x pan-y; overscroll-behavior-x: contain; padding-bottom: 3px; scrollbar-width: none; }
.map-mobile-filters::-webkit-scrollbar { display: none; }
.map-filter-btn, .cat-pill {
    flex-shrink: 0; min-height: 44px; padding: 7px 11px; border: 1px solid #d6e0e7;
    border-radius: 20px; font-size: 12px; font-weight: 600; line-height: 1.3;
    color: #334155; background: white; cursor: pointer; white-space: nowrap;
}
.map-mobile-filters .map-filter-btn.active, .cat-pill.active { background: #075985; border-color: #075985; color: white; }
.map-filter-btn:hover, .cat-pill:hover { border-color: #075985; }
.map-filter-btn:focus-visible, .cat-pill:focus-visible, .map-card-select:focus-visible { outline: 2px solid #075985; outline-offset: 2px; }
.map-desktop-only { display: block; }
.map-edge-dock { display: flex; }
.map-mobile-only { display: none; }
.map-radius-control { position: absolute; left: 420px; top: 12px; z-index: 1006; }
.map-radius-control select { min-height: 44px; background: white; color: #334155; }
.map-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.map-card-select { font: inherit; font-weight: inherit; color: inherit; background: none; border: none;
    padding: 0; text-align: left; cursor: pointer; }
.map-placeholder-icon { font-size: 25px; color: #526f86; }
.map-missing-position { color: #64748b; font-size: 11px; }
.map-access-note { font-size: 12px; line-height: 1.45; color: #475569; margin: 5px 0; }
.map-service-link { display: block; margin-top: 8px; font-size: 12px; color: #075985; }
.custom-iw-actions button, .custom-iw-actions > a { min-height: 40px; display: inline-flex; align-items: center; }
body.desktop-closed .map-radius-control { left: 56px; }
@media (max-width: 991.98px) {
    .map-desktop-only { display: none !important; }
    .map-mobile-only { display: flex !important; }
    #main-layout-container { display: block; border: 0; }
    #map-container-wrapper { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; }
    #mobile-bottom-sheet-handle { display: flex !important; }
    .map-radius-control { top: 112px; left: 12px; }
    .map-custom-controls .d-md-none { display: flex !important; }
    #sidebar-drawer { width: 88%; max-width: 390px; }
    #desktop-no-results { min-width: calc(100vw - 24px); padding: 12px !important; }
}
@media (prefers-reduced-motion: reduce) {
    .card-highlighted { animation: none; }
    #desktop-sidebar { transition: none !important; }
}

/* Sticky Sidebar Header for Desktop */
.sidebar-header-sticky {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 30;
    background: #ffffff;
}

.sidebar-search-box {
    position: relative !important;
    width: 100% !important;
}

.sidebar-search-box input {
    width: 100% !important;
    padding: 7px 30px 7px 30px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-size: 0.82rem !important;
    background-color: #f8fafc !important;
    color: #1e293b !important;
    outline: none !important;
    transition: all 0.2s ease !important;
}

.sidebar-search-box input:focus {
    background-color: #ffffff !important;
    border-color: #0284c7 !important;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15) !important;
}

.sidebar-search-box .search-icon {
    position: absolute !important;
    left: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #94a3b8 !important;
    font-size: 11px !important;
    pointer-events: none !important;
    line-height: 1 !important;
    z-index: 2 !important;
}

.sidebar-search-box .clear-btn {
    position: absolute !important;
    right: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #94a3b8 !important;
    font-size: 12px !important;
    cursor: pointer !important;
    padding: 4px !important;
    line-height: 1 !important;
    z-index: 2 !important;
    background: transparent !important;
    border: none !important;
}

.sidebar-search-box .clear-btn:hover {
    color: #ef4444 !important;
}

.category-pills-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
    touch-action: pan-x pan-y;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

/* Custom sleek horizontal scrollbar */
.category-pills-scroll::-webkit-scrollbar {
    height: 4px;
    display: block;
}

.category-pills-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.category-pills-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.category-pills-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.cat-pill {
    cursor: pointer;
    font-size: 0.74rem;
    line-height: 1.2;
    user-select: none;
    flex-shrink: 0;
}

/* Card layout enhancements & Fixed Uniform Height */
.location-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    width: 100% !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
}

.location-card-thumb {
    overflow: hidden !important;
    position: relative !important;
    flex-shrink: 0 !important;
    background-color: #f1f5f9 !important;
    display: block !important;
}

@media (min-width: 992px) {
    .location-card {
        height: 108px !important;
        min-height: 108px !important;
        max-height: 108px !important;
    }

    .location-card-thumb {
        width: 108px !important;
        min-width: 108px !important;
        max-width: 108px !important;
        height: 108px !important;
        min-height: 108px !important;
        max-height: 108px !important;
    }
}

.location-card-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.location-card-badge {
    position: absolute !important;
    top: 6px !important;
    left: 6px !important;
    z-index: 3 !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    padding: 2px 6px !important;
    border-radius: 5px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) !important;
}

.location-card-content {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    padding: 8px 12px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    overflow: hidden !important;
}

.location-card-title {
    font-size: 0.92rem !important;
    font-weight: 750 !important;
    line-height: 1.3 !important;
    color: #0f172a !important;
    margin: 0 0 3px 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    display: block !important;
}

.location-card:hover .location-card-title {
    color: var(--primary-color) !important;
}

/* Nút Lộ trình trên thẻ địa điểm: Tinh gọn, bo tròn mềm mại chuẩn UI */
.btn-card-route {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    color: #0284c7 !important;
    background-color: #f0f9ff !important;
    border: 1px solid #bae6fd !important;
    border-radius: 20px !important;
    padding: 3px 8px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    height: 22px !important;
    min-height: 22px !important;
    max-height: 22px !important;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.08) !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    user-select: none !important;
}

.btn-card-route:hover {
    background-color: #e0f2fe !important;
    border-color: #7dd3fc !important;
    color: #0369a1 !important;
    transform: translateY(-0.5px) !important;
}

.btn-card-route i {
    font-size: 9px !important;
    line-height: 1 !important;
}

.itinerary-thumb {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    align-self: stretch !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    display: block !important;
}

.itinerary-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.location-card:hover {
    border-color: #93c5fd !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08) !important;
}

.location-card-wrapper.active-card .location-card,
.location-card.card-highlighted {
    border-color: #0284c7 !important;
    background-color: #f0f9ff !important;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.16) !important;
}

/* Nút lộ trình siêu tinh gọn trên thẻ card (chống Bootstrap 16px/0px radius phá vỡ) */
.btn-card-route {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3.5px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    color: #0284c7 !important;
    background-color: #f0f9ff !important;
    border: 1px solid #bae6fd !important;
    border-radius: 20px !important;
    padding: 3px 8px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    height: 22px !important;
    box-sizing: border-box !important;
}

.btn-card-route:hover {
    background-color: #e0f2fe !important;
    border-color: #7dd3fc !important;
    color: #0369a1 !important;
}

.btn-card-route i {
    font-size: 9px !important;
    line-height: 1 !important;
}

/* --- ENHANCED LEAFLET CONVERSION POPUP --- */
.custom-iw-card {
    min-width: 240px;
    max-width: 275px;
    border-radius: 12px;
    overflow: hidden;
    font-family: inherit;
    text-align: left;
}

.custom-iw-cover {
    width: 100%;
    height: 105px;
    position: relative;
    overflow: hidden;
    background-color: #f1f5f9;
    border-radius: 10px 10px 0 0;
}

.custom-iw-cover img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.custom-iw-body {
    padding: 8px 6px 4px 6px;
}

.custom-iw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 2px;
}

.custom-iw-cat {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #0284c7;
}

.custom-iw-price {
    font-size: 10px;
    font-weight: 700;
    color: #059669;
    background: #ecfdf5;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid #d1fae5;
}

.custom-iw-title {
    font-size: 0.95rem !important;
    font-weight: 750 !important;
    color: #0f172a !important;
    line-height: 1.25 !important;
    margin: 0 0 3px 0 !important;
}

.custom-iw-address {
    font-size: 0.74rem;
    color: #64748b;
    margin: 0 0 6px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 992px) {
    #desktop-sidebar {
        width: 400px !important;
        min-width: 400px !important;
        max-width: 400px !important;
        flex-shrink: 0 !important;
    }
    #map-container-wrapper {
        flex: 1 1 0% !important;
        width: auto !important;
    }
}

.custom-iw-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.btn-iw-route {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background-color: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn-iw-route:hover {
    background-color: #dbeafe;
    color: #1e40af;
}

.btn-iw-maps {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background-color: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn-iw-maps:hover {
    background-color: #dcfce7;
    color: #166534;
}

.link-iw-detail {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s ease;
}
.link-iw-detail:hover {
    color: #0284c7;
}

@media (max-width: 991.98px) {
    .map-filter-bar-container { top: 10px !important; }
}
body.list-view-active .map-filter-bar-container {
    position: absolute; top: 10px; padding: 12px 16px;
    background: transparent; z-index: 2000; margin: 0; border-radius: 0;
}

/* --- 8. DESKTOP SIDEBAR TRANSITIONS --- */
#desktop-sidebar, #map-container-wrapper {
    transition: all 0.3s ease-in-out;
}

#desktop-sidebar {
    z-index: 60 !important; /* [FIX] Cao hơn Map (50) để nút bấm luôn nổi */
    overflow: visible !important; /* [FIX] Đảm bảo nút bấm thò ra ngoài không bị cắt */
}

#map-container-wrapper {
    z-index: 50 !important; /* [FIX] Thấp hơn Sidebar */
}
@media (min-width: 992px) { body.desktop-closed #desktop-sidebar { margin-left: -400px; } }

/* [NEW] Rotate sidebar toggle arrow when closed */
body.desktop-closed #desktop-sidebar-icon {
    transform: rotate(180deg) !important;
}
#desktop-sidebar-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* [FIX] Đảm bảo class hidden luôn thắng display: flex */
.directions-panel-container.hidden {
    display: none !important;
}

/* [FIX] Mobile: Tinh chỉnh vị trí và kích thước bảng chỉ dẫn để không che nội dung */
@media (max-width: 991.98px) {
    .directions-panel-container {
        top: 70px; /* Đẩy xuống dưới thanh lọc (Filter Bar) */
        max-height: 40vh; /* Giới hạn chiều cao để không che thẻ địa điểm bên dưới */
    }
}

/* [FIX] Desktop: Đẩy bảng chỉ dẫn xuống dưới thanh lọc (Filter Bar) để không bị che */
@media (min-width: 992px) {
    .directions-panel-container {
        top: 90px !important; /* Filter bar (30px) + Height (~40px) + Gap */
    }
}

/* [FIX] Ẩn thẻ địa điểm trong danh sách khi bị lọc */
.location-card-wrapper.hidden {
    display: none !important;
}

/* [NEW] Style cho ô chọn khoảng cách trên thanh lọc */
.radius-filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #fff;
    border: 1px solid #e5e7eb; /* border-gray-200 */
    border-radius: 50px;
    padding: 6px 28px 6px 12px; /* Padding phải rộng để chứa icon mũi tên */
    font-size: 0.75rem; /* text-xs */
    font-weight: 700;
    color: #4b5563; /* text-gray-600 */
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.2em 1.2em;
    height: 32px; /* Khớp chiều cao với các nút map-filter-btn */
    transition: all 0.2s ease;
    white-space: nowrap;
}
.radius-filter-select:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.radius-filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}
body.desktop-closed #map-container-wrapper { width: 100%; }
body.desktop-closed #sidebar-drawer { left: 0 !important; }

/* Scroll Hint Mask */
.mask-linear-scroll {
    /* [FIX] Bỏ hiệu ứng làm mờ trên mobile theo yêu cầu */
    mask-image: none !important;
    -webkit-mask-image: none !important;
}
@media (min-width: 992px) { .mask-linear-scroll { mask-image: none !important; -webkit-mask-image: none !important; } }
body.list-view-active .mask-linear-scroll { mask-image: none !important; -webkit-mask-image: none !important; }

/* [FIX] Đẩy nút điều khiển bản đồ lên cao trên Mobile để tránh bị thẻ địa điểm che */
@media (max-width: 991.98px) {
    .map-custom-controls {
            bottom: 230px !important; /* [UPDATE] Đẩy lên cao để tránh đè lên thẻ địa điểm */
    }
}
