/* */
:root { --pmh-red: #bb2b1b; --gold: #f9eda2; }

/* --- CẤU TRÚC CHUNG --- */
.map-wrapper { position: relative; width: 100vw; height: 100vh; overflow: hidden; }
.map-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.map-wrapper svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; }
.building-path { fill: transparent; stroke: transparent; cursor: pointer; pointer-events: all !important; }
.building-path:hover { fill: rgba(255, 227, 137, 0.4); }

/* UI COMPONENTS */
#map-tooltip { position: fixed; background: var(--pmh-red); color: var(--gold); padding: 8px 16px; border-radius: 50px; font-weight: bold; pointer-events: none; display: none; z-index: 9999; border: 1px solid var(--gold); }
.tower-title-red { color: var(--pmh-red); font-weight: bold; font-size: 22px; }

/* Nút Close tròn */
.btn-close-custom { width: 40px; height: 40px; background: #fff; border: 2px solid #bb2b1b; border-radius: 50%; color: #bb2b1b; font-size: 20px; font-weight: bold; display: flex; align-items: center; justify-content: center; cursor: pointer; line-height: 1; flex-shrink: 0; }

/* Nút Tab Pill */
.btn-tab-main { padding: 8px 20px; border-radius: 30px; border: none; background: #e0e0e0; color: #666; font-weight: bold; margin-right: 10px; cursor: pointer; white-space: nowrap; transition: 0.3s; }
.btn-tab-main.active { background: var(--pmh-red); color: #fff; }

.floor-link { margin-left: 20px; text-decoration: none; color: #707070; font-size: 0.9rem; font-weight: 600; border-bottom: 2px solid transparent; padding: 5px; }
.floor-link.active { color: var(--pmh-red); border-bottom-color: var(--pmh-red); font-weight: bold; }
.dot-line-separator { border-top: 1.5px dotted #cecece; margin: 10px 0 5px 0; width: 100%; }
.floor-nav-red { border-bottom: 1px solid #cecece; display: flex; }
.title-group { display: flex; flex-direction: column; align-items: flex-start; }
.zoom-text-hint { color: #999; font-size: 15px; font-style: italic; margin-top: -2px; }

/* ZOOM VIEWPORT (Cũ - giữ lại để tương thích nếu cần) */
.zoom-box-viewport { width: 100%; height: calc(100vh - 160px); overflow: hidden; background: #ffffff; display: flex; align-items: flex-start; justify-content: center; position: relative; }
.img-wrapper { width: 100%; height: 100%; display: flex; align-items: flex-start; justify-content: center; padding-top: 10px; }
#mbImage { max-width: 95%; max-height: 100%; width: auto; height: auto; object-fit: contain; object-position: top center; image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; will-change: transform; transform: translate3d(0, 0, 0); backface-visibility: hidden; }

/* --- SLIDER AREA --- */
.slider-area { width: 100%; height: 100%; overflow: hidden; position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.mySwiper { position: relative; padding-bottom: 60px; overflow: visible !important; }
.swiper-slide { display: flex; justify-content: center; align-items: center; transition: opacity 0.3s; height: auto; }
.swiper-slide img { max-width: 100%; max-height: 55vh; object-fit: contain; cursor: zoom-in; border-radius: 4px; background: #fff; box-shadow: 0 5px 20px rgba(0,0,0,0.1); }
.custom-arrow-red { color: var(--pmh-red) !important; width: 60px; height: 60px; z-index: 100; margin-top: -40px; }
.custom-arrow-red::after { font-size: 50px !important; font-weight: 900 !important; }
.swiper-pagination-custom { position: absolute; bottom: 0; right: 0; color: var(--pmh-red); font-weight: bold; z-index: 20; display: flex; align-items: baseline; justify-content: flex-end; gap: 3px; line-height: 1; }
#curr { font-size: 40px; font-weight: 800; } .slash { font-size: 40px; font-weight: 300; margin: 0 5px; } #total { font-size: 80px; font-weight: 900; line-height: 0.8; }
.btn-sub-tab { background: none; border: none; margin-left: 15px; color: #707070; cursor: pointer; padding-bottom: 5px; border-bottom: 2px solid transparent; }
.btn-sub-tab.active { color: var(--pmh-red); font-weight: bold; border-bottom-color: var(--pmh-red); }

/* --- RESPONSIVE FIX --- */
@media (max-width: 767.98px) {
    .modal-header-custom { padding: 15px !important; }
    .modal-header-custom > div.d-flex:first-child { flex-direction: column !important; align-items: flex-start !important; }
    .header-right-actions { width: 100%; margin-top: 15px; display: flex !important; justify-content: space-between !important; align-items: center !important; flex-direction: row !important; }
    .main-tabs-red { display: flex !important; flex-direction: row !important; gap: 5px; flex-wrap: nowrap !important; }
    .btn-tab-main { margin: 0 !important; padding: 6px 12px; font-size: 13px; flex-shrink: 0; }
    .floor-nav-red { overflow-x: auto; white-space: nowrap; width: 100%; scrollbar-width: none; }
    .floor-nav-red::-webkit-scrollbar { display: none; }
    .mySwiper { width: 100%; overflow: hidden !important; padding-bottom: 40px; }
    .swiper-slide img { max-height: 40vh; }
    .swiper-pagination-custom { right: 20px; bottom: 0; }
    #total { font-size: 40px; } #curr { font-size: 20px; .slash { font-size: 20px; } }
    .custom-arrow-red { display: none; }
}
@media (min-width: 992px) {
    .mySwiper { width: 70%; margin: 0 auto; }
    .swiper-button-prev { left: -80px !important; } .swiper-button-next { right: -80px !important; }
    .swiper-slide { opacity: 0.4; transform: scale(0.9); transition: all 0.3s; }
    .swiper-slide-active, .swiper-slide-next { opacity: 1; transform: scale(1); }
    #mbImage { cursor: zoom-in; touch-action: auto !important; }
    .zoom-box-viewport { touch-action: auto !important; overflow: hidden; }
}

.fancybox__container { z-index: 2000 !important; }
.luuyviet{ font-family: auto; font-size: 9pt; padding: 10px; }
.luuyanh{ font-family: auto; font-size: 9pt; padding: 10px; font-style: italic; margin-top: -33px; }

/* --- STYLE POPUP 2 CỘT --- */
#apartmentModal { z-index: 2147483647 !important; }
.modal-backdrop { z-index: 2147483646 !important; }
#panel-mat-bang { display: flex !important; width: 100%; height: 100%; overflow: hidden; }
.tower-interactive-side { flex: 0 0 38%; position: relative; background: #f4f4f4; border-right: 1px solid #ddd; display: flex; justify-content: center; align-items: center; }
.tower-interactive-side img { width: 100%; height: 100%; object-fit: contain; }
.tower-interactive-side svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 10; }
.floor-detail-side { flex: 1; position: relative; background: #fff; overflow: hidden; }
.floor-path { fill: transparent; stroke: transparent; cursor: pointer; transition: 0.2s; pointer-events: all; }
.floor-path:hover, .floor-path.active { fill: rgba(146, 14, 14, 0.425); }

@media (max-width: 768px) {
    #panel-mat-bang { flex-direction: column !important; }
    .tower-interactive-side { flex: 0 0 45vh; width: 100%; border-right: none; border-bottom: 1px solid #ddd; }
    .floor-detail-side { flex: 1; }
}

/* --- TOOLTIP & MOBILE BACK --- */
#map-tooltip { position: fixed !important; top: 0; left: 0; z-index: 2147483660 !important; pointer-events: none; background: rgba(187, 43, 27, 0.95); color: #fff; padding: 6px 12px; border-radius: 4px; font-size: 13px; font-weight: 600; white-space: nowrap; display: none; transform: translate(15px, 15px); box-shadow: 0 4px 15px rgba(0,0,0,0.3); }

.btn-back-mobile { position: absolute; top: 15px; left: 15px; z-index: 100; background: #fff; border: 1px solid #bb2b1b; color: #bb2b1b; padding: 8px 15px; border-radius: 30px; font-size: 14px; font-weight: bold; display: flex; align-items: center; gap: 5px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

@media (max-width: 991px) {
    .tower-interactive-side { display: flex; width: 100%; height: 100%; }
    .floor-detail-side { display: none; flex-direction: column; width: 100%; height: 100%; background: #fff; }
    #panel-mat-bang.show-detail .tower-interactive-side { display: none !important; }
    #panel-mat-bang.show-detail .floor-detail-side { display: flex !important; }
    .btn-back-mobile { position: relative !important; top: auto; left: auto; margin: 15px; width: fit-content; z-index: 100; flex-shrink: 0; }
    #mbImage { max-width: 100%; max-height: 100%; object-fit: contain; }
}

/* CURSOR */
.floor-detail-side .img-wrapper, .floor-detail-side img { cursor: grab !important; cursor: -webkit-grab !important; }
.floor-detail-side .img-wrapper:active, .floor-detail-side img:active { cursor: grabbing !important; cursor: -webkit-grabbing !important; }
.swiper-slide, .swiper-slide img { cursor: pointer !important; }
.floor-path { cursor: pointer !important; pointer-events: all !important; fill: rgba(255, 255, 255, 0); transition: all 0.2s ease; }
.floor-path:hover, .floor-path.active { fill: rgba(187, 43, 27, 0.4) !important; stroke: #bb2b1b !important; stroke-width: 2px !important; }

#mobile-floor-title { text-align: center; color: #bb2b1b; font-size: 18px; font-weight: 800; text-transform: uppercase; margin: 5px 0 10px 0; padding: 0 10px; flex-shrink: 0; display: none; }

@media (max-width: 991px) { #mobile-floor-title { display: block; } }

/* */

/* ==========================================================================
   PHẦN CSS MỚI: TƯƠNG TÁC TỪNG CĂN HỘ (ĐÃ FIX LỖI ZOOM)
   ========================================================================== */

/* 1. CONTAINER RIÊNG CHO CỘT PHẢI */
.apt-zoom-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center; /* Căn giữa ngang */
    align-items: center;     /* Căn giữa dọc (Thay vì flex-start) */
    background: #fff;
    cursor: grab !important;
    position: relative;
}
.apt-zoom-container:active { cursor: grabbing !important; }

/* 2. WRAPPER BAO QUANH HÌNH + SVG */
/* Quan trọng: display flex để co giãn theo hình bên trong */
.apt-zoom-wrapper {
    position: relative;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    transform-origin: center center; /* Zoom từ tâm sẽ tự nhiên hơn */
    transition: transform 0.1s linear;
    display: flex; 
    justify-content: center;
    align-items: center;
    will-change: transform;
}

/* 3. HÌNH ẢNH MẶT BẰNG (ĐÃ SỬA) */
.apt-floor-image {
    display: block;
    max-width: 100%; /* Giới hạn chiều rộng bằng khung */
    max-height: 100%; /* Giới hạn chiều cao bằng khung */
    width: auto;      /* Tự động tính toán tỷ lệ */
    height: auto;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* 4. LỚP SVG PHỦ LÊN TRÊN */
.apt-svg-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
    overflow: visible;
    pointer-events: none; /* Quan trọng: để chuột xuyên qua lớp nền SVG */
}

/* 5. PATH TƯƠNG TÁC CĂN HỘ */
.apt-interactive-path {
    fill: transparent;
    stroke: transparent;
    cursor: pointer !important;
    pointer-events: all !important; /* Bắt buộc để nhận click/hover */
    transition: all 0.2s ease;
}

/* Hiệu ứng Hover/Active */
.apt-interactive-path:hover, 
.apt-interactive-path.active {
    fill: rgba(214, 70, 13, 0.4); 
    stroke: #bb2b1b;
    stroke-width: 2px;
}

/* --- STYLE CHO TOOLTIP (GIỮ NGUYÊN) --- */
/* */

/* --- STYLE CHO TOOLTIP (ĐÃ CẬP NHẬT GIAO DIỆN) --- */
.pmh-tooltip-box {
    background-color: #900000; /* Nền đỏ chủ đạo cho toàn bộ box */
    color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5); /* Tăng shadow để nổi bật hơn */
    font-family: Arial, sans-serif;
    min-width: 280px;
    max-width: 340px;
    border: 1px solid #f2c94c;
}

.pmh-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f2c94c;
    background: transparent; /* [FIX] Bỏ nền đỏ đậm để đồng bộ màu với phần dưới */
}

.pmh-tower-name {
    font-size: 18px;
    font-weight: 800;
    color: #f2c94c;
    text-transform: uppercase;
}

.pmh-unit-code {
    font-size: 24px;
    font-weight: 800;
    color: #f2c94c;
}

.pmh-tooltip-body {
    padding: 12px 15px;
}

/* Grid Layouts */
.pmh-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0; text-align: center; }
.pmh-grid-2 > div:first-child { border-right: 1px solid #f2c94c; padding-right: 10px; }
.pmh-grid-2 > div:last-child { padding-left: 10px; }

.pmh-grid-shop { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.col-xd { border-right: 1px solid #f2c94c; padding-right: 12px; }
.col-sd { padding-left: 12px; }

/* Typography */
.pmh-label {
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 6px;
    display: block;
    color: #fff;
}

.pmh-value {
    font-size: 19px;
    font-weight: 800;
    color: #f2c94c;
    display: block;
    margin-top: 2px;
}

/* [FIX] Style cho dòng con: Chữ thường (không bold) */
.shop-sub-row {
    font-size: 12px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    color: #fff;
}

/* Chỉ số liệu mới Bold, còn label "Tầng trệt..." để thường */
.shop-sub-row span {
    font-weight: 400; /* Chữ thường */
    opacity: 0.9;
}
.shop-sub-row b {
    color: #fff;
    font-weight: 700;
    padding-left: 5px; /* [FIX] Thêm khoảng cách với dấu : */
}

/* Dòng tổng cộng */
.shop-total {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.2);
    font-size: 13px;
}
.shop-total b {
    color: #f2c94c;
    font-size: 14px;
}

/* ==========================================================================
   STYLE CHO TOOLTIP MỚI (SHOP & CĂN ĐIỂN HÌNH)
   ========================================================================== */
.pmh-tooltip-box {
    background-color: #900000; color: #fff; border-radius: 8px;
    overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    font-family: Arial, sans-serif; min-width: 280px; max-width: 340px;
    border: 1px solid #f2c94c;
}
.pmh-tooltip-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 15px; border-bottom: 1px solid #f2c94c; background: #7a0000;
}
.pmh-tower-name { font-size: 18px; font-weight: 800; color: #f2c94c; text-transform: uppercase; }
.pmh-unit-code { font-size: 24px; font-weight: 800; color: #f2c94c; }
.pmh-tooltip-body { padding: 12px 15px; }

/* Layout Căn Điển Hình */
.pmh-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0; text-align: center; }
.pmh-grid-2 > div:first-child { border-right: 1px solid #f2c94c; padding-right: 10px; }
.pmh-grid-2 > div:last-child { padding-left: 10px; }

/* Layout Shop */
.pmh-grid-shop { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.col-xd { border-right: 1px solid #f2c94c; padding-right: 12px; }
.col-sd { padding-left: 12px; }

.pmh-label { font-size: 11px; font-weight: bold; text-transform: uppercase; margin-bottom: 6px; display: block; color: #fff; }
.pmh-value { font-size: 19px; font-weight: 800; color: #f2c94c; display: block; margin-top: 2px; }
.shop-sub-row { font-size: 12px; margin-bottom: 4px; display: flex; justify-content: space-between; color: #fff; }
.shop-sub-row b { color: #fff; font-weight: 700; }
.shop-total { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.2); font-size: 13px; }
.shop-total b { color: #f2c94c; font-size: 14px; }

/* */

/* --- FIX TOOLTIP MOBILE --- */
@media (max-width: 768px) {
    .pmh-tooltip-box {
        /* Ép chiều rộng tối đa bằng 90% màn hình */
        max-width: 90vw !important; 
        min-width: auto !important; /* Cho phép co nhỏ lại */
        font-size: 13px; /* Giảm chữ chút cho gọn */
    }
    
    /* Điều chỉnh header nhỏ lại chút trên mobile */
    .pmh-unit-code { font-size: 20px; }
    .pmh-tower-name { font-size: 16px; }
}

/* Tạm thời tô màu đỏ cho tất cả vùng tương tác để dễ tìm 
.apt-interactive-path {
    fill: rgba(255, 0, 0, 0.5) !important; 
    stroke: yellow !important;
}*/

/* */

/* Chỉ chỉnh khoảng cách bên ngoài, không can thiệp vào layout bên trong -> KHÔNG LỆCH */
@media (max-width: 992px) {
    .floor-detail-side {
        /* Chỉ thêm khoảng trống dưới cùng để không bị menu che, không ảnh hưởng tọa độ */
        padding-bottom: 100px; 
    }
    
    #mobile-floor-title {
        /* Đẩy tiêu đề xuống một chút cho thoáng */
        margin-top: 20px;
        margin-bottom: 10px;
        text-align: center;
    }
}