/* style.css — Giao diện website BĐS (Dự án PW) */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  background: #f4f6f8;
  color: #1f2937;
  line-height: 1.5;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ── Header ── */
.site-header {
  background: linear-gradient(135deg, #0f3d5c, #15607f);
  color: #fff;
  padding: 20px 0;
  margin-bottom: 20px;
}
.header-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.site-header h1 { font-size: 24px; }
.tagline { opacity: 0.9; font-size: 14px; }

/* ── Bộ lọc ── */
.filter-panel {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.filter-grid label { display: flex; flex-direction: column; font-size: 13px; font-weight: 600; color: #374151; gap: 4px; }
.filter-grid select, .filter-grid input {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}
.filter-actions { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filter-actions label { display: flex; flex-direction: column; font-size: 13px; font-weight: 600; color: #374151; gap: 4px; }
.filter-actions select { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; }
button {
  padding: 9px 18px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
}
#btn-search { background: #15607f; color: #fff; }
#btn-search:hover { background: #0f4a63; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }

/* ── Kết quả ── */
.results-header { margin: 8px 0 12px; font-size: 15px; font-weight: 600; color: #374151; }

.house-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.house-card {
  display: block;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: transform 0.15s, box-shadow 0.15s;
}
.house-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,0.15); }

.card-img {
  height: 150px;
  background: linear-gradient(135deg, #cfe3ef, #e8f1f7);
  display: flex; align-items: center; justify-content: center;
  font-size: 56px;
}
.card-body { padding: 14px; }
.card-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.card-price { font-size: 18px; font-weight: 800; color: #b45309; margin-bottom: 8px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: #4b5563; margin-bottom: 8px; }
.card-hem { font-size: 13px; color: #15607f; font-weight: 600; margin-bottom: 8px; }
.card-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.badge {
  background: #dbeafe; color: #1e40af;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.card-update { font-size: 12px; color: #9ca3af; }

/* ── Badge colors ── */
.badge-sieu-pham { background: #fef3c7; color: #92400e; }
.badge-rat-tot { background: #d1fae5; color: #065f46; }
.badge-nha-pho { background: #e0e7ff; color: #3730a3; }

/* ── Placeholder for missing images ── */
.card-img-placeholder {
  height: 150px;
  background: linear-gradient(135deg, #1a6b8a, #2d9cb8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  font-weight: 600;
  text-align: center;
  padding: 12px;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.loading, .empty, .error { text-align: center; padding: 30px; color: #6b7280; }
.error { color: #b91c1c; }

/* ── Thông báo trạng thái inline (admin panel) ── */
.success-message {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
/* loading trạng thái inline (không phải bảng) */
p.loading, div.loading, span.loading {
  padding: 0;
  text-align: left;
  color: #2563eb;
  font-size: 14px;
  font-weight: 500;
}

/* ── Phân trang ── */
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 24px 0; }
.pagination button { background: #fff; border: 1px solid #d1d5db; color: #374151; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
#page-info { font-size: 14px; color: #374151; }

/* ── Footer ── */
.site-footer { margin-top: 30px; background: #1f2937; color: #d1d5db; padding: 18px 0; font-size: 13px; text-align: center; }

/* ── Trang chi tiết ── */
.detail-wrap { max-width: 760px; margin: 0 auto; }
.detail-card {
  background: #fff; border-radius: 10px; padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08); margin-bottom: 16px;
}
.detail-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.detail-sub { color: #6b7280; margin-bottom: 12px; }
.detail-price { font-size: 26px; font-weight: 800; color: #b45309; margin-bottom: 14px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.detail-table td { padding: 8px 10px; border-bottom: 1px solid #f3f4f6; }
.detail-table td:first-child { font-weight: 600; color: #374151; width: 40%; }
.vip-note {
  background: #fef3c7; border: 1px solid #fcd34d; color: #92400e;
  border-radius: 8px; padding: 12px; font-size: 14px; margin-top: 12px;
}
.back-link { display: inline-block; margin-bottom: 14px; color: #15607f; font-weight: 600; text-decoration: none; }

/* ── Đăng nhập / Đăng ký ── */
.auth-wrap { display: flex; justify-content: center; }
.auth-card {
  background: #fff; border-radius: 10px; padding: 22px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08); width: 100%; max-width: 420px;
}
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  flex: 1; padding: 9px; border: 1px solid #d1d5db; background: #f9fafb;
  border-radius: 6px; font-weight: 600; color: #374151; cursor: pointer;
}
.tab.active { background: #15607f; border-color: #15607f; color: #fff; }
#form-title { font-size: 18px; margin-bottom: 14px; }
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: #374151; }
.form-row input { padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; }
.btn-primary { width: 100%; background: #15607f; color: #fff; padding: 11px; font-size: 15px; }
.btn-primary:hover { background: #0f4a63; }
#form-msg { min-height: 20px; font-size: 14px; margin-bottom: 8px; }
.msg.err { color: #b91c1c; }
.msg.ok { color: #047857; }
.auth-note { margin-top: 16px; font-size: 13px; color: #6b7280; line-height: 1.7; }
.vip-badge { background: #fef3c7; color: #92400e; }
#auth-box a { color: #fff; text-decoration: none; }
#auth-box a:hover { text-decoration: underline; }

/* ── Khối VIP / admin trên trang chi tiết ── */
.vip-card, .admin-card {
  background: #fff; border-radius: 10px; padding: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08); margin-bottom: 16px;
}
.vip-card { border: 2px solid #fcd34d; }
.admin-card { border: 2px solid #93c5fd; }
.vip-card-title { font-size: 16px; font-weight: 800; margin-bottom: 10px; }
.vip-disclaimer { font-size: 12px; color: #92400e; margin-top: 10px; }

/* ── Trang quản trị ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat-card {
  background: #fff; border-radius: 10px; padding: 16px; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08); font-size: 13px; color: #6b7280;
}
.stat-num { font-size: 28px; font-weight: 800; color: #15607f; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f3f4f6; }
.admin-table th { background: #f9fafb; color: #374151; font-weight: 700; }
.btn-small { padding: 6px 12px; font-size: 13px; }

/* ── Đặc điểm nhà (bộ lọc mã: TMA, GCV, CVI, NTC) ── */
.filter-features { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: 4px 0 12px; }
.feat-label { font-size: 13px; font-weight: 600; color: #374151; }
.feat { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #4b5563; cursor: pointer; }
.feat input { width: 16px; height: 16px; accent-color: #1267a5; }

/* ── Logo + menu trên cùng ── */
.header-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.site-logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.logo-name { font-size: 20px; font-weight: 800; }
.site-nav { display: flex; gap: 18px; margin-top: 10px; flex-wrap: wrap; }
.site-nav a {
  color: #cfe6f5; text-decoration: none; font-weight: 600; font-size: 14px;
  padding: 4px 2px; border-bottom: 2px solid transparent;
}
.site-nav a:hover, .site-nav a.active { color: #fff; border-bottom-color: #fff; }

/* ── Phần "Bất Động Sản Tốt" ── */
.bds-tot { margin-bottom: 20px; }
.section-title { font-size: 20px; font-weight: 800; color: #1f2937; margin-bottom: 12px; }
.bds-tot-list {
  display: flex; flex-direction: column; gap: 10px;
}

/* ── Sticky panel (BĐS Tốt sidebar) ── */
.layout-wrap { display: flex; gap: 20px; align-items: flex-start; }
.main-col { flex: 1; min-width: 0; }
.sticky-panel {
  width: 300px; flex-shrink: 0; position: sticky; top: 16px;
  background: #fff; border-radius: 10px; padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.sticky-panel-title {
  font-size: 16px; font-weight: 800; color: #b45309;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.sticky-item {
  display: flex; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid #f3f4f6; text-decoration: none; color: inherit;
}
.sticky-item:last-child { border-bottom: none; }
.sticky-item-img {
  width: 70px; height: 55px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(135deg, #cfe3ef, #e8f1f7);
  display: flex; align-items: center; justify-content: center;
}
.sticky-item-body { flex: 1; min-width: 0; }
.sticky-item-title { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sticky-item-meta { font-size: 12px; color: #6b7280; }
.sticky-item-price { font-size: 13px; font-weight: 700; color: #b45309; }

.body.bds-hidden .sticky-panel { display: none; }
#bds-reopen { display: none; margin-left: 8px; font-size: 13px; cursor: pointer; color: #15607f; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .layout-wrap { flex-direction: column; }
  .sticky-panel { width: 100%; position: static; }
  .house-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Progress bar and Spinner Animations ── */
.progress-container {
  width: 100%;
  height: 10px;
  background-color: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  margin: 10px 0 6px;
  position: relative;
  display: none;
}
.progress-bar-animated {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #2563eb 0%, #60a5fa 50%, #2563eb 100%);
  background-size: 200% 100%;
  animation: progress-animation 1.5s infinite linear;
  border-radius: 9999px;
}
.progress-bar-success {
  background: #10b981 !important;
  animation: none !important;
}
@keyframes progress-animation {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner-icon {
  display: inline-block;
  animation: spin 1s infinite linear;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ── Progress animations for scan/sync v20261107_0700 ── */
@keyframes slideProgress {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
