* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: sans-serif; }
#map-container {
  height: 100vh;
  height: 100dvh;
  width: 100%;
  position: relative;
  overflow: hidden;
}
#map { height: 100%; width: 100%; }
.filter-logo { height: 40px; display: block; }
#filter-panel {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  z-index: 10;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100% - 32px);
  gap: 12px;
  white-space: nowrap;
  font-size: 13px;
}
#filter-panel button,
#filter-panel select {
  padding: 6px 14px;
  border: 1px solid #dadce0;
  border-radius: 16px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #3c4043;
  transition: background 0.15s;
}
#filter-panel button:hover,
#filter-panel select:hover { background: #f1f3f4; }
#filter-panel .divider { color: #dadce0; }
.filter-group { display: flex; align-items: center; gap: 8px; }
#btn-clear { color: #c00; border-color: #ffcdd2; }
#btn-clear:hover { background: #fff5f5; }
#filter-panel .offer-btn.active { background: #1a73e8; color: white; border-color: #1a73e8; }
#radius-slider { width: 100px; cursor: pointer; }
/* Fixed (not min-) width sized for the widest possible value, "50.0 km"
   (the slider's max) - so the label's box never grows as its text does,
   which would otherwise push the tightly-packed filter panel row past its
   flex-wrap breakpoint mid-drag. */
