/* ============================================
   TRANG CHI TIẾT BẤT ĐỘNG SẢN
   Dùng chung biến & thành phần cơ bản từ style.css,
   chỉ định nghĩa riêng phần bố cục trang chi tiết.
   ============================================ */

/* ===== Breadcrumb ===== */
.detail-breadcrumb {
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
  padding: 90px 0 14px;
  margin-bottom: 28px;
}
.detail-breadcrumb .container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.detail-breadcrumb a { color: var(--text-secondary); transition: var(--transition); }
.detail-breadcrumb a:hover { color: var(--primary); }
.detail-breadcrumb .crumb-sep { color: var(--gray-400); }
.detail-breadcrumb .crumb-current {
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

/* ===== Bố cục chính ===== */
.detail-page { padding-bottom: 60px; min-height: 40vh; }
.detail-loading {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
  font-size: 15px;
}
.detail-notfound {
  text-align: center;
  padding: 90px 20px;
}
.detail-notfound h2 { font-family: var(--font-heading); margin-bottom: 10px; }
.detail-notfound p { color: var(--text-secondary); margin-bottom: 24px; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 36px;
  align-items: start;
}

/* ===== Tags trạng thái ===== */
.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tag {
  display: inline-flex; align-items: center;
  padding: 5px 14px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.tag-type { background: var(--primary-light); color: var(--primary-dark); }
.tag-status { background: var(--gray-200); color: var(--gray-700); }
.tag-status.status-available { background: var(--primary); color: var(--white); }
.tag-status.status-pending { background: var(--accent-gold); color: var(--white); }
.tag-status.status-sold { background: var(--navy); color: var(--white); }
.tag-badge.badge-new { background: var(--primary); color: var(--white); }
.tag-badge.badge-hot { background: var(--accent-red); color: var(--white); }
.tag-badge.badge-sale { background: var(--accent-gold); color: var(--white); }
.tag-id { background: var(--gray-100); color: var(--text-secondary); font-weight: 600; }

/* ===== Tiêu đề & địa chỉ ===== */
.detail-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.detail-address {
  display: flex; align-items: flex-start; gap: 7px;
  color: var(--text-secondary);
  font-size: 14.5px;
  margin-bottom: 16px;
}
.detail-address svg { width: 18px; height: 18px; stroke: var(--primary); flex-shrink: 0; margin-top: 1px; }

.detail-meta-row {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 18px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--gray-200);
  color: var(--text-secondary);
  font-size: 13.5px;
}
.detail-meta-row > span { display: flex; align-items: center; gap: 6px; }
.detail-meta-row svg { width: 17px; height: 17px; stroke: var(--gray-500); }
.detail-share { display: flex; gap: 8px; margin-left: auto; }
.share-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  color: var(--text-secondary);
}
.share-btn:hover { background: var(--primary); color: var(--white); }
.share-btn svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
#share-copy svg { fill: none; stroke: currentColor; stroke-width: 2; }

/* ===== Gallery ảnh ===== */
.detail-gallery { margin-bottom: 26px; }
.gallery-main {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--gray-100);
  box-shadow: var(--shadow-md);
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.gallery-nav:hover { background: var(--white); transform: translateY(-50%) scale(1.08); }
.gallery-nav svg { width: 20px; height: 20px; }
.gallery-prev { left: 14px; }
.gallery-next { right: 14px; }
.gallery-counter {
  position: absolute; right: 14px; bottom: 14px;
  background: rgba(26,35,50,0.72);
  color: var(--white);
  font-size: 12px; font-weight: 600;
  padding: 4px 12px;
  border-radius: 50px;
}
.gallery-thumbs {
  display: flex; gap: 10px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.gallery-thumb {
  flex-shrink: 0;
  width: 84px; height: 62px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  opacity: 0.6;
  border: 2px solid transparent;
  transition: var(--transition);
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb.active { opacity: 1; border-color: var(--primary); }
.gallery-thumb:hover { opacity: 1; }

/* ===== Thông số nhanh ===== */
.detail-quickfacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 30px;
}
.quickfact-item {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  gap: 6px;
  padding: 16px 10px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}
.qf-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
}
.qf-icon svg { width: 19px; height: 19px; stroke: var(--primary); }
.qf-value { font-family: var(--font-heading); font-weight: 700; font-size: 15px; color: var(--text-primary); }
.qf-label { font-size: 11.5px; color: var(--text-secondary); }

