/* ═══════════════════════════════════════════════════════════════
   COLEGIOS CERCA DE MÍ — cerca.css
   ═══════════════════════════════════════════════════════════════ */

/* ── HERO ────────────────────────────────────────────────────── */
.cerca-hero {
  position: relative;
  min-height: 340px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 5rem 0 3rem;
}
.cerca-hero-bg {
  position: absolute; inset: 0;
  background: url('../images/alumnos-en-colegios.webp') center/cover no-repeat;
  opacity: .07;
}
.cerca-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(135deg,
    rgba(14,30,54,.97) 0%,
    rgba(20,50,80,.94) 55%,
    rgba(22,197,94,.15) 100%);
}
.cerca-hero-content {
  position: relative; z-index: 2; text-align: center; color: #fff;
}
.cerca-hero-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  background: rgba(34,197,94,.18); border: 1px solid rgba(34,197,94,.4);
  border-radius: 50px; padding: .4rem 1.2rem;
  color: #86efac; font-size: .82rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  margin-bottom: 1.25rem;
  animation: fadeInDown .6s ease both;
}
.cerca-hero-title {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900; line-height: 1.1; margin-bottom: 1rem;
  animation: fadeInUp .7s ease .1s both;
}
.cerca-highlight {
  background: linear-gradient(90deg, #22c55e, #86efac);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.cerca-hero-sub {
  font-size: 1.05rem; color: rgba(255,255,255,.78);
  max-width: 580px; margin: 0 auto 2rem; line-height: 1.7;
  animation: fadeInUp .7s ease .2s both;
}
.cerca-hero-sub strong { color: #86efac; }

/* BOTÓN PRINCIPAL DE GEOLOCALIZACIÓN */
.cerca-geo-btn {
  display: inline-flex; align-items: center; gap: .75rem;
  padding: 1.1rem 2.25rem;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff; border-radius: 50px; font-family: 'Outfit', sans-serif;
  font-size: 1rem; font-weight: 800; cursor: pointer;
  transition: all .3s ease; border: none;
  box-shadow: 0 8px 32px rgba(34,197,94,.45);
  animation: fadeInUp .7s ease .3s both;
  position: relative; overflow: hidden;
}
.cerca-geo-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #16a34a, #15803d);
  opacity: 0; transition: opacity .3s;
}
.cerca-geo-btn:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(34,197,94,.55); }
.cerca-geo-btn:hover::before { opacity: 1; }
.cerca-geo-btn-icon {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; position: relative; z-index: 1;
}
.cerca-geo-btn span { position: relative; z-index: 1; }