#radius-label { width: 52px; flex-shrink: 0; font-weight: bold; text-align: right; }
.gm-style-iw button.gm-ui-hover-effect { display: none !important; }
.info-window { max-width: 280px; }
.info-close-btn {
  display: block;
  margin-left: auto;
  margin-bottom: 6px;
  width: 30px;
  height: 30px;
  border: none;
  background: #f1f3f4;
  border-radius: 50%;
  font-size: 16px;
  line-height: 30px;
  text-align: center;
  cursor: pointer;
  color: #5f6368;
  padding: 0;
}
.info-close-btn:hover { background: #e8eaed; }
.info-window h3 { margin-bottom: 8px; font-size: 14px; }
.info-window ul { padding-left: 16px; }
.info-window li { margin-bottom: 4px; font-size: 13px; }
.info-window .offer-type { font-size: 11px; font-weight: bold; text-transform: uppercase; color: #1a73e8; margin-bottom: 6px; }
.coop-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #b06000;
  background: #fef7e0;
  border: 1px solid #f9e6b8;
  border-radius: 10px;
  padding: 2px 8px;
  margin-bottom: 6px;
}
.info-window .price { font-size: 13px; font-weight: bold; color: #222; margin-bottom: 4px; }
.info-window .heading { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.info-window .heading h3 { margin-bottom: 0; }
.info-window .owner { font-size: 12px; color: #666; margin-bottom: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.info-window .owner a { white-space: nowrap; }
.agency-logo { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
/* Fixed size regardless of the source photo's dimensions/aspect ratio, so
   a tall/portrait upload can't inflate the whole InfoWindow past the
   viewport (the close button sits above this and would go off-screen). */
.info-window .info-photo { width: 100%; height: 140px; object-fit: cover; border-radius: 4px; margin-bottom: 8px; display: block; }
.info-window .info-list-title { font-size: 12px; font-weight: bold; color: #666; margin-bottom: 6px; }
.info-window .info-compact-list { list-style: none; padding: 0; max-height: 220px; overflow-y: auto; }
.info-window .info-compact-item { padding: 8px 4px; border-top: 1px solid #eee; cursor: pointer; font-size: 12px; }
.info-window .info-compact-item:first-child { border-top: none; }
.info-window .info-compact-item:hover { background: #f8f8f8; }
.info-window .info-compact-item .offer-type { display: inline-block; font-size: 10px; font-weight: bold; text-transform: uppercase; color: #1a73e8; margin: 0 6px 0 0; }
.info-window .info-compact-item .compact-address { font-weight: 500; }
.info-window .info-compact-item .compact-price { display: block; color: #444; margin-top: 2px; }
.info-window .info-back-btn { margin-top: 4px; padding: 5px 10px; font-size: 12px; border: 1px solid #ccc; border-radius: 4px; background: white; cursor: pointer; }
.info-window .info-back-btn:hover { background: #f0f0f0; }
#property-list {
  position: absolute;
  top: 0; right: 0;
  width: 280px;
  height: 100%;
  background: white;
  box-shadow: -2px 0 8px rgba(0,0,0,0.15);
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s ease;
}
#property-list.collapsed { transform: translateX(100%); }
#drag-handle {
  display: none;
  width: 36px;
  height: 4px;
  background: rgba(0,0,0,0.2);
  border-radius: 2px;
  margin: 8px auto 4px;
  cursor: pointer;
  flex-shrink: 0;
}
#list-header {
  font-size: 14px;
  font-weight: bold;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#list-mode-toggle {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
#list-mode-toggle button {
  flex: 1;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  cursor: pointer;
}
#list-mode-toggle button:hover { background: #f0f0f0; }
#list-mode-toggle button.active { background: #1a73e8; color: white; border-color: #1a73e8; }
.list-header-actions { display: flex; align-items: center; gap: 8px; }
#btn-toggle-list, #btn-expand-list {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #666;
  padding: 0;
  line-height: 1;
}
#btn-toggle-list:hover, #btn-expand-list:hover { color: #333; }
#btn-expand-list { display: none; }
.chevron { display: inline-block; }
#btn-show-list {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border: 1px solid #ddd;
  border-right: none;
  border-radius: 6px 0 0 6px;
  padding: 14px 6px;
  cursor: pointer;
  z-index: 10;
  box-shadow: -2px 0 6px rgba(0,0,0,0.15);
  display: none;
  font-size: 16px;
  color: #555;
}
#list-items { list-style: none; overflow-y: auto; flex: 1; }
.btn-show-list-label { display: none; }
#btn-show-all-properties {
  flex-shrink: 0;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-top: 1px solid #eee;
  background: white;
  color: #1a73e8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
#btn-show-all-properties:hover { background: #f0f0f0; }
@keyframes list-item-flash {
  0% { background: #e8f0fe; }
  100% { background: transparent; }
}
.list-item { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.list-item:hover { background: #f8f8f8; }
.list-item-highlight { animation: list-item-flash 1.4s ease-out forwards; }
.list-item .item-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.list-item .item-body { flex: 1; min-width: 0; }
.list-item .item-type { font-size: 10px; font-weight: bold; text-transform: uppercase; color: #1a73e8; margin-bottom: 3px; }
.list-item .item-address { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.list-item .item-price { font-size: 12px; font-weight: 600; color: #222; margin-bottom: 3px; }
.list-item .item-meta { font-size: 11px; color: #666; }

/* !important needed: #btn-show-list visibility is toggled via inline styles */
#map-container.streetview-active #filter-panel,
#map-container.streetview-active #property-list,
#map-container.streetview-active #btn-show-list,
#map-container.streetview-active #version-label { display: none !important; }
@media (min-width: 641px) {
  /* Centre the panel in the free area beside the open list pane (280px wide) */
  #map-container.list-open #filter-panel {
    left: calc((100% - 280px) / 2);
    max-width: calc(100% - 280px - 32px);
  }
}
@media (max-width: 640px) {
  .filter-logo { height: 30px; }
  #filter-panel {
    top: 8px;
    left: 8px;
    right: 8px;
    transform: none;
    flex-wrap: wrap;
    white-space: normal;
    justify-content: center;
    gap: 6px 8px;
    padding: 8px 10px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  #filter-panel .hint-text,
  #filter-panel .divider {
    display: none;
  }
  #filter-panel button,
  #filter-panel select {
    padding: 8px 10px;
    font-size: 12px;
  }
  #radius-group { flex: 1 1 auto; }
  #radius-slider {
    flex: 1 1 80px;
    min-width: 60px;
  }
  #property-list {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 45vh;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  #drag-handle { display: block; }
  #list-mode-toggle button,
  #btn-show-all-properties {
    background: transparent;
  }
  #property-list.collapsed { transform: translateY(100%); }
  #property-list.expanded { top: 96px; height: auto; }
  #btn-toggle-list, #btn-expand-list {
    font-size: 26px;
    padding: 8px 12px;
  }
  #btn-expand-list { display: inline-block; }
  #btn-show-list {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    transform: none;
    width: 100%;
    border-radius: 12px 12px 0 0;
    border: 1px solid #ddd;
    border-bottom: none;
    padding: 14px 22px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    background: #1a73e8;
    color: white;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
  }
  #btn-show-list:hover { background: #1765cc; }
  #btn-show-list .btn-show-list-label {
    display: inline;
    margin-left: 8px;
  }
  #btn-toggle-list .chevron,
  #btn-show-list .chevron {
    transform: rotate(-90deg);
  }
  /* Google groups the Street View pegman with the zoom controls into this
     container, positioned via its own inline (non-!important) bottom
     offset with no awareness of our #btn-show-list bar sitting in the same
     corner - override to lift it clear. !important is required to beat
     the inline style (same reasoning as the .gm-style-iw override near the
     top of this file).
     `.gm-bundled-control-on-bottom` is an undocumented Google Maps JS
     internal class name (see #204) - if a Maps API version bump ever
     silently stops applying this offset, that's why the pegman/zoom
     controls overlap #btn-show-list again. Re-verify after any such bump. */
  .gm-bundled-control-on-bottom { margin-bottom: 60px !important; }
}
