/* ==========================================================================
   MINH QUANG REALTY - PHÂN HỆ MẶT BẰNG & QUỸ CĂN TƯƠNG TÁC (PROPTECH UI)
   Thiết kế chuẩn SalePro & Keenthemes Metronic: Tinh tế, sắc nét, tương thích mọi thiết bị
   ========================================================================== */

:root {
  --color-unit-available: #10B981; /* Xanh lá: Còn trống */
  --color-unit-reserved: #F59E0B;  /* Vàng hổ phách: Giữ chỗ */
  --color-unit-sold: #EF4444;      /* Đỏ: Đã bán */
  --color-unit-primary: #C89D47;   /* Vàng ánh kim Minh Quang */
}

/* Khung tổng thể phân hệ Quỹ căn */
.inventory-hub-wrapper {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  margin-top: 16px;
  position: relative;
}

/* 1. Thanh thống kê giỏ hàng (Stats Badge Bar) */
.inventory-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #F1F5F9;
}

.inventory-stats-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  color: #334155;
}

.stat-badge-pill .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.stat-badge-pill.available .dot { background-color: var(--color-unit-available); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
.stat-badge-pill.reserved .dot { background-color: var(--color-unit-reserved); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
.stat-badge-pill.sold .dot { background-color: var(--color-unit-sold); }

/* Nút chuyển đổi View Mode */
.view-mode-toggle {
  display: inline-flex;
  background: #F1F5F9;
  padding: 4px;
  border-radius: 8px;
  gap: 4px;
}

.view-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: #64748B;
  transition: all 0.2s ease;
}

.view-mode-btn.active {
  background: #FFFFFF;
  color: #0F172A;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* 2. Thanh bộ lọc đa tiêu chí (Advanced Filter Bar) */
.inventory-filter-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 24px;
}

.filter-grid-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.filter-item-col label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

.filter-select, .filter-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  background: #FFFFFF;
  color: #1E293B;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

.filter-select:focus, .filter-input:focus {
  border-color: var(--color-unit-primary);
  box-shadow: 0 0 0 2px rgba(200, 157, 71, 0.15);
}

/* Bộ nút chọn nhanh loại căn & trạng thái */
.quick-pill-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px dashed #E2E8F0;
}

.quick-pill-filter-row span {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748B;
  margin-right: 4px;
}

.quick-pill-btn {
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid #CBD5E1;
  background: #FFFFFF;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-pill-btn:hover {
  background: #F1F5F9;
}

.quick-pill-btn.active {
  background: #0F172A;
  border-color: #0F172A;
  color: #FFFFFF;
  font-weight: 600;
}

/* 3. CHẾ ĐỘ 1: MẶT BẰNG TẦNG TƯƠNG TÁC (INTERACTIVE FLOORPLAN) */
.floorplan-stage-container {
  position: relative;
  background: #0F172A;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 480px;
}

.floorplan-img-wrapper {
  position: relative;
  width: 100%;
  max-width: 1200px;
  user-select: none;
}

.floorplan-base-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Điểm chạm Hotspot Pins */
.floorplan-hotspot-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 20;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
}

.hotspot-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #FFFFFF;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}

.floorplan-hotspot-pin.status-trong .hotspot-badge {
  background: var(--color-unit-available);
}

.floorplan-hotspot-pin.status-giu_cho .hotspot-badge {
  background: var(--color-unit-reserved);
}

.floorplan-hotspot-pin.status-da_ban .hotspot-badge {
  background: #64748B;
  opacity: 0.8;
}

.floorplan-hotspot-pin:hover {
  transform: translate(-50%, -50%) scale(1.25);
  z-index: 35;
}

.floorplan-hotspot-pin.status-trong:hover .hotspot-badge {
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.8);
}

/* Tooltip xem nhanh khi rê chuột vào hotspot */
.hotspot-tooltip-card {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  background: #FFFFFF;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  border: 1px solid #E2E8F0;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 40;
}

.floorplan-hotspot-pin:hover .hotspot-tooltip-card {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}

.tooltip-thumb {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 8px;
  background: #F8FAFC;
}

.tooltip-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.tooltip-info-row {
  font-size: 0.75rem;
  color: #64748B;
  margin-bottom: 4px;
  line-height: 1.4;
}

.tooltip-price {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-unit-primary);
  margin-top: 6px;
  border-top: 1px solid #F1F5F9;
  padding-top: 6px;
}