/* ===== Khối nội dung chung ===== */
.detail-block { margin-bottom: 32px; }
.detail-block h2 {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-left: 12px;
  border-left: 3px solid var(--primary);
}
.detail-description {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 14.5px;
}

/* ===== Bảng thông số (lưới 2 cột, mỗi ô là 1 cặp nhãn/giá trị) ===== */
.detail-spec-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.spec-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-200);
}
.spec-row:nth-child(odd) { border-right: 1px solid var(--gray-200); }
.spec-row.spec-row-alt { background: var(--gray-50); }
.spec-row.spec-row-full { grid-column: 1 / -1; border-right: none; }
.spec-row.spec-row-last { border-bottom: none; }
.spec-label { color: var(--text-secondary); }
.spec-value { color: var(--text-primary); font-weight: 600; text-align: right; }

@media (max-width: 560px) {
  .detail-spec-table { grid-template-columns: 1fr; }
  .spec-row:nth-child(odd) { border-right: none; }
  .spec-row:nth-child(even) { background: var(--gray-50); }
  .spec-row.spec-row-alt { background: var(--white); }
  .spec-row.spec-row-last:not(:last-child) { border-bottom: 1px solid var(--gray-200); }
}

/* ===== Tiện ích ===== */
.detail-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 20px;
}
.detail-features li {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 14px;
  color: var(--text-primary);
}
.detail-features svg { width: 18px; height: 18px; stroke: var(--primary); flex-shrink: 0; margin-top: 2px; }

/* ===== Đặc quyền vay ===== */
.loan-privilege-banner {
  background: linear-gradient(135deg, var(--primary-light), #eef8f1);
  border: 1px solid #cfe9d9;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}
.loan-privilege-banner > p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 16px;
}
.loan-privilege-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 20px; }
.loan-privilege-list li { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; color: var(--text-primary); }
.loan-privilege-list svg { width: 18px; height: 18px; stroke: var(--primary); flex-shrink: 0; margin-top: 2px; }

/* ===== Máy tính khoản vay ===== */
.loan-calc-inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 22px;
}
.loan-input-item { display: flex; flex-direction: column; gap: 6px; position: relative; }
.loan-input-item label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
}
.loan-input-item label svg { width: 15px; height: 15px; stroke: var(--primary); }
.loan-input-item input {
  padding: 10px 42px 10px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.loan-input-item input:focus { outline: none; border-color: var(--primary); }
.loan-input-suffix {
  position: absolute; right: 12px; bottom: 10px;
  font-size: 12px; color: var(--text-light); font-weight: 600;
  pointer-events: none;
}
#lc-value-hint { position: static; margin-top: -2px; color: var(--primary-dark); font-weight: 600; }
.loan-calc-btn { grid-column: span 1; justify-content: center; padding: 12px; white-space: nowrap; }
.loan-calc-btn svg { width: 17px; height: 17px; }

.loan-calc-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 30px;
}
.loan-stat {
  background: var(--navy);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.loan-stat-label { font-size: 12px; color: rgba(255,255,255,0.6); }
.loan-stat-value { font-family: var(--font-heading); font-size: 19px; font-weight: 800; color: var(--accent-gold); }
.loan-stat-value small { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.7); }
.loan-stat-sub { font-size: 11.5px; color: rgba(255,255,255,0.55); }
.loan-empty { color: var(--text-secondary); font-size: 13.5px; padding: 10px 0; }

.loan-calc-chart-wrap { margin-bottom: 30px; }
.loan-chart-title, .loan-table-title {
  font-size: 13.5px; font-weight: 700; color: var(--text-primary); margin-bottom: 14px;
}
.loan-chart-title span, .loan-table-title span { font-weight: 400; color: var(--text-secondary); }
.loan-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 160px;
  padding: 10px 6px 0;
  border-bottom: 1.5px solid var(--gray-200);
  overflow-x: auto;
}
.loan-bar-col {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  flex: 1 0 26px;
  height: 100%;
  gap: 4px;
}
.loan-bar-value { font-size: 10px; color: var(--text-secondary); white-space: nowrap; }
.loan-bar {
  width: 60%;
  min-width: 10px;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  border-radius: 3px 3px 0 0;
}
.loan-bar-label { font-size: 10px; color: var(--text-light); }

