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

#map {
  position: fixed;
  inset: 0;
}

/* Screen-reader only (your H1 uses this) */
.sr-only{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

#logo{
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;         /* above map + panel, no arguments */
  pointer-events: none;  /* doesn’t block map dragging */
}

#logo img{
  height: 52px;
  width: auto;
  display: block;
}

/* -------- Desktop panel -------- */
#panel {
  position: fixed;
  top: 14px;
  left: 14px;
  width: 320px;
  max-height: calc(100vh - 28px);
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  z-index: 2;
  overflow: hidden;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
}

.panel-inner {
  padding: 14px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Welcome message */
.welcome-message {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.welcome-message h2 {
  font-size: 18px;
  font-weight: 800;
  color: #111827;
  margin: 0 0 8px;
  line-height: 1.3;
}

.welcome-message p {
  font-size: 13px;
  color: #4b5563;
  margin: 0;
  line-height: 1.5;
}

/* Drag handle (hidden on desktop) */
.panel-handle {
  display: none;
  touch-action: none;
  user-select: none;
}

.label {
  font-weight: 700;
  font-size: 13px;
  color: #1f2937;
  margin: 10px 0 6px;
  display: block;
}

.control {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  font-size: 14px;
  outline: none;
}

.control:focus {
  border-color: rgba(59,130,246,0.6);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

.section { margin-top: 12px; }

/* Two-up row layout (Search + Country) */
.row-2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Remove top margin from nested sections inside row-2 */
.row-2 > .section {
  margin-top: 0;
}

/* Results container */
.results {
  margin-top: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

/* Scrollable results list */
.results-scroll{
  max-height: 280px;          /* desktop default */
  overflow: auto;
  scrollbar-gutter: stable;   /* helps on desktop */
}

/* Desktop scrollbar styling */
.results-scroll::-webkit-scrollbar { width: 10px; }
.results-scroll::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.25);
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,0.9);
}
.results-scroll::-webkit-scrollbar-track { background: transparent; }

.result-item {
  padding: 10px 12px;
  border-top: 1px solid rgba(0,0,0,0.06);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.result-item:first-child { border-top: none; }

.result-item.selected {
  background: rgba(59,130,246,0.10);
  outline: 2px solid rgba(59,130,246,0.25);
  outline-offset: -2px;
}

.result-left { min-width: 0; }

.result-city {
  font-weight: 800;
  font-size: 13px;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-meta {
  font-size: 12px;
  color: #4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-price {
  font-weight: 900;
  font-size: 13px;
  color: #111827;
  white-space: nowrap;
}

/* Bubble marker */
.price-marker{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0,0,0,0.18); /* reduced shadow */
  border: 1px solid rgba(255,255,255,0.35);
}

.price-marker:hover { transform: translateY(-1px); }

/* Popup content (your custom classes inside popup HTML) */
.popup-title { font-weight: 900; margin-bottom: 4px; }
.popup-row { font-size: 12px; color: #374151; margin-top: 2px; }

/* ---- Mapbox Popup: MOBILE SHORTEN ---- */
.mapboxgl-popup-content{
  border-radius: 12px;
}

@media (max-width: 768px) {
  .mapboxgl-popup-content{
    padding: 10px 10px;
    max-height: 160px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .popup-title{
    font-size: 13px;
    margin-bottom: 3px;
    line-height: 1.15;
  }
  .popup-row{
    font-size: 11px;
    margin-top: 1px;
    line-height: 1.15;
  }
}

/* Compare */
.compare-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-top: 10px;
}

.compare-clear{
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
}

.compare{
  margin-top: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  padding: 10px;
}

.compare-empty{ font-size: 12px; color: #4b5563; }

.compare-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.compare-card{
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.compare-title{
  font-weight: 900;
  font-size: 13px;
  color: #111827;
  margin-bottom: 4px;
}

.compare-line{
  font-size: 12px;
  color: #374151;
  margin-top: 2px;
}

.compare-price{
  margin-top: 6px;
  font-weight: 900;
  font-size: 13px;
  color: #111827;
}

.compare-diff{
  margin-top: 6px;
  font-size: 14px;      /* +2px */
  font-weight: 800;
  color: #FF0000;
}

/* -------- Mobile bottom sheet -------- */
@media (max-width: 768px) {
  #panel{
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    width: auto;
    max-height: 85vh;
    height: 55vh;                /* JS can resize this */
    border-radius: 18px;
  }

  /* show the drag handle on mobile */
  .panel-handle{
    display: block;
    height: 56px; /* bigger touch target */
    position: relative;
    cursor: ns-resize;
    touch-action: none;
    background: transparent;
  }

  .panel-handle::before{
    content:"";
    position:absolute;
    left: 50%;
    top: 18px;
    transform: translateX(-50%);
    width: 60px;
    height: 6px;
    border-radius: 999px;
    background: rgba(0,0,0,0.25);
  }

  /* inner content scrolls */
  .panel-inner{
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Results list gets its own scroll area */
  .results-scroll{
    max-height: 30vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Welcome message on mobile */
  .welcome-message {
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .welcome-message h2 {
    font-size: 16px;
  }

  .welcome-message p {
    font-size: 12px;
  }

  /* slightly smaller logo on mobile */
  #logo svg { height: 40px; }
}
