/* ===================================================
   Price Heat Map page
   Uses the design tokens defined in style.css :root
   =================================================== */

.hm-section{ background:var(--bg-light); }

/* ----- Quick stats ----- */
.hm-stats{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px;
  margin-bottom:20px;
}
.hm-stat{
  display:flex;
  align-items:center;
  gap:14px;
  background:#fff;
  border:1px solid var(--border-soft);
  border-radius:var(--radius-md);
  box-shadow:var(--shadow-soft);
  padding:16px 18px;
  min-width:0;
}
.hm-stat-icon{
  flex:0 0 46px;
  width:46px;height:46px;
  border-radius:14px;
  display:inline-flex;align-items:center;justify-content:center;
  font-size:1.25rem;
  color:var(--dark);
  background:linear-gradient(145deg,#ffe36e,var(--accent));
}
.hm-stat-icon i{ display:flex; line-height:1; }
.hm-stat-icon.hm-green{ background:linear-gradient(145deg,#86efac,#22c55e); color:#053b1a; }
.hm-stat-icon.hm-red{ background:linear-gradient(145deg,#fca5a5,#ef4444); color:#fff; }
.hm-stat > div{ min-width:0; }
.hm-stat strong{
  display:block;
  font-family:'Poppins',sans-serif;
  font-size:1.2rem;
  font-weight:700;
  line-height:1.25;
  color:var(--text-dark);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.hm-stat small{
  display:block;
  font-size:.78rem;
  color:var(--text-muted);
  margin-top:2px;
}

/* ----- Filters ----- */
.hm-filters{
  display:flex;
  flex-wrap:wrap;
  align-items:flex-end;
  gap:18px 28px;
  background:#fff;
  border:1px solid var(--border-soft);
  border-radius:var(--radius-md);
  box-shadow:var(--shadow-soft);
  padding:16px 20px;
  margin-bottom:24px;
}
.hm-filter-group{ display:flex; flex-direction:column; gap:7px; }
.hm-filter-label{
  font-size:.72rem;
  font-weight:700;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--text-muted);
}
.hm-chips{ display:flex; flex-wrap:wrap; gap:8px; }
.hm-chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:1.5px solid var(--border-soft);
  background:#fff;
  color:var(--text-dark);
  font-size:.86rem;
  font-weight:600;
  padding:.45rem .95rem;
  border-radius:999px;
  transition:.2s;
}
.hm-chip em{
  font-style:normal;
  font-size:.72rem;
  font-weight:700;
  background:var(--bg-light);
  color:var(--text-muted);
  border-radius:999px;
  padding:1px 7px;
  transition:.2s;
}
.hm-chip:hover{ border-color:var(--accent); }
.hm-chip.active{ background:var(--dark); border-color:var(--dark); color:#fff; }
.hm-chip.active em{ background:var(--accent); color:var(--dark); }

.hm-select{
  min-width:180px;
  border:1.5px solid var(--border-soft);
  border-radius:var(--radius-sm);
  font-size:.88rem;
  font-weight:600;
  padding:.5rem .8rem;
  color:var(--text-dark);
}
.hm-select:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 .2rem rgba(255,198,11,.22);
  outline:none;
}

.hm-seg{
  display:inline-flex;
  background:var(--bg-light);
  border:1px solid var(--border-soft);
  border-radius:999px;
  padding:3px;
}
.hm-seg button{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:0;
  background:transparent;
  color:var(--text-muted);
  font-size:.84rem;
  font-weight:600;
  padding:.4rem .9rem;
  border-radius:999px;
  transition:.2s;
}
.hm-seg button i{ display:flex; line-height:1; }
.hm-seg button.active{ background:var(--dark); color:#fff; box-shadow:0 3px 10px rgba(13,19,33,.25); }

/* ----- Map card ----- */
.hm-map-card{
  position:relative;
  isolation:isolate;
  z-index:0;
  height:100%;
  min-height:600px;
  background:#e8ebf0;
  border:1px solid var(--border-soft);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-soft);
  overflow:hidden;
}
.hm-map{ position:absolute; inset:0; }

.hm-legend{
  position:absolute;
  left:14px; bottom:26px;
  z-index:900;
  background:rgba(255,255,255,.95);
  backdrop-filter:blur(6px);
  border-radius:var(--radius-md);
  box-shadow:0 8px 24px rgba(13,19,33,.18);
  padding:10px 14px 12px;
}
.hm-legend-title{
  font-size:.7rem;
  font-weight:700;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--text-muted);
  margin-bottom:6px;
}
.hm-legend ul{ list-style:none; margin:0; padding:0; display:grid; gap:5px; }
.hm-legend li{ display:flex; align-items:center; gap:8px; font-size:.78rem; font-weight:600; color:var(--text-dark); }
.hm-legend li i{ width:14px; height:14px; border-radius:50%; border:2px solid #fff; box-shadow:0 0 0 1px rgba(13,19,33,.15); flex:0 0 14px; }

.hm-reset{
  position:absolute;
  top:14px; left:50%;
  transform:translateX(-50%);
  z-index:900;
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:0;
  background:var(--dark);
  color:#fff;
  font-size:.82rem;
  font-weight:600;
  padding:.5rem 1rem;
  border-radius:999px;
  box-shadow:0 8px 20px rgba(13,19,33,.3);
}
.hm-reset[hidden]{ display:none; }
.hm-reset i{ display:flex; line-height:1; color:var(--accent); }
.hm-reset:hover{ background:#000; }

.hm-empty{
  position:absolute;
  inset:0;
  z-index:850;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  text-align:center;
  padding:24px;
  background:rgba(246,247,250,.88);
  backdrop-filter:blur(3px);
  color:var(--text-muted);
}
.hm-empty[hidden]{ display:none; }
.hm-empty i{ font-size:2.4rem; color:var(--accent-dark); }
.hm-empty strong{ color:var(--text-dark); font-size:1.05rem; }

/* ----- Pins (price labels) ----- */
.hm-pin-wrap{ background:none; border:0; }
.hm-pin{
  position:absolute;
  left:0; top:0;
  transform:translate(-50%,-50%);
  width:18px; height:18px;
  display:flex; align-items:center; justify-content:center;
  background:var(--c);
  color:var(--t);
  border:2.5px solid #fff;
  border-radius:999px;
  box-shadow:0 3px 10px rgba(13,19,33,.35);
  font-family:'Inter',sans-serif;
  font-size:.72rem;
  font-weight:700;
  white-space:nowrap;
  transition:transform .2s ease, opacity .2s ease, box-shadow .2s ease;
}
.hm-pin span{ display:none; }
.hm-zoomed .hm-pin{ width:auto; height:auto; padding:3px 9px; }
.hm-zoomed .hm-pin span{ display:inline; }
.hm-pin:hover, .hm-pin.is-active{
  transform:translate(-50%,-50%) scale(1.25);
  box-shadow:0 0 0 4px rgba(255,255,255,.55), 0 6px 16px rgba(13,19,33,.4);
}
.hm-pin.is-dim{ opacity:.35; }

/* ----- Popup ----- */
.leaflet-popup-content-wrapper{ border-radius:14px; padding:0; overflow:hidden; }
.leaflet-popup-content{ margin:0; width:230px !important; }
.hm-pop-img{ display:block; width:100%; height:110px; object-fit:cover; }
.hm-pop-body{ padding:12px 14px 14px; }
.hm-pop-price{
  display:inline-block;
  font-size:.78rem;
  font-weight:800;
  padding:2px 10px;
  border-radius:999px;
  margin-bottom:6px;
}
.hm-pop h4{
  font-family:'Poppins',sans-serif;
  font-size:.98rem;
  font-weight:700;
  line-height:1.3;
  color:var(--text-dark);
  margin:0 0 4px;
}
.hm-pop p{ margin:0 0 3px; font-size:.8rem; color:var(--text-muted); }
.hm-pop-loc i{ color:var(--accent-dark); margin-right:3px; }
.hm-pop-cfg{ font-weight:600; color:var(--text-dark) !important; }
.hm-pop-link{
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin-top:8px;
  font-size:.82rem;
  font-weight:700;
  color:var(--dark);
  background:var(--accent);
  padding:.4rem .9rem;
  border-radius:999px;
}
.hm-pop-link i{ display:flex; line-height:1; transition:transform .2s; }
.hm-pop-link:hover{ background:var(--accent-dark); color:var(--dark); }
.hm-pop-link:hover i{ transform:translateX(3px); }

/* ----- Area ranking panel ----- */
.hm-panel{
  display:flex;
  flex-direction:column;
  height:100%;
  max-height:640px;
  background:#fff;
  border:1px solid var(--border-soft);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-soft);
  overflow:hidden;
}
.hm-panel-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:18px 18px 12px;
  border-bottom:1px solid var(--border-soft);
}
.hm-panel-head h2{ font-size:1.1rem; font-weight:700; margin:0 0 2px; color:var(--text-dark); }
.hm-panel-head p{ margin:0; font-size:.8rem; color:var(--text-muted); }
.hm-sort{
  flex-shrink:0;
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:1.5px solid var(--border-soft);
  background:#fff;
  color:var(--text-dark);
  font-size:.76rem;
  font-weight:600;
  padding:.35rem .7rem;
  border-radius:999px;
  transition:.2s;
}
.hm-sort i{ display:flex; line-height:1; }
.hm-sort:hover{ border-color:var(--accent); }

.hm-areas{
  list-style:none;
  margin:0;
  padding:8px;
  overflow-y:auto;
  flex:1 1 auto;
  scrollbar-width:thin;
}
.hm-areas-empty{ padding:24px 12px; text-align:center; color:var(--text-muted); font-size:.88rem; }
.hm-area{
  display:flex;
  align-items:flex-start;
  gap:12px;
  width:100%;
  text-align:left;
  border:1.5px solid transparent;
  background:transparent;
  border-radius:var(--radius-md);
  padding:11px 12px;
  transition:background .2s, border-color .2s;
}
.hm-area:hover{ background:var(--bg-light); }
.hm-area.active{ background:#fffbea; border-color:var(--accent); }
.hm-area-rank{
  flex:0 0 26px;
  width:26px;height:26px;
  border-radius:50%;
  display:inline-flex;align-items:center;justify-content:center;
  background:var(--bg-light);
  color:var(--text-muted);
  font-size:.74rem;
  font-weight:700;
  margin-top:1px;
}
.hm-area.active .hm-area-rank{ background:var(--accent); color:var(--dark); }
.hm-area-body{ flex:1 1 auto; min-width:0; display:block; }
.hm-area-top{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
.hm-area-top b{
  font-size:.92rem;
  font-weight:600;
  color:var(--text-dark);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.hm-area-top strong{ font-family:'Poppins',sans-serif; font-size:.92rem; font-weight:700; flex-shrink:0; }
.hm-area-meta{ display:block; font-size:.76rem; color:var(--text-muted); margin:2px 0 7px; }
.hm-area-bar{ display:block; height:6px; background:var(--bg-light); border-radius:999px; overflow:hidden; }
.hm-area-bar i{ display:block; height:100%; border-radius:999px; transition:width .5s ease; }

/* ----- Note + CTA ----- */
.hm-note{
  display:flex;
  gap:8px;
  margin:18px 2px 0;
  font-size:.8rem;
  color:var(--text-muted);
}
.hm-note i{ color:var(--accent-dark); margin-top:2px; }

.hm-cta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  flex-wrap:wrap;
  margin-top:28px;
  padding:28px 32px;
  border-radius:var(--radius-lg);
  background:radial-gradient(circle at 10% 20%, rgba(255,198,11,.2) 0%, transparent 45%), linear-gradient(135deg,var(--dark) 0%,var(--dark-2) 100%);
  color:#fff;
}
.hm-cta h3{ font-family:'Poppins',sans-serif; font-size:1.3rem; font-weight:700; margin:0 0 4px; color:#fff; }
.hm-cta p{ margin:0; color:#c3c7d4; font-size:.92rem; max-width:560px; }

/* ----- Responsive ----- */
@media (max-width:991.98px){
  .hm-stats{ grid-template-columns:repeat(2,1fr); }
  .hm-map-card{ min-height:480px; height:480px; }
  .hm-panel{ max-height:460px; }
}
@media (max-width:575px){
  .hm-stats{ gap:10px; }
  .hm-stat{ padding:12px; gap:10px; }
  .hm-stat-icon{ flex-basis:38px; width:38px; height:38px; font-size:1.05rem; border-radius:11px; }
  .hm-stat strong{ font-size:1rem; }
  .hm-filters{ padding:14px; gap:14px; }
  .hm-filter-group{ width:100%; }
  .hm-select{ width:100%; }
  .hm-seg{ width:100%; }
  .hm-seg button{ flex:1; justify-content:center; }
  .hm-map-card{ min-height:440px; height:440px; }
  .hm-legend{ left:10px; bottom:22px; padding:8px 10px 10px; }
  .hm-legend li{ font-size:.72rem; }
  .hm-cta{ padding:22px 20px; }
}
@media (prefers-reduced-motion:reduce){
  .hm-pin, .hm-area-bar i, .hm-chip, .hm-seg button{ transition:none; }
}