.loan-table-toolbar {
  display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px;
  margin-bottom: 10px;
}
.loan-view-toggle { display: flex; gap: 6px; background: var(--gray-100); padding: 4px; border-radius: 50px; }
.loan-view-toggle button {
  padding: 6px 14px; border-radius: 50px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
  background: transparent; transition: var(--transition);
}
.loan-view-toggle button.active { background: var(--primary); color: var(--white); }

.loan-table-scroll { overflow-x: auto; border: 1px solid var(--gray-200); border-radius: var(--radius-md); }
.loan-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.loan-table th {
  background: var(--gray-50);
  text-align: left;
  padding: 10px 14px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--gray-200);
}
.loan-table td { padding: 10px 14px; border-bottom: 1px solid var(--gray-100); color: var(--text-primary); white-space: nowrap; }
.loan-table tr:last-child td { border-bottom: none; }
.loan-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

.loan-table-pagination { display: flex; justify-content: center; gap: 6px; margin-top: 14px; }
.loan-table-pagination button {
  min-width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--text-secondary);
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.loan-table-pagination button svg { width: 14px; height: 14px; }
.loan-table-pagination button.active { background: var(--primary); border-color: var(--primary); color: var(--white); }
.loan-table-pagination button:disabled { opacity: 0.4; cursor: default; }
.loan-table-pagination button:not(:disabled):not(.active):hover { border-color: var(--primary); color: var(--primary); }

.loan-calc-disclaimer { font-size: 12px; color: var(--text-light); line-height: 1.6; margin-top: 16px; }

@media (max-width: 720px) {
  .loan-calc-inputs { grid-template-columns: 1fr 1fr; }
  .loan-calc-btn { grid-column: 1 / -1; }
  .loan-calc-results { grid-template-columns: 1fr; }
}

/* ===== BĐS tương tự ===== */
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.related-card { display: block; }
.related-card .card-image { height: 160px; }

