/* Global CSS for Home9 Zillow clone
 * This stylesheet defines a modern, light theme inspired by major real estate portals.
 * It contains variables for colors, border radii and shadows, along with
 * comprehensive rules for layout, cards, forms and interactive elements.
 */

:root {
  --bg: #f5f7fb;
  --bg-elevated: #ffffff;
  --border-subtle: #dde2f0;
  --primary: #1d4ed8;
  --primary-soft: #e0ecff;
  --primary-dark: #1e3a8a;
  --accent: #16a34a;
  --text: #111827;
  --text-muted: #6b7280;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-pill: 990px;
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

/* Layout */

.app-main {
  flex: 1;
  padding: 0 24px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 247, 251, 0.9);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(209, 213, 219, 0.6);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 16px;
}

.logo-text {
  font-size: 18px;
}

.logo-sm .logo-icon {
  width: 22px;
  height: 22px;
  font-size: 13px;
}

.header-search {
  flex: 1;
}

.header-nav {
  display: flex;
  gap: 12px;
  font-size: 14px;
}

.nav-link {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
}

.nav-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.header-user {
  margin-left: auto;
}

/* Search bar */

.searchbar {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(148, 163, 184, 0.25);
}

.searchbar-input {
  flex: 1;
  border: none;
  padding: 10px 14px 10px 16px;
  font-size: 14px;
  outline: none;
}

.searchbar-btn {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 10px 18px;
  font-weight: 500;
  font-size: 14px;
  transition: background 0.2s;
}

.searchbar-btn:hover {
  background: var(--primary-dark);
}

/* Avatar menu */

.avatar-menu {
  position: relative;
}

.avatar-btn {
  border: none;
  background: transparent;
  padding: 0;
}

.avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.avatar-dropdown {
  position: absolute;
  right: 0;
  top: 40px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  min-width: 160px;
  z-index: 50;
}

.avatar-dropdown a {
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  transition: background 0.2s;
}

.avatar-dropdown a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Footer */

.footer {
  padding: 20px 24px;
  background: #fff;
  border-top: 1px solid rgba(209, 213, 219, 0.6);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-left {
  flex: 1 1 250px;
}

.footer-copy {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.footer-links {
  display: flex;
  gap: 40px;
}

.footer-links h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.footer-links a {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
}

/* Home page */

.hero {
  background: radial-gradient(circle at top left, #e0ebff, #f5f7fb 55%);
  padding: 40px 0 32px;
}

.hero-inner {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.hero-inner h1 {
  font-size: 32px;
  margin-bottom: 12px;
}

.hero-inner p {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.hero .searchbar {
  max-width: 640px;
  margin: 0 auto;
}

.hero-tabs {
  display: inline-flex;
  gap: 8px;
  margin-top: 18px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-pill);
  border: 1px solid rgba(209, 213, 219, 0.7);
}

.hero-tab {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
}

.hero-tab-active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
}

/* Generic page layout */

.page {
  max-width: 1100px;
  margin: 24px auto 0;
}

.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0 0 4px;
}

.page-header p {
  margin: 0;
  color: var(--text-muted);
}

/* Listing grid & cards */

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

.listing-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out;
}

.listing-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
}

/* Adjust layout for similar homes grid */
.similar-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.listing-card-image-wrap {
  position: relative;
  overflow: hidden;
}

.listing-card-image {
  width: 100%;
  height: 170px;
  object-fit: cover;
  display: block;
}

.listing-heart {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-size: 13px;
  border-radius: 999px;
  padding: 4px 7px;
}

.listing-card-body {
  padding: 10px 12px 12px;
}

.listing-price {
  font-weight: 600;
  margin-bottom: 2px;
}

.listing-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.listing-address {
  font-size: 14px;
}

.listing-subtext {
  font-size: 12px;
  color: var(--text-muted);
}

.badge {
  position: absolute;
  left: 10px;
  top: 10px;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
}

/* Filter bar */

.filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.filter-chip {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: #fff;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.filter-chip:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.filter-chip-outline {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Search layout */

.search-page {
  max-width: 1200px;
  margin: 24px auto 0;
}

.search-header h1 {
  margin: 0;
}

.search-header p {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.search-layout {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 12px;
  margin-top: 4px;
}

.search-results-list {
  min-height: 280px;
}

.empty-state {
  background: #fff;
  padding: 30px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.empty-state h3 {
  margin-top: 0;
}

/* Map pane */

.map-pane {
  background: #dbe4ff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  min-height: 280px;
}

.map-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 13px;
  padding: 16px;
  text-align: center;
}

/* Pagination */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 18px 0 8px;
}

.pagination button {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: default;
}

.pagination button:hover:not(:disabled) {
  background: var(--primary-soft);
  color: var(--primary);
}

.pagination-info {
  font-size: 13px;
  color: var(--text-muted);
}

/* Listing detail */

.listing-detail-page {
  max-width: 1200px;
  margin: 24px auto 0;
}

.listing-detail-gallery img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.listing-detail-main {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.listing-detail-price-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.listing-detail-price-row h1 {
  margin: 0;
}

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

.listing-detail-address {
  margin-top: 4px;
  font-size: 14px;
}

.detail-section {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid rgba(209, 213, 219, 0.7);
}

.detail-section h2 {
  margin-top: 0;
}

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

.detail-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  font-size: 14px;
}

.detail-list.small li {
  font-size: 13px;
}

/* Chart container styling */
.chart-container {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-soft);
  margin-top: 16px;
  height: 300px;
  position: relative;
}