/* Pulso GPS */
@keyframes gpsPulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  70%  { box-shadow: 0 0 0 20px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.cerca-geo-btn.pulsing .cerca-geo-btn-icon { animation: gpsPulse 1.5s infinite; }

/* ── FALLBACK: CIUDADES ──────────────────────────────────────── */
.cerca-fallback {
  margin-top: 1.5rem;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius-md); padding: 1.25rem 1.5rem;
  max-width: 600px; margin-left: auto; margin-right: auto;
  animation: fadeInUp .4s ease both;
}
.cerca-fallback-title {
  display: flex; align-items: center; gap: .5rem;
  font-size: .88rem; color: #fbbf24; font-weight: 700;
  margin-bottom: 1rem;
}
.cerca-fallback-title i { font-size: .9rem; }
.cerca-cities-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem;
}
.cerca-city-btn {
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem .75rem; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  color: #fff; font-size: .82rem; font-weight: 600; cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.cerca-city-btn:hover {
  background: rgba(34,197,94,.3); border-color: rgba(34,197,94,.6);
  transform: translateY(-2px);
}
.cerca-city-btn i { color: #86efac; font-size: .75rem; }



.cerca-hero-chips {
  display: flex; flex-wrap: wrap; gap: .6rem;
  justify-content: center; margin-top: 1.5rem;
  animation: fadeInUp .7s ease .4s both;
}
.cerca-hero-chips span {
  display: inline-flex; align-items: center; gap: .35rem;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  border-radius: 50px; padding: .3rem .9rem;
  font-size: .8rem; color: rgba(255,255,255,.8);
}
.cerca-hero-chips i { color: #86efac; font-size: .75rem; }

/* ── PANEL PRINCIPAL ─────────────────────────────────────────── */
.cerca-main { padding: 2rem 0 4rem; }

/* STATUS BAR */
.cerca-status-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}
.cerca-status-info { display: flex; align-items: center; gap: .75rem; }
.cerca-status-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--gray-300); flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}
.cerca-status-dot.active {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,.2);
  animation: gpsPulse 2s infinite;
}
.cerca-status-dot.loading {
  background: #f59e0b; animation: gpsPulse 1s infinite;
}
.cerca-status-dot.error { background: var(--red); }
.cerca-status-text { font-weight: 700; font-size: .9rem; color: var(--navy); }
.cerca-status-sub  { font-size: .78rem; color: var(--gray-500); margin-top: .1rem; }
.cerca-status-count {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem; font-weight: 900; color: var(--navy);
  display: flex; align-items: center; gap: .4rem;
}
.cerca-status-count .cnt { color: #22c55e; font-size: 1.4rem; }
.cerca-status-actions { display: flex; gap: .625rem; }
.cerca-refresh-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem 1rem; border-radius: var(--radius-sm);
  background: rgba(30,58,95,.08); color: var(--navy);
  border: 1.5px solid rgba(30,58,95,.15);
  font-size: .82rem; font-weight: 700; cursor: pointer;
  transition: all var(--transition);
}
.cerca-refresh-btn:hover { background: var(--navy); color: #fff; }

/* ── FILTROS ─────────────────────────────────────────────────── */
.cerca-filters-panel {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.cerca-filters-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  background: linear-gradient(90deg, rgba(30,58,95,.04), transparent);
}
.cerca-filters-title {
  display: flex; align-items: center; gap: .625rem;
  font-weight: 800; font-size: .9rem; color: var(--navy);
}
.cerca-filters-title i { color: var(--red); }
.cerca-active-badge {
  background: var(--red); color: #fff; border-radius: 50px;
  padding: .1rem .55rem; font-size: .71rem; font-weight: 800;
  display: none;
}
.cerca-active-badge.visible { display: inline-block; }
.cerca-reset-link {
  font-size: .78rem; color: var(--red); font-weight: 700; cursor: pointer;
  transition: opacity var(--transition);
}
.cerca-reset-link:hover { opacity: .7; }

.cerca-filters-body {
  padding: 1.25rem 1.5rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.cerca-filter-group label {
  display: block; font-size: .72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--gray-600); margin-bottom: .625rem;
  display: flex; align-items: center; gap: .35rem;
}
.cerca-filter-group label i { color: var(--navy); }

/* Radio chips */
.cerca-radio-chips { display: flex; flex-wrap: wrap; gap: .375rem; }
.cerca-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .35rem .875rem; border-radius: 50px;
  border: 1.5px solid var(--gray-200); background: #fff;
  font-size: .8rem; font-weight: 600; color: var(--gray-600);
  cursor: pointer; transition: all .2s; white-space: nowrap;
}
.cerca-chip:hover { border-color: #22c55e; color: #16a34a; }
.cerca-chip.active { border-color: #22c55e; color: #fff; background: #22c55e; }
.cerca-chip.active-blue { border-color: var(--navy); color: #fff; background: var(--navy); }

/* Select */
.cerca-select {
  width: 100%; padding: .6rem 1rem;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  font-size: .85rem; color: var(--gray-800); outline: none;
  background: #fff; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right .75rem center; background-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.cerca-select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30,58,95,.1); }

/* Ordenar */
.cerca-sort-options { display: flex; gap: .375rem; }
.cerca-sort-btn {
  flex: 1; padding: .45rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200); background: #fff;
  font-size: .75rem; font-weight: 600; color: var(--gray-600);
  cursor: pointer; transition: all .2s; text-align: center;
}
.cerca-sort-btn:hover { border-color: var(--navy); color: var(--navy); }
.cerca-sort-btn.active { border-color: var(--navy); background: var(--navy); color: #fff; }

/* ── LAYOUT PRINCIPAL ────────────────────────────────────────── */
.cerca-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 1.5rem;
  align-items: start;
}
/* Toggle vista */
.cerca-view-toggle {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: 1rem;
}
.cerca-view-btn {
  display: flex; align-items: center; gap: .375rem;
  padding: .5rem 1rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200); background: #fff;
  font-size: .82rem; font-weight: 600; color: var(--gray-600);
  cursor: pointer; transition: all .2s;
}
.cerca-view-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.cerca-results-meta {
  margin-left: auto; font-size: .8rem; color: var(--gray-500);
}

/* ── LISTA DE COLEGIOS ───────────────────────────────────────── */
.cerca-list { display: flex; flex-direction: column; gap: .875rem; max-height: 78vh; overflow-y: auto; padding-right: .25rem; }
.cerca-list::-webkit-scrollbar { width: 4px; }
.cerca-list::-webkit-scrollbar-track { background: var(--gray-100); border-radius: 2px; }
.cerca-list::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 2px; }
.cerca-list::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* TARJETA escuela */
.cerca-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  transition: all .25s ease;
  cursor: pointer; position: relative; overflow: hidden;
  animation: cardIn .35s ease both;
  flex-shrink: 0;           /* ← impide que el flex la comprima */
  min-height: 180px;        /* ← garantiza altura mínima visible */
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cerca-card:hover {
  border-color: #22c55e;
  box-shadow: 0 6px 28px rgba(34,197,94,.18), 0 2px 8px rgba(0,0,0,.06);
  transform: translateX(4px);
}
.cerca-card.highlighted {
  border-color: #22c55e; border-width: 2px;
  box-shadow: 0 0 0 4px rgba(34,197,94,.15);
}
/* Barra de nivel de color izquierda */
.cerca-card-accent {
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.cerca-card-inner { padding: 1rem 1rem 1rem 1.1rem; }
.cerca-card-top {
  display: flex; align-items: flex-start; gap: .75rem;
  margin-bottom: .625rem;
}
.cerca-card-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff; flex-shrink: 0;
}
.cerca-card-info { flex: 1; min-width: 0; }
.cerca-card-name {
  font-weight: 800; font-size: .9rem; color: var(--navy);
  line-height: 1.3; margin-bottom: .2rem;
}
.cerca-card-nivel { font-size: .75rem; color: var(--gray-500); }
.cerca-dist-badge {
  display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0;
}
.cerca-dist-value {
  font-family: 'Outfit', sans-serif; font-weight: 900;
  font-size: 1.05rem; color: #22c55e; line-height: 1;
}
.cerca-dist-label { font-size: .65rem; color: var(--gray-400); }

.cerca-card-meta {
  display: flex; flex-wrap: wrap; gap: .375rem;
  margin-bottom: .625rem;
}
.cerca-meta-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: 50px; padding: .2rem .6rem;
  font-size: .7rem; color: var(--gray-600);
}
.cerca-meta-chip i { font-size: .65rem; }

