/* Floor Plans dạng lưới — đi kèm libs/floorplan-grid.php */

.hhv-fp-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
    padding: 0 15px; /* bù cho .row của theme */
    margin-top: 8px;
}

.hhv-fp-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
    border: 1px solid #e6e0d8;
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow .2s ease, border-color .2s ease;
}

.hhv-fp-card:hover {
    border-color: #d6c7b0;
    box-shadow: 0 6px 18px rgba(43, 37, 35, .08);
}

/* Khung ảnh 4:3, ảnh hiện đủ (không cắt) */
.hhv-fp-thumb {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    background: #faf8f5;
    border-bottom: 1px solid #eee8e0;
    cursor: zoom-in;
}

.hhv-fp-thumb .hhv-fp-img,
.hhv-fp-thumb img {
    position: absolute;
    inset: 8px;
    width: calc(100% - 16px) !important;
    height: calc(100% - 16px) !important;
    max-width: none;
    object-fit: contain;
    margin: 0;
    border-radius: 0;
}

.hhv-fp-thumb:focus-visible {
    outline: 2px solid #b8976a;
    outline-offset: -2px;
}

.hhv-fp-zoom {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(43, 37, 35, .82);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    pointer-events: none; /* bấm xuyên xuống ảnh → lightbox */
}

.hhv-fp-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px 16px;
}

.hhv-fp-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    color: #2b2523;
}

.hhv-fp-meta {
    font-size: 13px;
    line-height: 1.5;
    color: #6b625c;
}

.hhv-fp-price {
    color: #2b2523;
    font-weight: 500;
}

.hhv-fp-desc {
    font-size: 13px;
    line-height: 1.5;
    color: #6b625c;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hhv-fp-desc p {
    margin: 0;
}

.hhv-fp-more-wrap {
    display: flex;
    justify-content: center;
    padding: 28px 15px 0;
}

