:root {
  --navy: #0b2740;
  --navy-600: #103355;
  --cream: #f9f6ef;
  --taupe: #f6f1e7;
  --gold: #caa42e;
  --text: #0f172a;
}

/* Base Styles */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--taupe);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand-logo {
  border-radius: 50%;
}

.brand-name {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  color: var(--gold);
  font-size: 20px;
}

.main-nav a {
  margin-left: 22px;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.main-nav a:hover {
  color: var(--navy);
}

/* Hero Section */
.hero {
  padding: 40px 0;
  background: var(--cream);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: 54px;
  line-height: 1.04;
  margin: 0 0 10px;
  color: var(--navy);
}

.hero-subtitle {
  margin: 0 0 16px;
  color: #475569;
  font-size: 18px;
  line-height: 1.5;
}

/* Search Pills */
.search-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.search-tabs button {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--navy);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.search-tabs button:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.search-tabs button.active,
.search-tabs button[aria-pressed="true"],
.search-tabs button[aria-selected="true"] {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.selected-type-note {
  margin: 6px 0 16px;
  color: #475569;
  font-size: 14px;
}

/* Search Form - Used on both homepage and search page */
.search-form {
  display: flex;
  align-items: center;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(11, 39, 64, 0.08);
  background: #fff;
  border: 1px solid #d1d5db;
}

.search-form input {
  flex: 1;
  border: 0;
  padding: 16px 18px;
  font-size: 16px;
  outline: none;
  background: transparent;
  color: var(--text);
}

.search-form input::placeholder {
  color: #94a3b8;
}

.search-form .z-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 16px 18px;
  cursor: pointer;
  transition: background 0.2s ease;
  border-radius: 0;
  margin: 0;
}

.search-form .z-icon:hover {
  background: var(--navy-600);
}

.search-form .z-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke: currentColor;
}

/* Hero Image */
.hero-image {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  min-height: 360px;
  max-height: 520px;
  background: #eae8e2;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Filter Bar - Fixed positioning and z-index */
.filters-bar {
  position: relative;
  z-index: 100 !important;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 16px 0;
}

.filters-bar .container {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Filter Chips - Align with card content */
.z-chips {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 20px;
  max-width: 48%;
}

.z-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 8px 12px;
  position: relative;
  transition: all 0.2s ease;
}

.z-chip.z-active {
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(11, 39, 64, 0.06);
}

/* Clear button positioning */
.z-clear {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: #f3f6fa;
  color: #334155;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  margin-right: 8px;
}

.z-clear:hover {
  background: #e9eef6;
}

/* Dropdown Chips - Fixed z-index */
.z-dd {
  position: relative;
  z-index: 110 !important;
}

.z-dd-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.z-dd-btn.z-active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  border-radius: 8px;
  padding: 4px 8px;
  margin: -4px -8px;
}

/* Dropdown Menu - Fixed z-index */
.z-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(11, 39, 64, 0.12);
  padding: 8px;
  z-index: 2000 !important;
  display: none;
}

.z-menu.open {
  display: block;
}

.z-menu button {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  font-weight: 500;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 14px;
}

.z-menu button:hover {
  background: #f6f8fb;
}

/* Results Header - Align with cards */
.results-header {
  padding: 20px 0;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  position: relative;
  z-index: 10;
}

.results-header .container {
  max-width: none;
  margin: 0;
  padding: 0;
}

.results-title {
  margin: 0 0 6px;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--navy);
}

.results-sub {
  margin: 0;
  color: #6b7280;
  font-size: 16px;
}

.results-header h1,
.results-header p {
  padding: 0 20px;
  max-width: 48%;
  margin-left: 0;
  margin-right: auto;
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: 48% 52%;
  min-height: calc(100vh - 64px - 120px);
}

.results-list {
  overflow: auto;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  max-height: calc(100vh - 64px - 120px);
  padding: 0;
}

/* Map - Lower z-index */
#map {
  width: 100%;
  height: calc(100vh - 64px - 120px);
  min-height: 520px;
  background: var(--taupe);
  position: relative;
  z-index: 1 !important;
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 20px;
}

/* Enhanced Cards with More Details */
.card {
  border: 1px solid #eaeef3;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: 0 8px 25px rgba(11, 39, 64, 0.1);
  transform: translateY(-1px);
}