/* ===== Sidebar ===== */
.detail-sidebar {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-price-card {
  background: linear-gradient(150deg, var(--navy), var(--navy-light));
  border-radius: var(--radius-lg);
  padding: 24px;
  color: var(--white);
  box-shadow: var(--shadow-lg);
}
.price-orig {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  text-decoration: line-through;
  margin-bottom: 4px;
}
.price-main-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.price-main {
  font-family: var(--font-heading);
  font-size: 30px;
  font-weight: 800;
  color: var(--accent-gold);
}
.price-discount {
  background: var(--accent-red);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
}
.price-note { font-size: 12.5px; color: rgba(255,255,255,0.65); margin-bottom: 18px; }
.detail-price-card .btn-primary svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn-block { width: 100%; justify-content: center; margin-bottom: 10px; }
.detail-price-card .btn-primary { background: linear-gradient(135deg, var(--accent-gold), #c8850f); }
.detail-price-card .btn-outline { border-color: rgba(255,255,255,0.4); color: var(--white); }
.detail-price-card .btn-outline:hover { background: rgba(255,255,255,0.12); color: var(--white); }
.detail-price-card .btn-block:last-child { margin-bottom: 0; }

.detail-contact-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.detail-contact-card h3 { font-family: var(--font-heading); font-size: 17px; margin-bottom: 6px; }
.contact-card-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.detail-contact-card .form-group { margin-bottom: 14px; }
.detail-contact-card .form-submit { width: 100%; justify-content: center; }

.detail-trust-card {
  background: var(--primary-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.trust-item { display: flex; gap: 12px; align-items: flex-start; }
.trust-item svg { width: 22px; height: 22px; stroke: var(--primary-dark); flex-shrink: 0; margin-top: 1px; }
.trust-item strong { display: block; font-size: 13.5px; color: var(--text-primary); margin-bottom: 2px; }
.trust-item small { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

/* ===== Responsive ===== */
@media (max-width: 980px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-sidebar { position: static; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .detail-breadcrumb { padding-top: 78px; }
  .detail-title { font-size: 22px; }
  .gallery-nav { width: 36px; height: 36px; }
  .related-grid { grid-template-columns: 1fr; }
  .detail-meta-row { gap: 12px; }
  .detail-share { margin-left: 0; width: 100%; justify-content: flex-end; }
}

/* ============================================
   NỘI DUNG MÁY CHỦ DỰNG SẴN
   Máy chủ điền sẵn tiêu đề, giá, mô tả và ảnh vào HTML để Google và
   Facebook đọc được ngay mà không cần chạy JavaScript. Khối này chỉ hiện
   trong tích tắc rồi bị bản đầy đủ thay thế, nên phải trông gọn gàng chứ
   không được là một đống chữ trần.
   ============================================ */
.detail-prerender {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 0 48px;
  color: #334155;
  line-height: 1.7;
}

.detail-prerender h1 {
  font-size: clamp(22px, 3.2vw, 32px);
  line-height: 1.3;
  color: #0f172a;
  margin: 0 0 12px;
}

.detail-prerender p { margin: 0 0 10px; }
.detail-prerender strong { color: #047857; font-size: 1.15em; }

.detail-prerender img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  margin-top: 14px;
  background: #f1f5f9;
}

/* Chỉ tải sẵn ảnh đầu tiên - các ảnh sau để bản đầy đủ lo, tránh tải hai lần */
.detail-prerender img:not(:first-of-type) { display: none; }

/* ============================================
   TRANG CHUYÊN ĐỀ THEO KHU VỰC
   ============================================ */
.danh-muc { padding: 28px 0 64px; }

.dm-duong { font-size: 14px; color: #64748b; margin-bottom: 18px; }
.dm-duong a { color: #047857; text-decoration: none; }
.dm-duong a:hover { text-decoration: underline; }
.dm-duong span { margin: 0 6px; color: #cbd5e1; }

.dm-dau { margin-bottom: 28px; }
.dm-dau h1 { font-size: clamp(23px, 3.4vw, 34px); line-height: 1.25; color: #0f172a; margin: 0 0 10px; }
.dm-so { color: #047857; font-weight: 600; margin: 0 0 8px; }
.dm-mota { color: #475569; line-height: 1.7; max-width: 760px; margin: 0; }

.dm-luoi { list-style: none; padding: 0; margin: 0; display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.dm-the { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease; }
.dm-the:hover { box-shadow: 0 10px 28px rgba(15,23,42,.12); transform: translateY(-3px); }
.dm-the a { text-decoration: none; color: inherit; display: block; }
.dm-the img { width: 100%; height: 200px; object-fit: cover; display: block; background: #f1f5f9; }
.dm-than { padding: 14px 16px 18px; }
.dm-than h3 { font-size: 16px; line-height: 1.4; margin: 0 0 8px; color: #0f172a;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dm-dc { font-size: 13px; color: #64748b; margin: 0 0 10px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dm-gia { margin: 0 0 6px; }
.dm-gia strong { color: #047857; font-size: 19px; }
.dm-giam { background: #fee2e2; color: #b91c1c; font-size: 12px; font-weight: 700;
  padding: 2px 7px; border-radius: 6px; margin-left: 6px; }
.dm-tt { font-size: 13px; color: #64748b; margin: 0; }

.dm-khac { margin-top: 48px; padding-top: 28px; border-top: 1px solid #e2e8f0; }
.dm-khac h2 { font-size: 19px; color: #0f172a; margin: 0 0 14px; }
.dm-khac ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.dm-khac a { display: inline-block; padding: 8px 14px; background: #f1f5f9; border-radius: 999px;
  color: #334155; text-decoration: none; font-size: 14px; transition: background .15s ease; }
.dm-khac a:hover { background: #d1fae5; color: #047857; }
.dm-khac a span { color: #94a3b8; }

.dm-lienhe { margin-top: 40px; padding: 24px; background: #ecfdf5; border-radius: 14px; text-align: center; }
.dm-lienhe h2 { font-size: 18px; color: #065f46; margin: 0 0 8px; }
.dm-lienhe p { margin: 0; color: #047857; }
.dm-lienhe a { color: #047857; font-weight: 700; font-size: 20px; text-decoration: none; }

@media (max-width: 600px) {
  .dm-luoi { grid-template-columns: 1fr; }
  .dm-the img { height: 210px; }
}
