:root {
  --border: #e7e7e7;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  overflow: hidden;
}

/* Body becomes a column: topbar then map */
body {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* ======================
   TOP BAR
====================== */

.topbar {
  flex: 0 0 auto;
  width: 100%;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.topbar-inner {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.topbar input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 16px; /* prevents iOS zoom */
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.topbar-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.8;
}

.count { white-space: nowrap; }

.filter-label {
  opacity: 1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 520px) {
  .topbar-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .btn {
    width: 100%;
  }

  .topbar-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-label {
    width: 100%;
  }
}

/* ======================
   MAP
====================== */

#map {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

/* ======================
   BUTTONS / TABS
====================== */

.btn {
  border: 1px solid var(--border);
  background: #fff;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-secondary {
  background: #fafafa;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.tab {
  flex: 1;
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  opacity: 0.7;
}

.tab.active {
  opacity: 1;
  font-weight: 600;
}

/* ======================
   MODALS
====================== */

.modal {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(0, 0, 0, 0.6);
  padding: 18px;
}

.modal.open {
  display: block;
}

#resultsModal { z-index: 4500; }
.location-modal { z-index: 5000; }

.modal-card {
  background: #fff;
  max-width: 980px;
  margin: 6vh auto;
  padding: 16px;
  border-radius: 14px;
}

@media (max-width: 520px) {
  .modal-card {
    max-width: 96vw;
    margin: 10vh auto;
  }
}

.close { float: right; }

/* Location modal tweaks */
.modal-card-location {
  padding-top: 18px;
}

.loc-title {
  margin: 6px 0 10px;
  font-size: 28px;
  line-height: 1.1;
}

@media (max-width: 520px) {
  .loc-title {
    font-size: 22px;
  }
}

.loc-info {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  opacity: 0.9;
}

.loc-info-item {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.loc-info-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
}

.loc-info-icon svg {
  width: 16px;
  height: 16px;
  fill: #111827;
}

.loc-desc {
  margin: 0 0 10px;
  font-size: 14px;
  opacity: 0.85;
}

/* ======================
   RESULTS + CARDS
====================== */

.results {
  display: grid;
  gap: 8px;
}

.card {
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
}

.card:hover {
  background: #fafafa;
}

.card .title {
  font-weight: 600;
}

.card .meta {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 4px;
}

/* ======================
   CHIPS
====================== */

.chip {
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}

.chip:hover {
  background: #fafafa;
}

.loc-tags-wrap {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.loc-tags-label {
  font-size: 12px;
  opacity: 0.75;
}

.loc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.loc-tags-empty {
  font-size: 12px;
  opacity: 0.6;
}

/* ======================
   GALLERY
====================== */

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.gallery img {
  max-width: 300px;
  height: auto;
  border-radius: 12px;
}

/* Single image: full width */
.gallery.single img {
  max-width: 100%;
  width: 100%;
}