.cerca-card-stats {
  display: flex; gap: 1rem;
  padding-top: .625rem; border-top: 1px solid var(--gray-100);
}
.cerca-stat { display: flex; flex-direction: column; align-items: center; flex: 1; }
.cerca-stat-val {
  font-family: 'Outfit', sans-serif; font-weight: 800;
  font-size: .95rem; color: var(--navy);
}
.cerca-stat-lbl { font-size: .65rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: .04em; }

.cerca-card-footer {
  display: flex; gap: .5rem; padding: .75rem 1rem 1rem;
  border-top: 1px solid var(--gray-100);
}
.cerca-card-link {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem; border-radius: var(--radius-sm);
  font-size: .8rem; font-weight: 700; transition: all .2s;
}
.cerca-card-link.primary {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: #fff; box-shadow: 0 3px 10px rgba(30,58,95,.25);
}
.cerca-card-link.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(30,58,95,.35); }
.cerca-card-link.secondary {
  background: rgba(34,197,94,.1); color: #16a34a;
  border: 1.5px solid rgba(34,197,94,.25);
}
.cerca-card-link.secondary:hover { background: rgba(34,197,94,.18); }
.cerca-card-link.compare-link {
  background: rgba(30,58,95,.07); color: var(--navy);
  border: 1.5px solid rgba(30,58,95,.15);
}
.cerca-card-link.compare-link.added { background: rgba(34,197,94,.12); color: #16a34a; border-color: rgba(34,197,94,.3); }

/* ── MAPA ────────────────────────────────────────────────────── */
.cerca-map-wrap {
  position: sticky; top: calc(var(--nav-h) + 1rem);
  border-radius: var(--radius-md); overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  height: 78vh; min-height: 500px;
}
#cercaMap { width: 100%; height: 100%; }

/* ── EMPTY / LOADING STATES ──────────────────────────────────── */
.cerca-empty {
  text-align: center; padding: 4rem 2rem;
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
.cerca-empty-anim {
  width: 90px; height: 90px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(34,197,94,.12), rgba(30,58,95,.08));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem; font-size: 2.25rem; color: #22c55e;
}
.cerca-empty h3 {
  font-family: 'Outfit', sans-serif; font-size: 1.4rem; font-weight: 800;
  color: var(--navy); margin-bottom: .625rem;
}
.cerca-empty p { color: var(--gray-500); line-height: 1.7; }

/* Skeleton loading */
.cerca-skeleton {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); padding: 1rem; overflow: hidden;
}
.skel { background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 4px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skel-line { height: 12px; margin-bottom: 8px; }

/* ── POPUPS LEAFLET CUSTOM ───────────────────────────────────── */
.cerca-popup { min-width: 190px; font-family: 'Outfit', sans-serif; }
.cerca-popup-name { font-weight: 800; font-size: .9rem; color: var(--navy); line-height: 1.3; margin-bottom: .375rem; }
.cerca-popup-nivel { font-size: .72rem; color: var(--gray-500); margin-bottom: .25rem; }
.cerca-popup-dist { font-size: .75rem; color: #22c55e; font-weight: 700; margin-bottom: .75rem; }
.cerca-popup-link {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem 1rem; border-radius: 50px;
  color: #fff; font-size: .78rem; font-weight: 700;
  transition: opacity .2s;
}
.cerca-popup-link:hover { opacity: .85; }

/* Marcador del usuario */
.cerca-user-marker {
  width: 24px; height: 24px; border-radius: 50%;
  background: radial-gradient(circle, #22c55e 30%, rgba(34,197,94,.3) 70%);
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(34,197,94,.35), 0 4px 14px rgba(34,197,94,.4);
  animation: userPing 2s ease infinite;
}
@keyframes userPing {
  0%,100% { box-shadow: 0 0 0 4px rgba(34,197,94,.35), 0 4px 14px rgba(34,197,94,.35); }
  50%      { box-shadow: 0 0 0 10px rgba(34,197,94,.1), 0 4px 14px rgba(34,197,94,.35); }
}

/* Círculo de radio */
.cerca-radius-circle { stroke-dasharray: 6, 4; }

/* ── INFO PILLS ──────────────────────────────────────────────── */
.cerca-stat-pills {
  display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.cerca-stat-pill {
  flex: 1; min-width: 120px;
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); padding: .875rem 1.1rem;
  display: flex; align-items: center; gap: .75rem;
  box-shadow: var(--shadow-sm);
}
.cerca-stat-pill-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff; flex-shrink: 0;
}
.cerca-stat-pill-val {
  font-family: 'Outfit', sans-serif; font-weight: 900;
  font-size: 1.2rem; color: var(--navy); line-height: 1;
}
.cerca-stat-pill-lbl { font-size: .72rem; color: var(--gray-500); }

/* ── SHARE PANEL ─────────────────────────────────────────────── */
.cerca-share-bar {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  border-radius: var(--radius-md); padding: 1rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; color: #fff;
}
.cerca-share-text { font-size: .875rem; }
.cerca-share-text strong { font-family: 'Outfit', sans-serif; display: block; font-size: 1rem; }
.cerca-share-btns { display: flex; gap: .5rem; }
.cerca-share-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.1rem; border-radius: 50px;
  background: rgba(255,255,255,.15); color: #fff;
  font-size: .8rem; font-weight: 700; cursor: pointer;
  transition: background .2s; border: 1px solid rgba(255,255,255,.25);
}
.cerca-share-btn:hover { background: rgba(255,255,255,.25); }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .cerca-layout { grid-template-columns: 380px 1fr; }
}
@media (max-width: 900px) {
  .cerca-layout { grid-template-columns: 1fr; }
  .cerca-map-wrap { position: relative; top: auto; height: 380px; order: -1; }
  .cerca-list { max-height: none; }
  .cerca-stat-pills { gap: .5rem; }
}
@media (max-width: 580px) {
  .cerca-filters-body { grid-template-columns: 1fr; }
  .cerca-status-bar   { flex-direction: column; align-items: flex-start; }
  .cerca-hero-title   { font-size: 2rem; }
  .cerca-card-footer  { flex-direction: column; }
}