/* 4. CHẾ ĐỘ 2: DẠNG THẺ TRỰC QUAN (CARD GRID VIEW) */
.units-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.unit-card-item {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.unit-card-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  border-color: #CBD5E1;
}

.unit-card-header {
  position: relative;
  height: 180px;
  background: #F8FAFC;
  overflow: hidden;
  border-bottom: 1px solid #F1F5F9;
}

.unit-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  transition: transform 0.3s ease;
}

.unit-card-item:hover .unit-card-img {
  transform: scale(1.05);
}

.unit-card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #FFFFFF;
}

.unit-card-badge.status-trong { background: var(--color-unit-available); }
.unit-card-badge.status-giu_cho { background: var(--color-unit-reserved); }
.unit-card-badge.status-da_ban { background: #64748B; }

.unit-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.unit-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 4px;
}

.unit-card-type {
  font-size: 0.8125rem;
  color: #64748B;
  font-weight: 500;
  margin-bottom: 12px;
}

.unit-specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #F8FAFC;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 14px;
}

.spec-item {
  font-size: 0.8125rem;
  color: #475569;
}

.spec-item strong {
  color: #0F172A;
}

.unit-card-footer {
  margin-top: auto;
  border-top: 1px solid #F1F5F9;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.unit-price-display {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-unit-primary);
}

.unit-card-actions {
  display: flex;
  gap: 8px;
}

/* 5. MODAL CHI TIẾT CĂN HỘ (UNIT DETAIL MODAL) */
.unit-modal-dialog {
  max-width: 840px !important;
  width: 95%;
}

.unit-detail-layout-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .unit-detail-layout-grid {
    grid-template-columns: 1fr;
  }
}

.unit-modal-layout-img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
  background: #F8FAFC;
}

.unit-spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 16px;
  font-size: 0.875rem;
}

.unit-spec-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #F1F5F9;
}

.unit-spec-table td:first-child {
  color: #64748B;
  width: 45%;
}

.unit-spec-table td:last-child {
  font-weight: 600;
  color: #0F172A;
}

/* Khối phương thức thanh toán trong Modal */
.payment-plans-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}

.plan-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  padding: 6px 0;
  border-bottom: 1px dashed #E2E8F0;
}

.plan-item-row:last-child {
  border-bottom: none;
}

.plan-item-row strong {
  color: #0F172A;
}

/* 6. KHỐI TÀI LIỆU DỰ ÁN TẢI XUỐNG TRỰC TIẾP (DIRECT DOWNLOADS) */
.project-downloads-shelf {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 24px;
  margin-top: 24px;
}

.downloads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.doc-download-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 14px;
  text-decoration: none;
  color: #0F172A;
  transition: all 0.2s ease;
}

.doc-download-card:hover {
  border-color: var(--color-unit-primary);
  box-shadow: 0 4px 12px rgba(200, 157, 71, 0.15);
  transform: translateY(-2px);
}

.doc-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.doc-icon-badge.pdf { background: #FEE2E2; color: #DC2626; }
.doc-icon-badge.excel { background: #DCFCE7; color: #16A34A; }

.doc-card-info h4 {
  font-size: 0.875rem;
  font-weight: 700;
  margin: 0 0 3px 0;
  line-height: 1.3;
}

.doc-card-info p {
  font-size: 0.75rem;
  color: #64748B;
  margin: 0;
}

/* 7. BẢNG TÍNH DÒNG TIỀN & VAY NGÂN HÀNG (MORTGAGE CALCULATOR) */
.mortgage-calc-box {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 24px;
  margin-top: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.calc-grid-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  margin-top: 20px;
}

@media (max-width: 860px) {
  .calc-grid-layout {
    grid-template-columns: 1fr;
  }
}

.calc-control-group {
  margin-bottom: 18px;
}

.calc-control-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}

.calc-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #E2E8F0;
  outline: none;
  accent-color: var(--color-unit-primary);
  cursor: pointer;
}

.calc-summary-panel {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.calc-kpi-item {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #E2E8F0;
}

.calc-kpi-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.calc-kpi-label {
  font-size: 0.8125rem;
  color: #64748B;
  margin-bottom: 4px;
}

.calc-kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0F172A;
}

.calc-kpi-value.highlight {
  color: var(--color-unit-primary);
}

.calc-kpi-value.free {
  color: #10B981;
}