.hhv-fp-more-btn {
    min-height: 44px;
    padding: 0 28px;
    border: 1px solid #b8976a;
    border-radius: 4px;
    background: #fff;
    color: #6e5530;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.hhv-fp-more-btn:hover,
.hhv-fp-more-btn:focus-visible {
    background: #b8976a;
    color: #fff;
}

/* Thanh tiêu đề nằm TRÊN ảnh (cả máy tính lẫn điện thoại) */
.hhv-fp-body {
    order: -1;
    border-bottom: 1px solid #eee8e0;
}

.hhv-fp-card .hhv-fp-thumb {
    border-bottom: 0;
}

/* Số cột theo số mặt bằng (máy tính): 1 → full, 2 → chia đôi, ≥3 → 3 cột */
.hhv-fp-grid.hhv-fp-count-1 {
    grid-template-columns: minmax(0, 1fr);
}

.hhv-fp-grid.hhv-fp-count-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* 1 mặt bằng: ảnh theo tỉ lệ thật, không ép khung 4:3 (tránh khoảng trống trên/dưới) */
.hhv-fp-count-1 .hhv-fp-thumb {
    aspect-ratio: auto;
    padding: 16px;
}

.hhv-fp-count-1 .hhv-fp-thumb .hhv-fp-img,
.hhv-fp-count-1 .hhv-fp-thumb img {
    position: static;
    display: block;
    width: 100% !important;
    height: auto !important;
    max-height: 80vh;
    margin: 0 auto;
}

/* Máy tính bảng */
@media (max-width: 991px) {
    .hhv-fp-grid {
        gap: 20px;
    }
}

/* Điện thoại: 1 cột như layout cũ (ảnh to), chỉ hiện sẵn 2 mặt bằng — xem huong_floorplan_limit_css() */
@media (max-width: 767px) {
    .hhv-fp-grid,
    .hhv-fp-grid.hhv-fp-count-2 {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    /* Khối Floor Plans của theme đã có khung viền → thẻ không vẽ viền thứ hai
       (2 lớp viền lệch nhau trên điện thoại). Thẻ sát mép khung, ngăn cách bằng đường kẻ. */
    .hhv-fp-grid {
        padding: 0;
        margin-top: 0;
    }

    .hhv-fp-card {
        border: 0;
        border-radius: 0;
        box-shadow: none !important;
    }

    .hhv-fp-card + .hhv-fp-card {
        border-top: 1px solid #eee8e0;
        padding-top: 16px;
    }

    .hhv-fp-body {
        padding-left: 0;
        padding-right: 0;
    }

    /* bỏ lề quanh ảnh: màn hình hẹp, ảnh cần rộng hết thẻ */
    .hhv-fp-thumb,
    .hhv-fp-count-1 .hhv-fp-thumb {
        padding: 0;
    }

    .hhv-fp-thumb .hhv-fp-img,
    .hhv-fp-thumb img {
        inset: 0;
        width: 100% !important;
        height: 100% !important;
    }

    .hhv-fp-count-1 .hhv-fp-thumb .hhv-fp-img,
    .hhv-fp-count-1 .hhv-fp-thumb img {
        height: auto !important;
    }

    .hhv-fp-more-wrap {
        padding-top: 20px;
    }

    .hhv-fp-more-btn {
        width: 100%;
    }
}

/* Bản in: 2 cột, hiện hết */
.hhv-fp-print {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media print {
    .hhv-fp-zoom,
    .hhv-fp-more-wrap {
        display: none;
    }
}

/* Lightbox: slide không có thông số / mô tả → bỏ cột phải, ảnh rộng hết khung,
   tên mặt bằng nằm trên hàng nút (nút + − ⟲ góc trái, × góc phải), nền trắng liền. */
.lightbox_property_wrapper_floorplans .item.hhv-fp-nodetails {
    position: relative;
    box-sizing: border-box;
    padding: 64px 24px 24px !important; /* 64 = hàng nút 16 + 40 + 8 */
    background: #fff !important;
}

.lightbox_property_wrapper_floorplans .item.hhv-fp-nodetails .itemimage {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    flex: 0 0 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
}

.lightbox_property_wrapper_floorplans .item.hhv-fp-nodetails .itemimage img {
    /* ảnh vừa khung cả ngang lẫn dọc (ảnh cao/vuông trước đây bị cắt mép dưới).
       Không dùng !important: floorplan-zoom.js đặt width/height/max-* bằng style inline khi zoom. */
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    /* khung ảnh của theme (.itemimage) cao tối đa 580px, overflow hidden → ảnh không vượt 580px */
    max-height: min(calc(100vh - 180px), 580px);
    object-fit: contain;
    margin: 0 auto;
}

/* Tên mặt bằng: căn giữa khung, cùng hàng với nút zoom (top 16px, cao 40px) */
.lightbox_property_wrapper_floorplans .item.hhv-fp-nodetails .lightbox_floor_details {
    display: block !important;
    position: absolute !important;
    top: 16px !important;
    left: 200px !important;
    right: 200px !important;
    bottom: auto !important;
    width: auto !important;
    max-width: none !important;
    height: 40px !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    transform: none !important;
    background: transparent !important;
    border: 0 !important;
    text-align: center !important;
    pointer-events: none;
    z-index: 2;
}

.lightbox_property_wrapper_floorplans .item.hhv-fp-nodetails .floor_title {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 25px !important;
    font-weight: 600;
    line-height: 40px !important;
    color: #2b2523;
    text-align: center !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lightbox_property_wrapper_floorplans .item.hhv-fp-nodetails .floor_light_desc,
.lightbox_property_wrapper_floorplans .item.hhv-fp-nodetails .floor_details {
    display: none !important;
}

@media (max-width: 767px) {
    /* điện thoại: 3 nút chiếm ~150px bên trái, × ~44px bên phải → tên nằm khoảng giữa */
    .lightbox_property_wrapper_floorplans .item.hhv-fp-nodetails {
        padding: 64px 12px 12px !important;
    }
    .lightbox_property_wrapper_floorplans .item.hhv-fp-nodetails .lightbox_floor_details {
        left: 150px !important;
        right: 44px !important;
    }
    .lightbox_property_wrapper_floorplans .item.hhv-fp-nodetails .floor_title {
        font-size: 17px !important;
    }
}

/* Nút đóng lightbox: tròn tối 40px như nút zoom (+ − ⟲), góc trên phải */
.lightbox_property_wrapper_floorplans .lighbox-image-close-floor {
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    left: auto !important;
    z-index: 1002;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px !important;
    height: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 50%;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    cursor: pointer;
    transition: background .15s ease;
}

.lightbox_property_wrapper_floorplans .lighbox-image-close-floor:hover {
    background: rgba(0, 0, 0, .85);
}

.lightbox_property_wrapper_floorplans .lighbox-image-close-floor i,
.lightbox_property_wrapper_floorplans .lighbox-image-close-floor svg {
    margin: 0 !important;
    color: #fff !important;
    fill: #fff;
    font-size: 18px !important;
    line-height: 1 !important;
    width: auto;
    height: auto;
}

@media (max-width: 767px) {
    .lightbox_property_wrapper_floorplans .lighbox-image-close-floor {
        top: 10px !important;
        right: 10px !important;
        width: 36px !important;
        height: 36px !important;
    }
    .lightbox_property_wrapper_floorplans .lighbox-image-close-floor i {
        font-size: 16px !important;
    }
}

/* Nút ‹ › trên slide không có cột chi tiết: .owl-nav rộng hết khung (class do floorplan-grid.js gắn) */
#owl-demo-floor.hhv-fp-navfull .owl-nav {
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
}
