html,
body {
  margin: 0;
  padding: 0;
}

* {
  box-sizing: border-box;
}

body {
  color: #222;
  background: #fff;
  font-family: Arial, sans-serif;
}

.map-section {
  padding: 24px;
}

.map-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

#map-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

#map-search:focus {
  border-color: #1d7b81;
}

.map-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-filters button {
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.map-filters button:hover {
  background: #e4e4e4;
}

.map-filters button.is-active {
  background: #1d7b81;
  border-color: #1d7b81;
  color: #fff;
}

.map-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 80vh;
  overflow: hidden;
  border: 1px solid #ddd;
  border-radius: 12px;
  background: #fff;
}

.map-sidebar {
  overflow-y: auto;
  border-right: 1px solid #ddd;
  background: #fafafa;
}

.map-sidebar-top {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 14px;
  border-bottom: 1px solid #ddd;
  background: #fff;
}

#map-results-count {
  font-weight: 600;
}

#map {
  width: 100%;
  height: 100%;
}

.map-result-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: start;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: none;
  border-bottom: 1px solid #e5e5e5;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.map-result-card:hover {
  background: #f2f7f7;
}

.map-result-card.is-active {
  background: #eaf4f4;
}

.map-result-card.no-image {
  grid-template-columns: 1fr;
}

.map-result-image {
  display: block;
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 10px;
}

.map-result-content {
  min-width: 0;
}

.map-result-title {
  margin-bottom: 4px;
  font-weight: 600;
  line-height: 1.3;
}

.map-result-card.is-active .map-result-title {
  color: #1d7b81;
}

.map-result-category {
  margin-bottom: 4px;
  font-size: 13px;
  color: #1d7b81;
  line-height: 1.3;
}

.map-result-address {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

.map-result-empty {
  padding: 16px;
  color: #666;
}

.map-popup {
  min-width: 220px;
}

.map-popup-image {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.map-popup-title {
  margin-bottom: 4px;
  font-weight: 700;
  line-height: 1.3;
}

.map-popup-category {
  margin-bottom: 4px;
  font-size: 13px;
  color: #1d7b81;
  line-height: 1.3;
}

.map-popup-address {
  margin-bottom: 8px;
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

.map-popup-link, .map-popup-3d-button {
  color: #1d7b81;
  text-decoration: none;
  font-weight: 600;
  display: block;
  background-color:transparent;
  padding:0;
}

.map-popup-link:hover, .map-popup-3d-button:hover {
  text-decoration: underline;
}

.matterport-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.matterport-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.matterport-modal-content {
  position: relative;
  width: min(1100px, 92vw);
  height: min(700px, 82vh);
  margin: 6vh auto;
  background: #000;
  z-index: 1;
}

.matterport-modal-content iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.matterport-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 48px;
  background: none;
  color: white;
  border: 0;
  cursor: pointer;
  padding:0;
}

.map-popup-3d-button {
  cursor: pointer;
}

@media (max-width: 991px) {
  .map-section {
    padding: 16px;
  }

  .map-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .map-sidebar {
    order: 2;
    max-height: 320px;
    border-right: none;
    border-top: 1px solid #ddd;
  }

  #map {
    order: 1;
    height: 60vh;
    min-height: 420px;
  }
}
