/* =====================================================
   SCHOOLS NEAR ME – nearby.css
   ===================================================== */

/* ── Hero ─────────────────────────────────────────── */
.nb-hero {
  position: relative;
  background: linear-gradient(135deg, #000d26 0%, #002266 45%, #001840 100%);
  padding: 5.5rem 0 3.5rem;
  overflow: hidden;
  z-index: 1;
}
.nb-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 60%, rgba(255,205,0,.1) 0%, transparent 55%),
    radial-gradient(circle at 85% 30%, rgba(0,166,81,.08) 0%, transparent 50%);
}
.nb-hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
}
.nb-hero-inner { position: relative; }
.nb-hero-tag {
  display: inline-flex; align-items: center; gap: .5rem;
  background: rgba(255,205,0,.15); border: 1px solid rgba(255,205,0,.3);
  color: var(--gold); font-size: .72rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: .35rem 1rem; border-radius: 999px; margin-bottom: 1.1rem;
}
.nb-hero h1 {
  font-family: var(--font-head);
  font-size: clamp(1.9rem, 3.5vw, 3rem);
  font-weight: 800; color: var(--white); line-height: 1.15;
  margin-bottom: .75rem;
}
.nb-hero h1 span { color: var(--gold); }
.nb-hero-sub {
  color: rgba(255,255,255,.7); font-size: 1rem;
  line-height: 1.7; max-width: 560px; margin-bottom: 2rem;
}

/* ── Main Search Bar ──────────────────────────────── */
.nb-search-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  padding: 1.25rem 1.5rem;
  max-width: 780px;
}
.nb-search-row {
  display: flex; gap: .75rem; align-items: stretch; flex-wrap: wrap;
}
.nb-search-field {
  position: relative; flex: 1; min-width: 240px;
}
.nb-search-field i {
  position: absolute; left: .9rem; top: 50%; transform: translateY(-50%);
  color: var(--gray-500); font-size: .9rem; pointer-events: none;
  transition: color .2s;
}
.nb-search-field:focus-within i { color: var(--navy); }
.nb-search-input {
  width: 100%; border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: .8rem 1rem .8rem 2.5rem;
  font-family: var(--font-main); font-size: .95rem;
  color: var(--gray-900); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.nb-search-input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0,48,135,.1);
}
.nb-search-input::placeholder { color: var(--gray-300); }

.nb-locate-btn {
  display: flex; align-items: center; gap: .5rem;
  padding: .8rem 1.25rem;
  background: var(--navy); color: var(--white);
  border: none; border-radius: var(--radius-md);
  font-family: var(--font-main); font-size: .875rem; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: background .2s, transform .15s;
}
.nb-locate-btn:hover { background: var(--navy-light); transform: translateY(-1px); }
.nb-locate-btn.loading i { animation: spin .8s linear infinite; }

.nb-search-btn {
  display: flex; align-items: center; gap: .5rem;
  padding: .8rem 1.5rem;
  background: linear-gradient(135deg, var(--gold), #E6B800);
  color: var(--navy-dark); border: none; border-radius: var(--radius-md);
  font-family: var(--font-main); font-size: .875rem; font-weight: 800;
  cursor: pointer; white-space: nowrap;
  transition: transform .15s, box-shadow .2s;
  box-shadow: 0 4px 16px rgba(255,205,0,.35);
}
.nb-search-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255,205,0,.45); }

/* Autocomplete dropdown */
.nb-ac-drop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  z-index: 9000; display: none; overflow: hidden;
  max-height: 320px; overflow-y: auto;
}
.nb-ac-drop.open { display: block; animation: fadeSlideDown .2s ease; }
.nb-ac-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem; cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  transition: background .12s;
}
.nb-ac-item:last-child { border-bottom: none; }
.nb-ac-item:hover, .nb-ac-item.focused { background: rgba(0,48,135,.04); }
.nb-ac-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(0,48,135,.08);
  display: flex; align-items: center; justify-content: center;
  color: var(--navy); font-size: .8rem; flex-shrink: 0;
}
.nb-ac-main { font-size: .875rem; font-weight: 600; color: var(--gray-900); }
.nb-ac-sub  { font-size: .72rem; color: var(--gray-500); margin-top: .1rem; }
.nb-ac-loading {
  padding: 1rem; text-align: center;
  color: var(--gray-500); font-size: .85rem;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
}
.nb-ac-loading i { animation: spin .8s linear infinite; }

