/* ==========================================================================
   DESIGN SYSTEM - MÔI GIỚI CHO THUÊ NHÀ CẦN THƠ
   Tuân thủ nghiêm ngặt bảng màu và typography theo tài liệu đặc tả 11/2026
   ========================================================================== */

:root {
  --blue-900: #0C4A6E;
  --blue-700: #0369A1;
  --blue-500: #0EA5E9;
  --blue-100: #E0F2FE;
  --blue-50: #F0F9FF;
  --teal-500: #14B8A6;
  --teal-100: #CCFBF1;
  --teal-800: #0F766E;
  --orange-600: #EA580C;
  --orange-700: #C2410C;
  --orange-100: #FFEDD5;
  --zalo: #0068FF;
  --text: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --footer: #082F49;
  --white: #FFFFFF;
  --gray-badge: #94A3B8;
  --gray-bg: #F1F5F9;

  --font-family: 'Be Vietnam Pro', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 12px 28px -4px rgba(3, 105, 161, 0.18), 0 6px 12px -4px rgba(3, 105, 161, 0.1);
  --radius-sm: 8px;
  --radius-btn: 10px;
  --radius-card: 14px;
  --radius-pill: 9999px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-family: var(--font-family);
  font-size: 16px;
  color: var(--text);
  background-color: var(--white);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  line-height: 1.6;
  overflow-x: hidden;
  padding-bottom: 74px; /* Chừa không gian cho floating bar trên mobile */
}

@media (min-width: 1024px) {
  body {
    padding-bottom: 0;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}

@media (min-width: 1024px) {
  .container {
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  line-height: 1.25;
  font-weight: 700;
}

h1 {
  font-size: 28px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 24px;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 18px;
  font-weight: 600;
}

@media (min-width: 1024px) {
  h1 { font-size: 44px; }
  h2 { font-size: 32px; }
  h3 { font-size: 22px; }
}

p {
  color: var(--text);
}

.text-muted {
  color: var(--text-muted);
  font-size: 14px;
}

.text-blue-700 {
  color: var(--blue-700);
}

.section-title {
  color: var(--blue-700);
  margin-bottom: 12px;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 36px;
  max-width: 680px;
}

/* Sections */
.section {
  padding-top: 56px;
  padding-bottom: 56px;
}

@media (min-width: 1024px) {
  .section {
    padding-top: 80px;
    padding-bottom: 80px;
  }
}

.bg-white { background-color: var(--white); }
.bg-blue-50 { background-color: var(--blue-50); }
.bg-blue-900 { background-color: var(--blue-900); color: var(--white); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-align: center;
  user-select: none;
  white-space: nowrap;
}

/* Nút chính Cam */
.btn-primary {
  background-color: var(--orange-600);
  color: var(--white) !important;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
}

.btn-primary:hover {
  background-color: var(--orange-700);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Nút phụ Viền Xanh */
.btn-secondary {
  background-color: var(--white);
  color: var(--blue-700);
  border: 2px solid var(--blue-700);
}

.btn-secondary:hover {
  background-color: var(--blue-50);
  color: var(--blue-900);
  border-color: var(--blue-900);
}

/* Nút Zalo */
.btn-zalo {
  background-color: var(--white);
  color: var(--zalo) !important;
  border: 2px solid var(--zalo);
  font-weight: 600;
}

.btn-zalo:hover {
  background-color: rgba(0, 104, 255, 0.06);
  transform: translateY(-2px);
}

/* Nút tìm kiếm xanh 700 */
.btn-search {
  background-color: var(--blue-700);
  color: var(--white);
}

.btn-search:hover {
  background-color: var(--blue-900);
  transform: translateY(-1px);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.badge-available {
  background-color: var(--teal-100);
  color: var(--teal-800);
}

.badge-new {
  background-color: var(--blue-50);
  color: var(--blue-700);
  border: 1px solid var(--blue-500);
}

.badge-good-price {
  background-color: var(--orange-100);
  color: var(--orange-700);
  border: 1px solid rgba(234, 88, 12, 0.3);
}

.badge-rented {
  background-color: var(--gray-bg);
  color: var(--gray-badge);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--white);
  height: 64px;
  border-bottom: 1px solid var(--border);
  transition: height 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
  height: 60px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 19px;
  color: var(--blue-900);
}

.site-logo svg {
  color: var(--blue-700);
}

.nav-desktop {
  display: none;
}

@media (min-width: 1024px) {
  .site-header {
    height: 72px;
  }
  .nav-desktop {
    display: flex;
    align-items: center;
    gap: 28px;
  }
  .nav-link {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    position: relative;
    padding: 8px 0;
    transition: color 0.2s;
  }
  .nav-link:hover, .nav-link.active {
    color: var(--blue-700);
  }
  .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--blue-500);
    border-radius: 2px;
  }

  /* Dropdown Khu Vực */
  .nav-dropdown {
    position: relative;
  }
  .dropdown-menu {
    position: absolute;
    top: 100%;
    left: -20px;
    width: 250px;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hover);
    border: 1px solid var(--border);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
  }
  .nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  .dropdown-item {
    display: block;
    padding: 10px 18px;
    font-size: 14px;
    color: var(--text);
    transition: background 0.15s, color 0.15s;
  }
  .dropdown-item:hover {
    background-color: var(--blue-50);
    color: var(--blue-700);
  }
  .dropdown-item small {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  color: var(--text);
}

@media (min-width: 1024px) {
  .mobile-menu-btn {
    display: none;
  }
}

/* Mobile Drawer */
.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.mobile-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 82%;
  max-width: 320px;
  background: var(--white);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  box-shadow: -4px 0 25px rgba(0, 0, 0, 0.15);
}

