/* ============================================================
   listing-detail.css — Trang chi tiết chuyển nhượng / cho thuê
   Tông màu & token lấy từ variable.css (không hard code).
   ============================================================ */
*::before, *::after { box-sizing: border-box; }

/* ── Container: nền xám nhạt, căn giữa ── */
.detail-container {
    margin: 0 auto;
    padding: 24px 20px 40px;
    background: #f5f6f8;
}

/* ── Breadcrumb ── */
.breadcrumb {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    font-size: 13px; color: var(--muted); margin-bottom: 16px;
    padding: 0; list-style: none;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb .sep { color: #ccc; }
.breadcrumb .current { color: var(--text); font-weight: 500; }

/* ══════════════════ HEADER: tiêu đề + hộp giá (khối 1) ══════════════════ */
.ld-head {
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    background: var(--white); border: 1px solid var(--border);
    border-radius: 14px; padding: 20px 24px; margin-bottom: 16px;
}
.ld-head-main { flex: 1; min-width: 0; }

.ld-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px;
    font-size: 12.5px; font-weight: 700; margin-bottom: 10px;
}
.ld-badge--transfer { background: #e7f9ee; color: #0f7b43; }
.ld-badge--rent     { background: #e7f1ff; color: #1565c0; }

.ld-title {
    font-size: 24px; font-weight: 800; color: var(--text);
    line-height: 1.35; margin: 0 0 10px;
}
.ld-addr {
    display: flex; align-items: flex-start; gap: 6px;
    font-size: 14px; color: var(--muted); margin: 0;
}
.ld-addr svg {
    width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px;
    stroke: #aaa; fill: none; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
}

.ld-price-box {
    flex-shrink: 0; min-width: 210px; text-align: center;
    background: var(--white); border: 1px solid var(--border);
    border-radius: 12px; padding: 16px 20px;
}
.ld-price-label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.ld-price-val   { font-size: 26px; font-weight: 900; color: var(--red); line-height: 1.2; }
.ld-price-unit  { font-size: 14px; font-weight: 600; }
.ld-price-per   { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Nút "Quan tâm" (wishlist) trong hộp giá */
.spb-wish-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; margin-top: 12px; padding: 9px 0;
    border-radius: 8px; border: 1.5px solid var(--border);
    background: var(--white); color: var(--muted); font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all .2s;
}
.spb-wish-btn i { font-size: 14px; }
.spb-wish-btn:hover { border-color: var(--red); color: var(--red); }
.spb-wish-btn:hover i { color: var(--red); }
.spb-wish-btn.wishlisted { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.spb-wish-btn.wishlisted i { color: var(--red) !important; }

/* ══════════════════ GALLERY: 1 ảnh lớn + lưới 4 ảnh (khối 2) ══════════════════ */
.ld-gallery {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 420px;            /* chiều cao CỐ ĐỊNH — ảnh dù cao/dài cũng không kéo tràn */
    gap: 16px; margin-bottom: 16px; overflow: hidden;
    background: var(--white); border: 1px solid var(--border);
    border-radius: 14px; padding: 16px;
}
.ld-gallery.is-single { grid-template-columns: minmax(0, 1fr); }

.ld-g-main {
    position: relative; height: 100%; min-width: 0; overflow: hidden;
    border-radius: 12px; cursor: pointer; background: #111;
}
/* Ảnh phủ tuyệt đối trong ô → object-fit cover crop, không thể đẩy to khung */
.ld-g-main img,
.ld-g-cell img {
    position: absolute; inset: 0;
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform .3s;
}
.ld-g-main:hover img,
.ld-g-cell:hover img { transform: scale(1.04); }

.ld-g-count {
    position: absolute; top: 12px; right: 12px;
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(0,0,0,.55); color: #fff;
    padding: 4px 11px; border-radius: 16px;
    font-size: 12.5px; font-weight: 600; pointer-events: none;
}

.ld-g-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px; height: 100%; min-width: 0;
}
.ld-g-cell {
    position: relative; min-width: 0; min-height: 0; overflow: hidden;
    border-radius: 10px; cursor: pointer; background: #111;
}
.ld-g-more::after {
    content: ''; position: absolute; inset: 0; background: rgba(0,0,0,.5);
}
.ld-g-more-txt {
    position: absolute; inset: 0; z-index: 1;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 18px; font-weight: 700;
}

.ld-g-noimg {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; height: 300px; background: #f0f0f0; color: #bbb; cursor: default;
}
/* Gallery rỗng (chưa có ảnh): card co theo placeholder, không chiếm 420px */
.ld-gallery--empty { grid-template-rows: auto; }
.ld-g-noimg svg { width: 52px; height: 52px; stroke: currentColor; fill: none; stroke-width: 1; }
.ld-g-noimg p { margin: 0; font-size: 14px; }

/* Mũi tên điều hướng ảnh lớn — tròn trắng, bóng đổ, chevron tối */
.gallery-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 38px; height: 38px; border-radius: 50%;
    background: #fff; color: #333; border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,.25);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 3; font-size: 15px; transition: all .15s;
}
.gallery-nav:hover {
    color: var(--red); transform: translateY(-50%) scale(1.08);
    box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.gallery-nav.prev { left: 14px; }
.gallery-nav.next { right: 14px; }

/* Ô preview đang được chọn — viền đỏ vẽ bằng ::before (z-index trên ảnh absolute,
   nếu dùng outline/box-shadow sẽ bị ảnh phủ lên che mất). */
.ld-g-cell.active::before {
    content: ''; position: absolute; inset: 0; z-index: 3;
    border: 3px solid var(--red); border-radius: 10px; pointer-events: none;
}

@media (max-width: 768px) {
    .ld-gallery { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
    .ld-g-main  { height: 260px; }
    .ld-g-side  { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); height: 74px; }
}

@media (min-width: 1200px) {
    .ld-gallery { grid-template-rows: 580px; }
}

@media (min-width: 1400px) {
    .ld-gallery { grid-template-rows: 700px; }
}

/* ══════════════════ CARD chung ══════════════════ */
.ld-card {
    background: var(--white); border: 1px solid var(--border);
    border-radius: 14px; padding: 20px 24px; margin-bottom: 16px;
}
.ld-card-title {
    position: relative; display: flex; align-items: center;
    font-size: 18px; font-weight: 700; color: var(--text);
    margin: 0 0 16px; padding-left: 14px;
}
.ld-card-title::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 4px; height: 18px; background: var(--red); border-radius: 3px;
}
/* Header section Tiện ích: tiêu đề (trái) + link sang tiện ích dự án (phải). */
.ld-amenities-head {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
}
.ld-amenities-head .ld-card-title { margin-bottom: 0; }
.ld-amenities-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13.5px; font-weight: 600; color: var(--red);
    text-decoration: none; white-space: nowrap; transition: gap .2s;
}
.ld-amenities-link:hover { gap: 10px; }
.ld-amenities-link i { font-size: 12px; }

/* ── Thông tin nổi bật ── */
.ld-feats {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 16px;
}
.ld-feat { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ld-feat-ic {
    width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
    background: var(--pink-level-1); color: var(--red);
    display: flex; align-items: center; justify-content: center;
}
.ld-feat-ic svg {
    width: 20px; height: 20px; stroke: currentColor; fill: none;
    stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.ld-feat-txt { display: flex; flex-direction: column; min-width: 0; }
.ld-feat-label { font-size: 14px; color: var(--text); font-weight: 500;}
.ld-feat-val   { font-size: 14px; color: var(--text); line-height: 1.3; word-break: break-word; }

@media (max-width: 768px) { .ld-feats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .ld-feats { grid-template-columns: 1fr; } }

/* ── Tiện ích ── */
.ld-amenities {
    display: flex; flex-wrap: wrap; gap: 10px;
    background: var(--pink-level-1); padding: 14px; border-radius: 10px;
}
.ld-amenity {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px; background: var(--white);
    border: 1px solid var(--border); border-radius: 24px;
    font-size: 14px; color: var(--text); font-weight: 500;
}
.ld-amenity i { color: var(--red); font-size: 12px; }

/* Card Tiện ích nền hồng cả khối (theo thiết kế) */
.ld-card--amenities { background: var(--pink-level-1); border-color: var(--pink-level-2); }
.ld-card--amenities .ld-amenities { background: transparent; padding: 0; }

/* ── 2 cột: mô tả + vị trí (2 card luôn bằng chiều cao) ── */
.ld-2col {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    align-items: stretch; margin-bottom: 16px;
}
/* Card trong row: flex dọc, bỏ margin-bottom (khoảng cách dùng gap của grid) */
.ld-2col > .ld-card { display: flex; flex-direction: column; margin-bottom: 0; }
@media (max-width: 860px) { .ld-2col { grid-template-columns: 1fr; } }

.ld-desc { font-size: 14px; color: #444; white-space: pre-wrap; }
.ld-desc--empty { color: #aaa; font-style: italic; }
.ld-highlights {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin-top: 16px; padding-top: 16px; border-top: 1px solid #f0f0f0;
}
.ld-highlight {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 14px; color: var(--text);
    background: var(--pink-level-1); padding: 7px 12px; border-radius: 8px;
}
.ld-highlight i { color: var(--red); }

/* ── Bản đồ ── (flex:1 để lấp đầy chiều cao card khi row stretch) */
.ld-map { flex: 1 1 auto; min-height: 260px; border-radius: 10px; overflow: hidden; background: #f0f0f0; }
.ld-map iframe { display: block; width: 100%; height: 100%; min-height: 260px; border: 0; }
.ld-map-ph {
    height: 100%; min-height: 260px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px;
    color: #aaa; font-size: 14px; text-align: center; padding: 16px;
}
.ld-map-ph svg { width: 36px; height: 36px; stroke: #ddd; fill: none; stroke-width: 1.2; }
.ld-map-link {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
    font-size: 14px; color: var(--red); font-weight: 600; text-decoration: none;
}
.ld-map-link:hover { opacity: .8; }

/* ══════════════════ LIÊN HỆ XEM NHÀ ══════════════════ */
.ld-cta {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    background: var(--pink-level-1); border: 1px solid var(--pink-level-2);
    border-radius: 14px; padding: 18px 24px; margin-top: 16px;
}
.ld-cta-info { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ld-cta-ic {
    width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
    background: var(--red); color: #fff; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
}
.ld-cta-title { font-size: 16px; font-weight: 700; color: var(--text); }
.ld-cta-sub   { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ld-cta-phone { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 15px; font-weight: 800; color: var(--primary); text-decoration: none; }
.ld-cta-actions { display: flex; gap: 10px; flex-shrink: 0; }
.ld-cta-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: 10px; font-size: 14.5px; font-weight: 700;
    background: var(--red); color: #fff; text-decoration: none;
    white-space: nowrap; transition: opacity .15s;
}
.ld-cta-btn:hover { opacity: .9; }
.ld-cta-btn--zalo { background: #0068ff; }

@media (max-width: 680px) {
    .ld-head { flex-direction: column; }
    .ld-price-box { width: 100%; min-width: 0; }
    .ld-cta { flex-direction: column; align-items: flex-start; }
    .ld-cta-actions { width: 100%; }
    .ld-cta-btn { flex: 1; }
}

/* ══════════════════ LỊCH SỬ GIÁ ══════════════════ */
.ld-ph-list { display: flex; flex-direction: column; }
.ld-ph-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 0; border-bottom: 1px solid #f4f4f4; font-size: 14px;
}
.ld-ph-row:last-child { border-bottom: none; }
.ld-ph-date  { color: #aaa; font-size: 12.5px; }
.ld-ph-change { display: inline-flex; align-items: center; gap: 8px; }
.ld-ph-old   { color: #888; text-decoration: line-through; }
.ld-ph-new   { color: var(--red); font-weight: 700; }
.ld-ph-arrow { color: #ccc; font-size: 11px; }

/* ══════════════════ HỒ SƠ & TÀI LIỆU ══════════════════ */
.doc-fe-list { display: flex; flex-direction: column; gap: 8px; }
.doc-fe-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    background: #f8f9fb; border-radius: 9px; border: 1px solid #eaecf0; transition: border-color .15s;
}
.doc-fe-item:hover { border-color: #d0d5dd; }
.doc-fe-icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doc-fe-info { flex: 1; min-width: 0; }
.doc-fe-name { font-size: 13px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-fe-type { font-size: 11.5px; color: #aaa; margin-top: 1px; }
.doc-fe-btn {
    padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600;
    color: #3b82f6; border: 1.5px solid #bfdbfe; background: #eff6ff;
    text-decoration: none; white-space: nowrap; transition: all .15s; flex-shrink: 0;
}
.doc-fe-btn:hover { background: #3b82f6; color: #fff; border-color: #3b82f6; }

/* ══════════════════ NGUỒN NHÀ TƯƠNG TỰ ══════════════════ */
.similar-section { margin: 24px auto 48px; padding: 0 16px; }
.similar-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
}
.similar-header h2 { font-size: 20px; font-weight: 700; color: var(--text); margin: 0; }
.similar-see-all {
    font-size: 14px; color: var(--red); font-weight: 600; text-decoration: none; transition: opacity .15s;
}
.similar-see-all:hover { opacity: .75; }

.similar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1024px) { .similar-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .similar-grid { grid-template-columns: 1fr; } }

.scard {
    display: flex; flex-direction: column; background: #fff;
    border-radius: 12px; border: 1px solid #eaecf0; overflow: hidden;
    text-decoration: none; transition: box-shadow .2s, transform .15s;
}
.scard:hover { box-shadow: 0 6px 24px rgba(0,0,0,.1); transform: translateY(-3px); }
.scard-img {
    position: relative; aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #fff5f0, #fef3e8); overflow: hidden; flex-shrink: 0;
}
.scard-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.scard:hover .scard-img img { transform: scale(1.04); }
.scard-no-img { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.scard-no-img svg { width: 40px; height: 40px; stroke: var(--red); fill: none; stroke-width: 1.2; opacity: .25; }
.scard-badge {
    position: absolute; top: 8px; left: 8px; background: var(--red); color: #fff;
    font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 4px;
}
.scard-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.scard-price { font-size: 16px; font-weight: 800; color: var(--red); }
.scard-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
.scard-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.scard-meta span { font-size: 11.5px; color: #666; background: #f8f9fb; padding: 2px 6px; border-radius: 4px; }
.scard-loc { display: flex; align-items: center; gap: 3px; font-size: 11.5px; color: #aaa; margin-top: auto; padding-top: 6px; }
.scard-loc svg { width: 11px; height: 11px; stroke: #ccc; fill: none; stroke-width: 2; flex-shrink: 0; }

/* ══════════════════ LIGHTBOX ══════════════════ */
.lightbox {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.93); z-index: 9999; align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 88vh; object-fit: contain; border-radius: 8px; }
.lb-close { position: fixed; top: 16px; right: 20px; color: #fff; font-size: 34px; cursor: pointer; background: none; border: none; line-height: 1; }
.lb-prev, .lb-next {
    position: fixed; top: 50%; transform: translateY(-50%); color: #fff; font-size: 34px;
    cursor: pointer; background: rgba(255,255,255,.12); border: none; padding: 12px 16px; border-radius: 8px;
}
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-counter { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.6); font-size: 13px; }

/* ══════════════════ PHÂN TRANG — style dùng chung đã gom về partial 'partials.pagination' (nguồn duy nhất) ══════════════════ */