/* Hero stats row */
.nb-hero-stats {
  display: flex; gap: 2rem; margin-top: 1.5rem; flex-wrap: wrap;
}
.nb-stat { text-align: left; }
.nb-stat-num {
  display: block; font-family: var(--font-head);
  font-size: 1.6rem; font-weight: 800; color: var(--gold); line-height: 1;
}
.nb-stat-lbl { font-size: .7rem; color: rgba(255,255,255,.55); text-transform: uppercase; letter-spacing: .06em; }

/* ── Page Body ────────────────────────────────────── */
.nb-body {
  display: grid;
  grid-template-columns: 420px 1fr;
  min-height: calc(100vh - 56px);
}

/* ── Left Panel ───────────────────────────────────── */
.nb-panel {
  background: var(--gray-50);
  border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column;
  height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
  overflow: hidden;
}
.nb-panel-head {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 1.25rem .85rem;
  flex-shrink: 0;
}
.nb-panel-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .75rem;
}
.nb-panel-title h2 {
  font-family: var(--font-head); font-size: .95rem;
  font-weight: 800; color: var(--gray-900);
  display: flex; align-items: center; gap: .5rem;
}
.nb-panel-title h2 i { color: var(--navy); }
.nb-results-badge {
  background: var(--navy); color: var(--white);
  font-size: .7rem; font-weight: 700; padding: .2rem .55rem;
  border-radius: 999px; display: inline-block;
}

/* Radius + Filter bar */
.nb-filter-row {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
}
.nb-radius-btns { display: flex; gap: .3rem; }
.nb-radius-btn {
  padding: .3rem .65rem; border: 1.5px solid var(--gray-200);
  border-radius: 999px; background: var(--white);
  font-size: .72rem; font-weight: 700; cursor: pointer;
  color: var(--gray-700); transition: all .15s;
  font-family: var(--font-main);
}
.nb-radius-btn:hover { border-color: var(--navy); color: var(--navy); }
.nb-radius-btn.active { background: var(--navy); border-color: var(--navy); color: var(--white); }

.nb-filter-select {
  border: 1.5px solid var(--gray-200); border-radius: 999px;
  padding: .3rem .85rem .3rem .65rem;
  font-family: var(--font-main); font-size: .72rem;
  color: var(--gray-700); background: var(--white); cursor: pointer;
  outline: none; transition: border-color .15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .5rem center;
  padding-right: 1.6rem;
}
.nb-filter-select:focus { border-color: var(--navy); }

/* Sort + stats row */
.nb-sort-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: .6rem; padding-top: .6rem;
  border-top: 1px solid var(--gray-100);
  gap: .75rem;
}
.nb-sort-label { font-size: .72rem; color: var(--gray-500); display: flex; align-items: center; gap: .3rem; }
.nb-sort-select {
  border: 1px solid var(--gray-200); border-radius: 6px;
  padding: .25rem .5rem; font-size: .72rem;
  font-family: var(--font-main); color: var(--gray-700);
  background: var(--white); cursor: pointer; outline: none;
}

/* ── Results list ─────────────────────────────────── */
.nb-results-scroll {
  flex: 1; overflow-y: auto; padding: .75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}
.nb-results-scroll::-webkit-scrollbar { width: 4px; }
.nb-results-scroll::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 2px; }

/* Empty / loading states */
.nb-state-msg {
  text-align: center; padding: 3rem 1rem;
  color: var(--gray-400);
}
.nb-state-msg i { font-size: 2.5rem; display: block; margin-bottom: .75rem; }
.nb-state-msg h3 { font-size: 1rem; color: var(--gray-600); margin-bottom: .4rem; }
.nb-state-msg p { font-size: .82rem; line-height: 1.6; }