.mobile-drawer.active {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex-grow: 1;
}

.drawer-nav a {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  padding: 6px 0;
}

.drawer-nav a:hover, .drawer-nav a.active {
  color: var(--blue-700);
}

.drawer-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Listing Card */
.listing-card {
  background: var(--white);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
}

.listing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--blue-500);
}

.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: #E2E8F0;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.listing-card:hover .card-media img {
  transform: scale(1.05);
}

.card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}

.card-photo-count {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(12, 74, 110, 0.75);
  backdrop-filter: blur(4px);
  color: var(--white);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-content {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-price {
  font-size: 21px;
  font-weight: 800;
  color: var(--blue-700);
  line-height: 1.2;
  margin-bottom: 6px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 44px;
}

.card-specs {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.card-spec-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-location {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.card-rented {
  filter: grayscale(60%);
  opacity: 0.85;
}

/* Floating Contact Bar (Mobile & Desktop) */
.mobile-floating-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--white);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 12px;
  z-index: 99;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

@media (min-width: 1024px) {
  .mobile-floating-bar {
    display: none;
  }
}

.desktop-floating-actions {
  display: none;
}

@media (min-width: 1024px) {
  .desktop-floating-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: fixed;
    right: 28px;
    bottom: 32px;
    z-index: 99;
  }
  .float-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
    position: relative;
  }
  .float-btn:hover {
    transform: scale(1.1);
  }
  .float-btn-call {
    background-color: var(--orange-600);
    color: var(--white);
    animation: pulse-ring 4s infinite;
  }
  .float-btn-zalo {
    background-color: var(--white);
    border: 2px solid var(--zalo);
  }
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.6);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(234, 88, 12, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(234, 88, 12, 0);
  }
}