/* Rent slider section styling */
.rent-slider-section {
  margin-top: 12px;
}
.rent-slider-section input[type='range'] {
  width: 100%;
  margin-top: 8px;
}
.rent-slider-section p {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
}

/* Card grid for property details */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

/* Individual info cards */
.info-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.info-card h3 {
  margin-top: 0;
}

.detail-list li + li {
  margin-top: 4px;
}

.detail-highlight {
  font-size: 22px;
  font-weight: 600;
}

.listing-detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
  font-size: 14px;
}

.detail-card h3 {
  margin-top: 0;
}

/* Heading styles inside sidebar cards */
.detail-card h4 {
  margin-top: 12px;
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 600;
}

.detail-card h5 {
  margin-top: 8px;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
}

.detail-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-form input,
.detail-form textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  font-size: 14px;
  resize: vertical;
}

/* Auth */

.auth-page {
  max-width: 420px;
  margin: 40px auto 0;
}

.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-soft);
}

.auth-card h1 {
  margin-top: 0;
}

.auth-card p {
  margin-top: 4px;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.auth-form label {
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-form input {
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  font-size: 14px;
}

.auth-switch {
  font-size: 13px;
  margin-top: 12px;
}

/* Sell */

.sell-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 16px;
  margin-top: 16px;
}

.sell-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-soft);
}

.sell-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.sell-form input {
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  font-size: 14px;
}

/* Mortgage */

.mortgage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 16px;
  margin-top: 16px;
}

.mortgage-form-card,
.mortgage-result-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-soft);
}

.mortgage-form-card label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 4px;
  margin-bottom: 8px;
}

.mortgage-form-card input {
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  font-size: 14px;
}

.mortgage-payment {
  font-size: 26px;
  margin-bottom: 4px;
}

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

/* Profile */

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 16px;
  margin-top: 16px;
}

.profile-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
}

/* Buttons */

.primary-btn {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.secondary-btn {
  border: 1px solid var(--border-subtle);
  background: #fff;
  color: var(--primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border 0.2s;
}

.secondary-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.link-button {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.link-button:hover {
  color: var(--primary-dark);
}

.full {
  width: 100%;
}

/* -------------------------------------------------------------------------- */
/* Additional styles for enhanced listing page details
 *
 * The classes below style the new detail sections added to listing.php. They
 * leverage CSS grid to layout content responsively and provide a clean,
 * card-like appearance for property information, comparable sales/rentals, and
 * market data. The photo grid displays multiple images with soft rounded
 * corners and subtle shadows.
 */

/* Generic responsive grid for detail sections */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

/* Photo grid for property photo gallery */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.photo-grid img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

/* Data table styling for comparables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 14px;
  /* Round table corners by wrapping in an overflow container */
  border-radius: var(--radius-md);
  overflow: hidden;
}
.data-table th,
.data-table td {
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  text-align: left;
}
.data-table th {
  background: var(--primary-soft);
  font-weight: 600;
  color: var(--primary-dark);
  font-size: 13px;
}
.data-table tbody tr:nth-child(even) {
  background: var(--bg);
}

/* Hover effect on table rows for better visual feedback */
.data-table tbody tr:hover {
  background: rgba(29, 78, 216, 0.08);
}

/* Status badge next to price */
.status-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-left: 8px;
}

/* Sticky sidebar for right column */
.listing-detail-sidebar {
  position: sticky;
  top: 24px;
  align-self: flex-start;
}

/* Collapsible card headers */
.toggle-header {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.toggle-header::after {
  content: '\25BC'; /* down arrow */
  font-size: 14px;
  transition: transform 0.3s ease;
}
.toggle-header.open::after {
  transform: rotate(-180deg);
}

/* Collapsible content hidden by default */
.collapsible-content {
  display: none;
  margin-top: 8px;
}
.collapsible-content.open {
  display: block;
}

/* Rental insight cards grid */
.rental-insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.insight-card {
  /* Each rental insight card uses a subtle colored background and left accent bar */
  background: var(--primary-soft);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}
.insight-label {
  font-size: 12px;
  color: var(--primary-dark);
  letter-spacing: 0.02em;
}
.insight-value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--primary-dark);
}

/* Rent slider styling */
.rent-slider-section {
  position: relative;
  margin-top: 8px;
}
.slider-wrapper {
  position: relative;
  width: 100%;
  margin-top: 8px;
}
.rent-bubble {
  position: absolute;
  top: -28px;
  left: 0;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: #e5e7eb;
  outline: none;
  margin: 0;
  padding: 0;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid #fff;
  margin-top: -6px;
}
input[type=range]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid #fff;
}
input[type=range]::-webkit-slider-runnable-track {
  background: #e5e7eb;
  height: 4px;
  border-radius: 3px;
}
input[type=range]::-moz-range-track {
  background: #e5e7eb;
  height: 4px;
  border-radius: 3px;
}

/* Map section styling */
.map-container {
  margin-top: 8px;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.location-details {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.8);
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.4;
}
.location-details p {
  margin: 2px 0;
  color: var(--text);
}

/* Smaller font size for trend lists */
.detail-list.small li {
  font-size: 13px;
}

/* Detail section styling for property page */
.detail-section {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  margin-top: 24px;
}

/* Headings within detail sections */
.detail-section > h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 22px;
}
.detail-section h3 {
  margin-top: 16px;
  margin-bottom: 6px;
  font-size: 18px;
}