/* ── School Card ──────────────────────────────────── */
.nb-school-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: .6rem;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  position: relative;
  overflow: hidden;
  animation: cardIn .3s ease both;
}
.nb-school-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--card-accent, var(--navy));
  border-radius: 3px 0 0 3px;
}
.nb-school-card:hover {
  border-color: var(--navy);
  box-shadow: 0 4px 20px rgba(0,48,135,.12);
  transform: translateX(2px);
}
.nb-school-card.highlighted {
  border-color: var(--navy);
  box-shadow: 0 4px 24px rgba(0,48,135,.18);
  transform: translateX(3px);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Card header */
.nb-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .5rem; margin-bottom: .6rem;
}
.nb-card-rank {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 800; font-size: .72rem;
  flex-shrink: 0;
}
.nb-card-rank.gold   { background: linear-gradient(135deg,#FFD700,#FFA500); color: #7B4A00; }
.nb-card-rank.silver { background: linear-gradient(135deg,#C0C0C0,#999);   color: #444; }
.nb-card-rank.bronze { background: linear-gradient(135deg,#CD7F32,#A0522D); color: var(--white); }
.nb-card-rank.other  { background: var(--gray-100); color: var(--gray-500); }

.nb-card-name-wrap { flex: 1; min-width: 0; }
.nb-card-name {
  font-weight: 700; font-size: .88rem; color: var(--gray-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: .15rem;
}
.nb-card-loc {
  font-size: .72rem; color: var(--gray-500);
  display: flex; align-items: center; gap: .25rem;
}

.nb-dist-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .6rem;
  background: rgba(0,48,135,.07);
  color: var(--navy);
  border-radius: 999px;
  font-size: .7rem; font-weight: 800;
  flex-shrink: 0;
}

/* Card body */
.nb-card-body { display: flex; flex-direction: column; gap: .5rem; }
.nb-card-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.nb-tag {
  display: inline-block; padding: .15rem .55rem;
  border-radius: 999px; font-size: .65rem; font-weight: 700;
}
.nb-tag-type { background: rgba(0,48,135,.08); color: var(--navy); }
.nb-tag-gov  { background: rgba(0,48,135,.1);   color: #002266; }
.nb-tag-cath { background: rgba(139,0,0,.1);     color: #6B0000; }
.nb-tag-ind  { background: rgba(184,134,11,.1);  color: #7B5A00; }
.nb-tag-sel  { background: rgba(255,205,0,.2);   color: #7B5200; }

/* ICSEA mini bar */
.nb-icsea-row {
  display: flex; align-items: center; gap: .5rem;
}
.nb-icsea-label { font-size: .65rem; color: var(--gray-500); font-weight: 700; flex-shrink: 0; width: 36px; }
.nb-icsea-track { flex: 1; height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.nb-icsea-fill  { height: 100%; border-radius: 3px; transition: width 1s cubic-bezier(.4,0,.2,1); }
.nb-icsea-val   { font-weight: 700; font-size: .78rem; color: var(--gray-900); min-width: 34px; text-align: right; flex-shrink: 0; }

/* Card actions */
.nb-card-actions {
  display: flex; gap: .4rem; margin-top: .4rem;
}
.nb-btn-sm {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .7rem; border-radius: 999px;
  font-size: .68rem; font-weight: 700;
  cursor: pointer; border: none; transition: all .15s;
  font-family: var(--font-main);
}
.nb-btn-view { background: var(--navy); color: var(--white); text-decoration: none; }
.nb-btn-view:hover { background: var(--navy-light); }
.nb-btn-compare { background: var(--gray-100); color: var(--gray-700); }
.nb-btn-compare:hover { background: rgba(0,166,81,.12); color: #005A28; }
.nb-btn-compare.added { background: rgba(0,166,81,.12); color: #005A28; }

/* ── Map Container ────────────────────────────────── */
.nb-map-wrap {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow: hidden;
}
#nearbyMap {
  width: 100%; height: 100%;
}

/* Leaflet overrides */
.leaflet-container { font-family: var(--font-main); }
.leaflet-control-layers {
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--gray-200) !important;
  box-shadow: var(--shadow-md) !important;
}
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.18) !important;
  border: none !important;
  padding: 0 !important;
  overflow: hidden;
}
.leaflet-popup-content { margin: 0 !important; }
.leaflet-popup-tip-container { display: none !important; }

/* ── Custom map markers ───────────────────────────── */
.nb-pin-wrap {
  display: flex; flex-direction: column; align-items: center;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.3));
  transition: filter .2s, transform .2s;
}
.nb-pin-wrap:hover, .nb-pin-wrap.active {
  filter: drop-shadow(0 5px 12px rgba(0,0,0,.45));
  transform: scale(1.15) translateY(-2px);
}
.nb-pin-body {
  width: 36px; height: 36px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid rgba(255,255,255,.8);
}
.nb-pin-inner {
  transform: rotate(45deg);
  font-family: var(--font-head); font-weight: 800; font-size: .7rem;
  color: var(--white); line-height: 1;
}
/* Pin colors by ICSEA */
.pin-vlow  { background: #E8112D; }
.pin-low   { background: #FF8C00; }
.pin-avg   { background: #D4A800; }
.pin-above { background: #4CAF50; }
.pin-high  { background: #007A3D; }
.pin-none  { background: #64748B; }
/* User location pin */
.nb-user-pin {
  width: 18px; height: 18px; border-radius: 50%;
  background: #4285F4;
  border: 3px solid var(--white);
  box-shadow: 0 0 0 4px rgba(66,133,244,.25), 0 4px 12px rgba(0,0,0,.3);
  animation: pulseBlue 2s ease infinite;
}
@keyframes pulseBlue {
  0%, 100% { box-shadow: 0 0 0 4px rgba(66,133,244,.25), 0 4px 12px rgba(0,0,0,.3); }
  50%       { box-shadow: 0 0 0 10px rgba(66,133,244,.1), 0 4px 12px rgba(0,0,0,.3); }
}

/* ── Map Popup ────────────────────────────────────── */
.nb-popup {
  width: 280px;
  font-family: var(--font-main);
}
.nb-popup-head {
  background: var(--navy);
  padding: .9rem 1rem .75rem;
}
.nb-popup-name {
  font-family: var(--font-head); font-size: .95rem; font-weight: 700;
  color: var(--white); margin-bottom: .2rem; line-height: 1.2;
}
.nb-popup-loc { font-size: .72rem; color: rgba(255,255,255,.65); }
.nb-popup-body { padding: .85rem 1rem; }
.nb-popup-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .65rem; }
.nb-popup-stat {
  display: flex; align-items: center; justify-content: space-between;
  padding: .3rem 0; border-bottom: 1px solid var(--gray-100);
  font-size: .78rem;
}
.nb-popup-stat:last-of-type { border-bottom: none; }
.nb-popup-stat-lbl { color: var(--gray-500); font-weight: 600; }
.nb-popup-stat-val { color: var(--gray-900); font-weight: 700; }
.nb-popup-icsea-bar { height: 5px; border-radius: 3px; margin-top: .2rem; transition: width 1s; }
.nb-popup-actions {
  display: flex; gap: .5rem; padding: .75rem 1rem;
  border-top: 1px solid var(--gray-100);
}

/* ── Map overlay: stats chip ──────────────────────── */
.nb-map-stats {
  position: absolute; top: 12px; left: 12px; z-index: 800;
  background: var(--white); border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  padding: .55rem .9rem;
  display: flex; align-items: center; gap: .45rem;
  font-size: .78rem; color: var(--gray-700);
  border: 1.5px solid rgba(0,48,135,.12);
  backdrop-filter: blur(6px);
}
.nb-map-stats strong { color: var(--navy); font-weight: 800; }

/* ── Custom Map Toolbar (top-right) ──────────────── */
.nb-map-toolbar {
  display: flex; flex-direction: column; gap: 4px;
}
.nb-map-tool-btn {
  width: 36px; height: 36px;
  background: var(--white);
  border: 1.5px solid rgba(0,0,0,.12);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; color: var(--gray-700);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  transition: background .15s, color .15s, transform .15s, box-shadow .15s;
}
.nb-map-tool-btn:hover {
  background: var(--navy); color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,48,135,.3);
}

/* ── Basemap Switcher (topright) ─────────────────── */
.nb-basemap-ctrl { position: relative; z-index: 9999; }
.nb-bm-widget { position: relative; }

.nb-bm-trigger {
  display: flex; align-items: center; gap: .45rem;
  padding: .5rem .85rem;
  background: var(--white);
  border: 1.5px solid rgba(0,0,0,.12);
  border-radius: 8px;
  font-family: var(--font-main); font-size: .78rem; font-weight: 700;
  color: var(--gray-800); cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}
.nb-bm-trigger i:first-child { color: var(--navy); font-size: .8rem; }
.nb-bm-trigger:hover { background: #f8f9fa; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.nb-bm-chevron {
  font-size: .6rem !important; color: var(--gray-400) !important;
  transform: rotate(180deg);
  transition: transform .25s ease;
  margin-left: 2px;
}

/* Panel (floats below trigger, ahora que el switcher está en topright) */
.nb-bm-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--white);
  border: 1.5px solid rgba(0,0,0,.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  padding: .75rem;
  min-width: 200px;
  display: none;
  animation: nbPanelIn .2s ease;
  z-index: 1200;
}
.nb-bm-panel.open { display: block; }
@keyframes nbPanelIn {
  from { opacity: 0; transform: translateY(6px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.nb-bm-panel-title {
  font-size: .65rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--gray-400);
  margin-bottom: .6rem; padding-bottom: .4rem;
  border-bottom: 1px solid var(--gray-100);
}
.nb-bm-thumbs {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: .4rem;
}
.nb-bm-thumb {
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  background: none; border: 2px solid var(--gray-200);
  border-radius: 8px; padding: .4rem;
  cursor: pointer; transition: border-color .15s, transform .12s;
  font-family: var(--font-main);
}
.nb-bm-thumb:hover { border-color: var(--navy); transform: scale(1.03); }
.nb-bm-thumb.active {
  border-color: var(--navy);
  background: rgba(0,48,135,.04);
  box-shadow: 0 0 0 3px rgba(0,48,135,.12);
}
.nb-bm-preview {
  width: 100%; height: 44px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.nb-bm-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0,0,0,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.07) 1px, transparent 1px);
  background-size: 10px 10px;
}
.nb-bm-icon { font-size: .9rem; color: rgba(255,255,255,.85); filter: drop-shadow(0 1px 3px rgba(0,0,0,.4)); }
.nb-bm-thumb:not(.active) .nb-bm-icon { color: rgba(0,0,0,.4); filter: none; }
/* Light thumb icon is darker */
.nb-bm-thumb[data-key="light"] .nb-bm-icon { color: rgba(0,48,135,.5); filter: none; }
.nb-bm-name {
  font-size: .65rem; font-weight: 700; color: var(--gray-700);
  text-align: center;
}
.nb-bm-thumb.active .nb-bm-name { color: var(--navy); }

/* Override Leaflet default zoom buttons */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 2px 10px rgba(0,0,0,.12) !important;
  border-radius: 8px !important;
  overflow: hidden;
  margin-top: 6px !important;
}
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  width: 36px !important; height: 36px !important;
  line-height: 36px !important;
  font-size: 1.1rem !important;
  color: var(--gray-700) !important;
  background: var(--white) !important;
  border: none !important;
  border-bottom: 1.5px solid var(--gray-100) !important;
  transition: background .15s, color .15s !important;
}
.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
  background: var(--navy) !important;
  color: var(--white) !important;
}
.leaflet-control-zoom-out { border-bottom: none !important; }

/* Scale bar */
.leaflet-control-scale-line {
  border-color: var(--gray-400) !important;
  color: var(--gray-600) !important;
  font-size: .65rem !important;
  background: rgba(255,255,255,.85) !important;
  padding: 1px 6px !important;
  border-radius: 0 0 4px 4px !important;
}

/* ── ICSEA Legend (topleft) ──────────────────────── */
.nb-icsea-legend {
  background: var(--white);
  border: 1.5px solid rgba(0,0,0,.1);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  overflow: hidden;
  min-width: 165px;
  backdrop-filter: blur(6px);
}
.nb-legend-header {
  display: flex; align-items: center; gap: .45rem;
  padding: .55rem .75rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
  font-size: .72rem; font-weight: 700; color: var(--gray-700);
}
.nb-legend-header span { flex: 1; }
.nb-legend-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); font-size: .65rem; padding: 0;
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: background .15s, color .15s;
}
.nb-legend-toggle:hover { background: var(--gray-200); color: var(--gray-700); }
.nb-legend-body {
  padding: .5rem .75rem .6rem;
  transition: max-height .25s ease, opacity .2s;
  overflow: hidden;
  max-height: 200px; opacity: 1;
}
.nb-legend-body.hidden { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }
.nb-legend-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .2rem 0; font-size: .72rem;
}
.nb-legend-swatch {
  width: 12px; height: 12px; border-radius: 50%;
  flex-shrink: 0; display: block;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.nb-legend-lbl { color: var(--gray-600); }
.nb-legend-lbl b { color: var(--gray-900); font-weight: 700; }
.nb-legend-note {
  font-size: .62rem; color: var(--gray-400);
  margin-top: .35rem; padding-top: .35rem;
  border-top: 1px solid var(--gray-100);
}

/* Dark map mode adjustments */
#nearbyMap.nb-map-dark ~ .leaflet-control-container .nb-map-stats { background: rgba(30,36,56,.9); border-color: rgba(255,255,255,.1); color: rgba(255,255,255,.8); }
#nearbyMap.nb-map-dark ~ .leaflet-control-container .nb-map-stats strong { color: #FFCD00; }

/* ── Toast ────────────────────────────────────────── */
.nb-toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--gray-900); color: var(--white);
  padding: .75rem 1.5rem; border-radius: 999px;
  font-size: .875rem; font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  z-index: 9999; transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .3s;
  opacity: 0;
}
.nb-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.nb-toast.toast-success { background: #005A28; }
.nb-toast.toast-error   { background: var(--red); }
.nb-toast.toast-info    { background: var(--navy); }

/* ── Avg ICSEA chip ───────────────────────────────── */
.nb-avg-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .85rem;
  border-radius: 999px;
  font-size: .75rem; font-weight: 700;
}
.nb-avg-chip.avg-good { background: rgba(0,166,81,.1); color: #005A28; }
.nb-avg-chip.avg-mid  { background: rgba(255,205,0,.15); color: #7B5200; }
.nb-avg-chip.avg-low  { background: rgba(232,17,45,.1); color: #9A000D; }

/* ── Compare quick bar ────────────────────────────── */
.nb-compare-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--navy-dark);
  border-top: 2px solid rgba(255,205,0,.3);
  padding: .85rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  z-index: 900;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -8px 32px rgba(0,0,0,.25);
}
.nb-compare-bar.show { transform: translateY(0); }
.nb-compare-bar-label {
  color: rgba(255,255,255,.8); font-size: .8rem; font-weight: 600; flex-shrink: 0;
}
.nb-compare-slots { display: flex; gap: .5rem; flex: 1; flex-wrap: wrap; }
.nb-cmp-slot {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-sm); padding: .3rem .75rem;
  font-size: .75rem; color: var(--white); font-weight: 600;
  display: flex; align-items: center; gap: .4rem;
}
.nb-cmp-slot button {
  background: none; border: none; color: rgba(255,255,255,.6);
  cursor: pointer; padding: 0; font-size: .7rem;
  transition: color .15s;
}
.nb-cmp-slot button:hover { color: var(--white); }
.nb-compare-go {
  background: linear-gradient(135deg, var(--gold), #E6B800);
  color: var(--navy-dark); border: none; border-radius: 999px;
  padding: .6rem 1.25rem; font-family: var(--font-main);
  font-size: .8rem; font-weight: 800; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  white-space: nowrap; flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(255,205,0,.3);
}
.nb-compare-go:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255,205,0,.4); }
.nb-compare-clear {
  background: none; border: none; color: rgba(255,255,255,.5);
  font-size: .72rem; cursor: pointer; flex-shrink: 0;
  transition: color .15s;
}
.nb-compare-clear:hover { color: var(--white); }

/* ── Animations ───────────────────────────────────── */
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 960px) {
  .nb-body { grid-template-columns: 340px 1fr; }
}
@media (max-width: 768px) {
  .nb-body {
    grid-template-columns: 1fr;
    grid-template-rows: min(68vh, 480px) 1fr;
  }
  .nb-panel {
    position: static;
    height: auto;
    max-height: none;
    order: 2;
  }
  .nb-map-wrap {
    position: static;
    height: min(68vh, 480px);
    min-height: 300px;
    order: 1;
    top: 0;
  }
  .nb-hero { padding: 4.5rem 0 2.5rem; }
  .nb-search-row { flex-direction: column; }
  .nb-search-btn { width: 100%; justify-content: center; }
  .nb-locate-btn { width: 100%; justify-content: center; }
}
@media (max-width: 768px) {
  /* En móvil la leyenda ICSEA (topleft Leaflet) puede solapar con nb-map-stats:
     movemos nb-map-stats a la derecha para evitar conflicto */
  .nb-map-stats {
    left: auto !important;
    right: 10px;
    top: 10px;
    font-size: .72rem;
    padding: .4rem .7rem;
  }
}
@media (max-width: 480px) {
  .nb-panel-head { padding: .85rem 1rem; }
  .nb-results-scroll { padding: .5rem; }
}