/* Accordion */
.faq-item {
  background: var(--white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.faq-item.active {
  border-color: var(--blue-500);
}

.faq-question {
  width: 100%;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  text-align: left;
}

.faq-icon {
  width: 22px;
  height: 22px;
  color: var(--blue-700);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.faq-item.active .faq-icon {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}

.faq-item.active .faq-answer {
  max-height: 300px;
  padding: 0 20px 20px 20px;
}

/* Forms */
.form-card {
  background: var(--white);
  border-radius: var(--radius-card);
  padding: 28px 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

@media (min-width: 640px) {
  .form-card {
    padding: 36px 32px;
  }
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-control {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

textarea.form-control {
  height: 100px;
  padding: 12px 16px;
  resize: vertical;
}

/* Footer */
.site-footer {
  background-color: var(--footer);
  color: #CBD5E1;
  padding-top: 60px;
  padding-bottom: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
  margin-bottom: 48px;
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
  }
}

.footer-col h4 {
  color: var(--white);
  font-size: 17px;
  margin-bottom: 20px;
  position: relative;
}

.footer-col h4::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 28px;
  height: 2px;
  background-color: var(--blue-500);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  color: #94A3B8;
  font-size: 14px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--white);
  padding-left: 4px;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 24px;
  text-align: center;
  font-size: 13.5px;
  color: #94A3B8;
}

/* Breadcrumb */
.breadcrumb-nav {
  padding: 16px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.breadcrumb-item a {
  color: var(--blue-700);
}

.breadcrumb-item a:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--text-muted);
}

/* Waves SVG */
.wave-divider {
  width: 100%;
  overflow: hidden;
  line-height: 0;
  transform: translateY(1px);
}

.wave-divider svg {
  display: block;
  width: 100%;
  height: 38px;
}

@media (min-width: 768px) {
  .wave-divider svg {
    height: 52px;
  }
}

/* Grids helper */
.grid-listings {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 640px) {
  .grid-listings {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

@media (min-width: 1024px) {
  .grid-listings {
    grid-template-columns: repeat(3, 1fr);
  }
}


/* ==========================================================================
   MOBILE RESPONSIVE ENHANCEMENTS
   ========================================================================== */

@media (max-width: 639px) {
  html, body {
    overflow-x: hidden;
    width: 100%;
  }

  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  h1 {
    font-size: 22px !important;
    line-height: 1.3 !important;
  }

  h2, .section-title {
    font-size: 19px !important;
    line-height: 1.35 !important;
  }

  .section {
    padding-top: 40px !important;
    padding-bottom: 40px !important;
  }

  /* Khối tìm kiếm nhanh ở hero */
  .hero-search-wrapper {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    margin-top: 24px !important;
    padding: 0 !important;
  }

  .hero-search-wrapper > div {
    padding: 16px 14px !important;
  }

  .hero-search-form {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  /* Thẻ bài đăng mobile */
  .card-content {
    padding: 14px 12px !important;
  }

  .card-price {
    font-size: 19px !important;
  }

  .card-title {
    font-size: 15px !important;
    min-height: auto !important;
    margin-bottom: 8px !important;
  }

  .card-specs {
    font-size: 12.5px !important;
    gap: 6px !important;
  }

  /* Gallery chi tiết mobile */
  .gallery-main {
    height: 250px !important;
  }

  .gallery-thumbs .thumb-item {
    width: 65px !important;
    height: 48px !important;
  }

  .quick-specs-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .quick-spec-card {
    padding: 10px !important;
  }

  .quick-spec-card .val {
    font-size: 14.5px !important;
  }

  /* Bảng thông số chi tiết mobile */
  .specs-table td {
    padding: 10px 12px !important;
    font-size: 13px !important;
  }

  .specs-table td.lbl {
    width: 40% !important;
  }

  /* Thanh liên hệ cố định dưới cùng mobile */
  .mobile-floating-bar {
    height: 60px !important;
    padding: 8px 10px !important;
    gap: 8px !important;
  }

  .mobile-floating-bar .btn {
    min-height: 44px !important;
    height: 44px !important;
    font-size: 14.5px !important;
  }

  body {
    padding-bottom: 74px !important;
  }
}

/* Layout Tìm Kiếm Hero */
.hero-search-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .hero-search-form {
    grid-template-columns: repeat(2, 1fr);
  }
  .search-submit {
    grid-column: span 2;
  }
}

@media (min-width: 1024px) {
  .hero-search-form {
    grid-template-columns: 1.2fr 1fr 1fr 130px;
  }
  .search-submit {
    grid-column: span 1;
  }
}

/* Fix layout trang chi tiết trên mobile */
@media (max-width: 1023px) {
  .detail-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 24px !important;
  }
  
  .contact-sticky-card {
    position: static !important;
    margin-top: 16px !important;
  }
}