.card-img-wrap {
  position: relative;
  aspect-ratio: 16/9;
  background: #f2f4f7;
  overflow: hidden;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-dist {
  position: absolute;
  left: 12px;
  top: 12px;
  background: rgba(11, 39, 64, 0.9);
  color: #fff;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.card-body {
  padding: 16px 18px 18px;
}

.card-title {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.3;
  color: var(--navy);
  font-weight: 600;
}

.card-price {
  color: var(--navy);
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 16px;
}

.card-address {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.4;
  margin: 4px 0;
}

.card-phone {
  color: #6b7280;
  font-size: 14px;
  margin: 4px 0;
}

.card-services {
  margin: 12px 0;
  padding: 8px 0;
  border-top: 1px solid #f1f5f9;
}

.services-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.services-list {
  font-size: 13px;
  color: #475569;
  line-height: 1.4;
}

.card-details {
  font-size: 12px;
  color: #64748b;
  margin: 8px 0;
  padding: 6px 0;
  border-top: 1px solid #f8fafc;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.card-btn {
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-btn-phone {
  background: #059669;
  color: white;
}

.card-btn-phone:hover {
  background: #047857;
}

.card-btn-web {
  background: var(--navy);
  color: white;
}

.card-btn-web:hover {
  background: var(--navy-600);
}

.card-btn-email {
  background: #7c3aed;
  color: white;
}

.card-btn-email:hover {
  background: #6d28d9;
}

.card-expand {
  background: transparent;
  border: 1px solid var(--navy);
  color: var(--navy);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  margin-top: 8px;
}

.card-expand:hover {
  background: var(--navy);
  color: white;
}

/* Facility Modal */
.facility-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.facility-modal-content {
  background: white;
  border-radius: 16px;
  max-width: 800px;
  max-height: 90vh;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 24px;
}

.modal-header h2 {
  margin: 0;
  color: var(--navy);
  font-size: 24px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #64748b;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: #f1f5f9;
}

.modal-body {
  padding: 0 24px 24px;
  max-height: calc(90vh - 120px);
  overflow-y: auto;
}

.modal-image {
  margin-bottom: 24px;
  border-radius: 12px;
  overflow: hidden;
}

.modal-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.info-section {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}

.info-section:last-child {
  border-bottom: none;
}

.info-section h3 {
  margin: 0 0 12px;
  color: var(--navy);
  font-size: 18px;
  font-weight: 600;
}

.info-section p {
  margin: 8px 0;
  color: #475569;
  line-height: 1.6;
}

.price-details {
  font-size: 14px;
  color: #64748b;
  font-style: italic;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--navy);
  color: white;
  border: 1px solid var(--navy);
}

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

.btn-secondary {
  background: #059669;
  color: white;
  border: 1px solid #059669;
}

.btn-secondary:hover {
  background: #047857;
}

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--navy);
}

.btn-outline:hover {
  background: var(--navy);
  color: white;
}

/* Load More Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 10px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: all 0.2s ease;
  cursor: pointer;
  font-size: 16px;
  text-decoration: none;
}

.btn:hover {
  background: var(--navy-600);
  box-shadow: 0 6px 16px rgba(11, 39, 64, 0.15);
}

.btn:active {
  transform: translateY(1px);
}

/* Footer */
.site-footer {
  padding: 28px 0;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  margin-top: auto;
}

.site-footer p {
  margin: 0;
  text-align: center;
  color: #6b7280;
}

/* Loading States */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Focus States for Accessibility */
button:focus,
input:focus,
select:focus,
a:focus {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

/* Error States */
.error {
  color: #dc2626;
  font-size: 14px;
  margin-top: 4px;
}

.success {
  color: #059669;
  font-size: 14px;
  margin-top: 4px;
}

/* Utility Classes */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
  border: 0;
}

/* Responsive Design */
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .hero-title {
    font-size: 42px;
  }
  
  .results-grid {
    grid-template-columns: 1fr;
  }
  
  .results-list {
    border-right: none;
    max-height: unset;
  }
  
  #map {
    height: 420px;
    min-height: 420px;
  }
  
  .z-chips {
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
  }
  
  .search-form {
    max-width: 100%;
  }
  
  .cards-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  
  .results-header h1,
  .results-header p {
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  .hero-title {
    font-size: 36px;
  }
  
  .search-tabs {
    flex-direction: column;
  }
  
  .search-tabs button {
    width: 100%;
    text-align: left;
  }
  
  .main-nav {
    display: none;
  }
}
