/* ============================================================
   page-four / styles.css
   Poder Judicial del Perú — Ubica tu Sede Judicial
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --red: #88201f;
  --red-dark: #6d1918;
  --navy: #1a2744;
  --navy-dark: #111d36;

  /* Aero Glass */
  --glass-bg: rgba(255, 255, 255, 0.2);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shine: rgba(255, 255, 255, 0.55);

  --surface: #ffffff;
  --surface-muted: #f4f7fd;
  --text: #1a2744;
  --text-muted: #5a6a8a;
  --border: #d8e0ef;
  --border-light: rgba(216, 224, 239, 0.6);

  --shadow-panel:
    0 32px 80px rgba(26, 39, 68, 0.22), 0 8px 24px rgba(26, 39, 68, 0.1);
  --shadow-btn: 0 4px 16px rgba(26, 39, 68, 0.35);
  --shadow-result: 0 8px 30px rgba(26, 39, 68, 0.12);
  --shadow-dropdown:
    0 12px 40px rgba(26, 39, 68, 0.18), 0 4px 12px rgba(26, 39, 68, 0.08);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;

  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  background: transparent;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ── Fondo de página ─────────────────────────────────── */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  /* Imagen del Palacio de Justicia con overlay institucional */
  background-image:
    linear-gradient(
      135deg,
      rgba(223, 229, 241, 0.308) 10%,
      rgba(255, 226, 226, 0.336) 40%,
      rgb(233, 235, 240) 100%
    ),
    url("images/bg-white.jpg");
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
}

/* ── Layout ────────────────────────────────────────────────── */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 0;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 48px;
  min-height: calc(100vh - 52px);
}

/* ════════════════════════════════════════════════════════════
   AERO GLASS PANEL
   ════════════════════════════════════════════════════════════ */
.search-panel {
  /* Vidrio esmerilado */
  background: rgb(255 255 255 / 5%);
  /* var(--glass-bg);*/
  backdrop-filter: blur(40px) saturate(200%) brightness(1.08);
  -webkit-backdrop-filter: blur(40px) saturate(200%) brightness(1.08);

  /* Bordes tipo aero */
  border: 1px solid var(--glass-border);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-left-color: rgba(255, 255, 255, 0.7);

  border-radius: var(--radius);
  padding: 40px 40px 36px;

  /* Sombra profunda + brillo interior (efecto aero) */
  box-shadow:
    var(--shadow-panel),
    inset 0 1.5px 0 var(--glass-shine),
    inset 0 -1px 0 rgba(255, 255, 255, 0.15),
    inset 1px 0 0 rgba(255, 255, 255, 0.3);

  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  /* overflow visible para que el dropdown no sea recortado */
  overflow: visible;

  animation: slideIn 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Brillo superior interno tipo aero */
.search-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.28) 0%,
    rgba(255, 255, 255, 0.04) 100%
  );
  border-radius: var(--radius) var(--radius) 0 0;
  pointer-events: none;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-32px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Brand ─────────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.brand-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Título hero ───────────────────────────────────────────── */
.hero-title {
  position: relative;
  z-index: 1;
}

.hero-title h1 {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.15;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}

.title-icon {
  width: 26px;
  height: 26px;
  color: var(--red);
  flex-shrink: 0;
}

.hero-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.5;
}

/* ── Formulario ────────────────────────────────────────────── */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  z-index: 1;
}

/* ── Grupos de campos ──────────────────────────────────────── */
.field-group {
  display: flex;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-bottom-color: var(--border);
  border-right-color: var(--border);
  border-radius: var(--radius-sm);
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
  box-shadow:
    0 2px 8px rgba(26, 39, 68, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  /* IMPORTANTE: position relative para que el dropdown se ancle aquí */
  position: relative;
  /* overflow visible para que el dropdown no sea recortado */
  overflow: visible;
}

.field-group:focus-within {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.95);
  border-bottom-color: rgba(26, 39, 68, 0.3);
  box-shadow:
    0 0 0 3px rgba(26, 39, 68, 0.12),
    0 4px 12px rgba(26, 39, 68, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.field-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  border-right: 1px solid rgba(216, 224, 239, 0.7);
  height: 52px;
  align-self: flex-start;
}

.field-icon svg {
  width: 19px;
  height: 19px;
}

/* ════════════════════════════════════════════════════════════
   BUSCADOR ÁRBOL (Tree Search)
   ════════════════════════════════════════════════════════════ */
.tree-search-wrap {
  position: relative;
  flex: 1;
}

.tree-input {
  width: 100%;
  height: 52px;
  border: none;
  background: transparent;
  padding: 0 76px 0 14px;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
}

.tree-input::placeholder {
  color: var(--text-muted);
}

.tree-input-icon {
  position: absolute;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #9aadcc;
  display: flex;
  align-items: center;
}

.tree-input-icon svg {
  width: 16px;
  height: 16px;
}

.tree-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: #eef2fa;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tree-clear-btn:hover {
  background: #dfe7f8;
}

/* ── Dropdown árbol ────────────────────────────────────────── */
.tree-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d5dff0;
  border-top: 2.5px solid var(--navy);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-dropdown);
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1200;
  padding: 4px 0 10px;
  animation: dropIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.tree-dropdown[hidden] {
  display: none;
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* — Cabecera CORTE (seleccionable) ──────────────── */
.tree-corte-header {
  padding: 9px 14px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--red);
  background: #fdf4f4;
  border-bottom: 1px solid #f0d8d8;
  border-top: 1px solid #f0d8d8;
  margin-top: 2px;
  cursor: pointer;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.tree-corte-header:first-child {
  margin-top: 0;
  border-top: none;
}

.tree-corte-header:hover {
  background: #fae8e8;
}

/* Pin icon antes del nombre de la corte */
.tree-corte-header .item-label::before {
  content: "🏛️";
  font-size: 0.8em;
  margin-right: 5px;
  filter: grayscale(1);
  opacity: 0.6;
}

/* — Cabecera DISTRITO (seleccionable) ───────────── */
.tree-distrito-header {
  padding: 7px 14px 6px 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
  display: flex;
  align-items: center;
  gap: 0;
  user-select: none;
  position: relative;
}

.tree-distrito-header:hover,
.tree-distrito-header[aria-selected="true"] {
  background: #eef3ff;
  color: var(--navy);
}

/* Línea vertical de árbol */
.tree-distrito-header::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--navy);
  opacity: 0.4;
  flex-shrink: 0;
}

/* Items de sede (seleccionables) */
.tree-sede-item {
  padding: 9px 16px 9px 36px;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree-sede-item::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.tree-sede-item:hover,
.tree-sede-item[aria-selected="true"] {
  background: #eef3ff;
  color: var(--navy);
}

.tree-sede-item[aria-selected="true"] {
  background: #e5ecfb;
  font-weight: 600;
  color: var(--navy);
}

.tree-sede-item[aria-selected="true"]::before {
  background: var(--red);
}

/* Mensaje sin resultados */
.tree-no-results {
  padding: 20px 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

/* Scrollbar dropdown */
.tree-dropdown::-webkit-scrollbar {
  width: 6px;
}

.tree-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.tree-dropdown::-webkit-scrollbar-thumb {
  background: #c8d4e8;
  border-radius: 3px;
}

/* ── Select simple (especialidad) ─────────────────────────── */
.select-wrap {
  position: relative;
  flex: 1;
}

select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 52px;
  border: none;
  background: transparent;
  padding: 0 40px 0 14px;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  outline: none;
}

select option[value=""][disabled] {
  color: var(--text-muted);
}

.select-arrow {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #9aadcc;
  display: flex;
  align-items: center;
}

.select-arrow svg {
  width: 15px;
  height: 15px;
}

/* ── Botón BUSCAR ──────────────────────────────────────────── */
.btn-buscar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  background: #88201f;
  /*var(--navy);*/
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
  box-shadow:
    var(--shadow-btn),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  position: relative;
  z-index: 1;
  margin-top: 4px;
}

.btn-buscar svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-buscar:hover {
  background: var(--navy-dark);
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(26, 39, 68, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-buscar:active {
  transform: translateY(0);
}

.btn-buscar:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-buscar.loading .btn-label,
.btn-buscar.loading > svg {
  display: none;
}

.btn-buscar.loading .btn-spinner {
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Tarjeta resultado ─────────────────────────────────────── */
.result-card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-top-color: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-sm);
  padding: 20px;
  box-shadow: var(--shadow-result);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  z-index: 1;
  animation: fadeUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.result-card[hidden] {
  display: none;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.result-badge {
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: var(--red);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(136, 32, 31, 0.28);
}

.result-badge svg {
  width: 22px;
  height: 22px;
  color: #fff;
}

.result-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.result-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
}

.result-details {
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: var(--surface-muted);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
}

.result-item-label {
  color: var(--text-muted);
  font-weight: 500;
}

.result-item-val {
  font-weight: 600;
  color: var(--text);
}

/* ── Botón Ver Mapa ────────────────────────────────────────── */
.btn-ver-mapa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  background: var(--red);
  color: #fff;
  border-radius: var(--radius-xs);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition:
    background var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
  box-shadow: 0 4px 14px rgba(136, 32, 31, 0.3);
}

.btn-ver-mapa svg {
  width: 18px;
  height: 18px;
}

.btn-ver-mapa:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(136, 32, 31, 0.38);
}

/* ── Botón Nueva búsqueda ──────────────────────────────────── */
.btn-nueva-busqueda {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  padding: 2px;
  transition: color var(--transition);
}

.btn-nueva-busqueda:hover {
  color: var(--navy);
}

/* ── Hero visual ───────────────────────────────────────────── */
.hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 32px;
  animation: heroIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

@keyframes heroIn {
  from {
    opacity: 0;
    transform: scale(0.93) translateX(24px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateX(0);
  }
}

.hero-img {
  width: 100%;
  max-width: 620px;
  object-fit: contain;
  filter: drop-shadow(0 24px 48px rgba(26, 39, 68, 0.13));
  user-select: none;
  pointer-events: none;
}

/* ── Footer ─────────────────────────────────────────────────── */
.page-footer {
  text-align: center;
  padding: 12px 24px;
  font-size: 0.74rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(26, 39, 68, 0.07);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 32px 24px;
    gap: 40px;
    min-height: auto;
  }

  .hero-visual {
    padding-left: 0;
    order: -1;
  }

  .hero-img {
    max-width: 420px;
  }

  .search-panel {
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .search-panel {
    padding: 28px 22px;
  }

  .hero-title h1 {
    font-size: 1.55rem;
  }

  .hero-img {
    max-width: 300px;
  }
}

/* ── Shake para validación ──────────────────────────────────── */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-6px);
  }

  40% {
    transform: translateX(6px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(4px);
  }
}

/* ============================================================
   page-four / ubica-tu-sede.html
   ============================================================ */

body.locator-results-page {
  min-height: 100vh;
  background: transparent;
}

.locator-results-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(
      circle at top right,
      rgba(136, 32, 31, 0.09),
      transparent 28%
    ),
    radial-gradient(
      circle at top left,
      rgba(26, 39, 68, 0.08),
      transparent 24%
    ),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.94),
      rgba(247, 243, 237, 0.88)
    );
}

.locator-results-header,
.locator-results-shell {
  width: calc(100vw - 24px);
  margin: 0 auto;
}

.locator-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 50px 18px;
}

.locator-results-brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: #8d887d;
  text-decoration: none;
}

.locator-results-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.locator-results-brand-copy {
  display: flex;
  flex-direction: column;
  font-family: "Cormorant Garamond", serif;
  line-height: 1;
  text-align: center;
}

.locator-results-brand-copy strong,
.locator-results-brand-copy span {
  font-size: clamp(1.3rem, 2vw, 1.2rem);
  font-weight: 600;
}

.locator-results-heading {
  color: #8d887d;
  font-size: clamp(1.25rem, 2.3vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.locator-results-shell {
  padding-bottom: 16px;
}

.locator-toolbar-shell {
  padding: 10px 0 16px;
}

.locator-toolbar {
  display: grid;
  grid-template-columns: 410px 320px 190px;
  gap: 12px;
  align-items: center;
  justify-content: start;
  width: fit-content;
  max-width: 100%;
  padding-left: 2.5rem;
}

.locator-toolbar-group {
  min-width: 0;
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(26, 39, 68, 0.09);
  box-shadow: 0 10px 24px rgba(26, 39, 68, 0.06);
}

.locator-toolbar-group .field-icon,
.locator-toolbar-group .tree-input,
.locator-toolbar-group select {
  height: 48px;
}

.locator-toolbar-group .field-icon {
  padding: 0 12px;
}

.locator-toolbar-group .tree-input,
.locator-toolbar-group select {
  font-size: 0.84rem;
}

.locator-toolbar-group .tree-dropdown {
  top: calc(100% + 4px);
  z-index: 1400;
}

.locator-toolbar-button {
  width: 190px;
  min-height: 48px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #a82925, #8d221f);
  color: #fff;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 14px 28px rgba(136, 32, 31, 0.22);
  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.locator-toolbar-button svg {
  width: 16px;
  height: 16px;
}

.locator-toolbar-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(136, 32, 31, 0.28);
}

.locator-results-stage {
  display: flex;
  align-items: stretch;
  gap: 18px;
  min-height: calc(100vh - 146px);
}

.locator-results-sidebar {
  position: relative;
  width: 252px;
  flex: 0 0 252px;
  transition:
    width 0.26s ease,
    flex-basis 0.26s ease;
}

.locator-results-panel {
  height: 100%;
  padding: 14px 12px 12px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(26, 39, 68, 0.08);
  border-radius: 20px;
  box-shadow: 0 20px 34px rgba(26, 39, 68, 0.07);
  backdrop-filter: blur(18px);
  overflow: hidden;
  transition:
    opacity 0.24s ease,
    transform 0.24s ease;
}

.locator-results-toggle {
  position: absolute;
  top: 14px;
  right: -12px;
  z-index: 3;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(136, 32, 31, 0.16);
  border-radius: 8px;
  background: rgba(255, 248, 247, 0.98);
  color: var(--red);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 16px rgba(136, 32, 31, 0.08);
}

.locator-results-sidebar.is-collapsed {
  width: 18px;
  flex-basis: 18px;
}

.locator-results-sidebar.is-collapsed .locator-results-panel {
  opacity: 0;
  transform: translateX(-16px);
  pointer-events: none;
}

.locator-results-summary {
  display: grid;
  gap: 4px;
  padding: 4px 4px 10px;
}

.locator-results-title {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #9d978e;
}

.locator-results-summary p:last-child {
  font-size: 0.84rem;
  color: #585f72;
}

.locator-results-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 250px);
  padding: 3px 4px 3px 3px;
  overflow: auto;
}

.locator-results-list::-webkit-scrollbar {
  width: 6px;
}

.locator-results-list::-webkit-scrollbar-thumb {
  background: rgba(26, 39, 68, 0.16);
  border-radius: 999px;
}

.locator-result-card,
.locator-result-empty {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(26, 39, 68, 0.07);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 18px rgba(26, 39, 68, 0.04);
}

.locator-result-card {
  padding: 14px 14px 13px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 7px;
  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.locator-result-card:hover,
.locator-result-card.is-active {
  transform: translateY(-1px);
  border-color: rgba(136, 32, 31, 0.18);
  box-shadow: 0 16px 24px rgba(26, 39, 68, 0.08);
}

.locator-result-district {
  color: var(--red);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.locator-result-card strong {
  font-size: 1.05rem;
  line-height: 1.15;
  color: #3b3d45;
}

.locator-result-card p,
.locator-result-reference {
  color: #8d8c8a;
  font-size: 0.73rem;
  line-height: 1.45;
}

.locator-result-tags {
  color: var(--red);
  font-size: 0.74rem;
  font-weight: 700;
}

.locator-result-empty {
  padding: 20px;
  display: grid;
  gap: 8px;
  color: #63697a;
}

.locator-map-shell {
  position: relative;
  flex: 1;
  min-height: calc(100vh - 146px);
  /* overflow visible: el panel (#mapOverlay) debe poder posicionarse
     libremente sobre el marcador sin ser clippeado. Los tiles del mapa
     se clipean dentro de .locator-map-canvas (abajo). */
  overflow: visible;
  border-radius: 24px;
  border: 1px solid rgba(26, 39, 68, 0.08);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 26px 42px rgba(26, 39, 68, 0.08);
}

.locator-mobile-back {
  display: none;
}

.locator-map-canvas,
.locator-map-canvas .leaflet-container {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 146px);
  /* Clipea los tiles del mapa al radio del shell, sin afectar al panel */
  border-radius: 24px;
  overflow: hidden;
}

.locator-map-shell .leaflet-control-zoom {
  margin-top: 76px;
  margin-left: 14px;
  border: none;
  box-shadow: 0 12px 24px rgba(26, 39, 68, 0.12);
  z-index: 300;
}

.locator-map-shell .leaflet-control-zoom a {
  color: var(--navy);
}

.locator-map-detail {
  position: absolute;
  /* La posición inicial es reemplazada por JS al abrir el panel.
     Estos valores son el fallback de primer render. */
  top: 48px;
  left: 38px;
  z-index: 500;
  width: min(400px, calc(100% - 56px));
  padding: 18px 18px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 40px rgba(26, 39, 68, 0.14);
  border: 1px solid rgba(26, 39, 68, 0.08);
  display: flex;
  flex-direction: column;
  /* overflow DEBE ser visible para que el ::after (flecha) no sea recortado */
  overflow: visible;
  /* Transición suave mientras el panel sigue al marcador al panear */
  transition:
    opacity 0.24s ease,
    transform 0.24s ease;
  transform-origin: bottom center;
  --pointer-x: 50%;
}

/* Flecha ▼ apuntando HACIA ABAJO — truco CSS de triángulo con bordes */
.locator-map-detail::after {
  content: "";
  position: absolute;
  left: var(--pointer-x);
  bottom: -16px;
  top: auto;
  width: 0;
  height: 0;
  background: transparent;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 14px solid rgba(255, 255, 255, 0.96);
  border-bottom: none;
  transform: translateX(-50%);
  filter: drop-shadow(0 2px 1px rgba(26, 39, 68, 0.10));
  transition: left 0.08s linear, opacity 0.2s ease;
}

/* Flecha ▲ apuntando HACIA ARRIBA (panel debajo del marcador) */
.locator-map-detail.arrow-flipped::after {
  bottom: auto;
  top: -16px;
  border-top: none;
  border-bottom: 14px solid rgba(255, 255, 255, 0.96);
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  filter: drop-shadow(0 -2px 1px rgba(26, 39, 68, 0.10));
}

.locator-map-detail.is-hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

/* Durante pan/zoom: sin transición de posición para que el panel
   se mueva al mismo ritmo que los tiles y marcadores del mapa */
.locator-map-detail.is-moving {
  transition: none;
}

.locator-map-detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #616678;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.locator-map-detail-body {
  min-height: 0;
}

.locator-map-detail-head {
  display: grid;
  gap: 2px;
  padding-right: 26px;
  margin-bottom: 14px;
}

.locator-map-detail-head h1 {
  font-size: 1.5rem;
  line-height: 1;
  color: #5d5b59;
  font-weight: 700;
}

.locator-map-detail-head p {
  color: #9b988f;
  font-size: 0.95rem;
}

.locator-map-detail-group {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.locator-map-detail-group span {
  color: #9b988f;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.locator-map-detail-group p {
  color: #5c5d61;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.28;
}

.locator-map-detail-tags {
  margin: 4px 0 14px;
  color: var(--red);
  font-size: 1.02rem;
  font-weight: 800;
}

.locator-map-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.locator-action {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  gap: 8px;
  border: none;
  cursor: pointer;
}

.locator-action-maps {
  background: #30c462;
}

.locator-action-waze {
  background: #29b5f5;
}

.locator-action-image {
  background: #687ba6;
}

.locator-action:disabled,
.locator-action[aria-disabled="true"] {
  background: #c4cad8;
  color: rgba(255, 255, 255, 0.78);
  cursor: not-allowed;
  opacity: 0.8;
  box-shadow: none;
}

.locator-image-modal[hidden] {
  display: none;
}

.locator-image-modal {
  position: fixed;
  inset: 0;
  z-index: 1700;
}

.locator-image-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 32, 0.62);
}

.locator-image-dialog {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 32px));
  margin: 40px auto;
  padding: 22px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 32px 60px rgba(14, 22, 38, 0.32);
}

.locator-image-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #5e6474;
  font-size: 1.5rem;
  cursor: pointer;
}

.locator-image-title {
  margin-bottom: 10px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy);
}

.locator-image-view {
  width: 100%;
  max-height: calc(100vh - 220px);
  object-fit: cover;
  border-radius: 18px;
  background: #eef2f7;
}

.locator-image-caption {
  margin-top: 12px;
  color: #667089;
  font-size: 0.92rem;
}

.locator-image-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.locator-image-nav {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(26, 39, 68, 0.12);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.locator-map-fallback {
  height: 100%;
  min-height: 420px;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: #646c80;
}

.locator-marker-shell {
  background: transparent;
  border: none;
}

.locator-marker {
  position: relative;
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(26, 39, 68, 0.1);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98),
    rgba(245, 247, 251, 0.98)
  );
  box-shadow: 0 12px 20px rgba(26, 39, 68, 0.14);
}

.locator-marker::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("images/logo.png") center / 18px 18px no-repeat;
}

.locator-marker.is-active {
  box-shadow: 0 16px 26px rgba(136, 32, 31, 0.22);
  border-color: rgba(136, 32, 31, 0.3);
  transform: scale(1.05);
}

.locator-results-footer {
  margin-top: auto;
}

/* ── Loading & error states ─────────────────────────────────── */

.locator-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: #63697a;
  font-size: 0.95rem;
}

.locator-loading[hidden] {
  display: none;
}

.locator-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(26, 39, 68, 0.12);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: locator-spin 0.7s linear infinite;
}

@keyframes locator-spin {
  to {
    transform: rotate(360deg);
  }
}

.locator-error {
  padding: 12px 16px;
  margin: 0 12px 12px;
  background: #fef3cd;
  border: 1px solid #f0d78e;
  border-radius: 12px;
  color: #856404;
  font-size: 0.85rem;
}

@media (max-width: 1080px) {
  .locator-results-header {
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 12px;
  }

  .locator-toolbar {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    padding-left: 0;
  }

  .locator-toolbar-button {
    width: 100%;
  }

  .locator-results-stage {
    flex-direction: column;
  }

  .locator-results-sidebar,
  .locator-results-sidebar.is-collapsed {
    width: 100%;
    flex-basis: auto;
  }

  .locator-results-panel,
  .locator-results-sidebar.is-collapsed .locator-results-panel {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .locator-results-toggle {
    display: none;
  }

  .locator-map-shell,
  .locator-map-canvas,
  .locator-map-canvas .leaflet-container {
    min-height: calc(100vh - 220px);
  }

  .locator-mobile-back {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 14px);
    right: 14px;
    left: auto;
    z-index: 650;
    min-height: 42px;
    padding: 0 16px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--navy);
    font: inherit;
    font-weight: 700;
    box-shadow: 0 14px 26px rgba(26, 39, 68, 0.14);
    align-items: center;
    gap: 8px;
    cursor: pointer;
  }

  .locator-results-page.locator-mobile-map-mode .locator-results-header,
  .locator-results-page.locator-mobile-map-mode .locator-toolbar-shell,
  .locator-results-page.locator-mobile-map-mode .locator-results-sidebar,
  .locator-results-page.locator-mobile-map-mode .locator-results-footer {
    display: none;
  }

  .locator-results-page.locator-mobile-map-mode .locator-results-shell {
    width: 100vw;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  .locator-results-page.locator-mobile-map-mode .locator-results-stage {
    min-height: 100vh;
    gap: 0;
  }

  .locator-results-page.locator-mobile-map-mode .locator-map-shell,
  .locator-results-page.locator-mobile-map-mode .locator-map-canvas,
  .locator-results-page.locator-mobile-map-mode .locator-map-canvas .leaflet-container {
    min-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .locator-results-page.locator-mobile-map-mode .locator-mobile-back {
    display: inline-flex;
  }

  .locator-results-page.locator-mobile-guide-mode .locator-mobile-back {
    display: inline-flex;
    top: calc(env(safe-area-inset-top, 0px) + 22px);
    right: 14px;
    left: auto;
  }
}

@media (max-width: 720px) {
  .locator-results-header,
  .locator-results-shell {
    width: calc(100vw - 16px);
  }

  .locator-results-brand {
    gap: 12px;
  }

  .locator-results-logo {
    width: 48px;
    height: 48px;
  }

  .locator-map-detail {
    top: calc(env(safe-area-inset-top, 0px) + 84px);
    right: 12px;
    left: 12px;
    bottom: auto;
    width: auto;
    max-height: 68vh;
  }

  .locator-map-detail-body {
    overflow: auto;
    padding-right: 4px;
  }

  .locator-map-shell,
  .locator-map-canvas,
  .locator-map-canvas .leaflet-container {
    min-height: calc(100vh - 260px);
  }

  .locator-results-page.locator-mobile-map-mode .locator-map-detail {
    top: calc(env(safe-area-inset-top, 0px) + 84px);
    right: 12px;
    left: 12px;
    bottom: auto;
    width: auto;
    max-height: 68vh;
    min-height: 0;
    padding-top: 20px;
  }

  .locator-results-page.locator-mobile-map-mode .locator-map-detail-head {
    margin-top: 0;
  }

  .locator-results-page.locator-mobile-map-mode .locator-mobile-back {
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    right: 12px;
    left: auto;
  }

  .locator-results-page.locator-mobile-guide-mode .locator-mobile-back {
    top: calc(env(safe-area-inset-top, 0px) + 22px);
    right: 12px;
    left: auto;
  }

  .locator-map-shell .leaflet-top.leaflet-left {
    top: calc(env(safe-area-inset-top, 0px) + 54px);
    left: 0;
  }

  .locator-map-shell .leaflet-control-zoom {
    margin-top: 0;
    margin-left: 12px;
  }
}

.guide-tour {
  position: fixed;
  inset: 0;
  z-index: 2600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.guide-tour.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.guide-tour-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 22, 36, 0.58);
}

.guide-tour-focus {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  border-radius: 24px;
  box-shadow:
    0 0 0 9999px rgba(16, 22, 36, 0.58),
    0 0 0 2px rgba(255, 255, 255, 0.96),
    0 18px 34px rgba(16, 22, 36, 0.28);
  transition:
    left 0.24s ease,
    top 0.24s ease,
    width 0.24s ease,
    height 0.24s ease,
    border-radius 0.24s ease;
}

.guide-tour-card {
  position: absolute;
  z-index: 2;
  width: min(340px, calc(100vw - 24px));
  padding: 22px 20px 18px;
  border-radius: 24px;
  background: rgba(45, 37, 31, 0.96);
  box-shadow:
    0 26px 50px rgba(12, 17, 29, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: #fff8f2;
  transition:
    left 0.24s ease,
    top 0.24s ease;
  --guide-arrow-x: 50%;
  --guide-arrow-y: 50%;
}

.guide-tour-card::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  background: inherit;
  transform: rotate(45deg);
}

.guide-tour-card[data-placement="bottom"]::after {
  top: -8px;
  left: calc(var(--guide-arrow-x) - 11px);
}

.guide-tour-card[data-placement="top"]::after {
  bottom: -8px;
  left: calc(var(--guide-arrow-x) - 11px);
}

.guide-tour-card[data-placement="right"]::after {
  left: -8px;
  top: calc(var(--guide-arrow-y) - 11px);
}

.guide-tour-card[data-placement="left"]::after {
  right: -8px;
  top: calc(var(--guide-arrow-y) - 11px);
}

.guide-tour-card[data-placement="center"]::after {
  display: none;
}

.guide-tour-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 248, 242, 0.92);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.guide-tour-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 248, 242, 0.72);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.guide-tour-counter {
  margin-bottom: 10px;
  color: rgba(255, 248, 242, 0.58);
  font-size: 0.8rem;
  font-weight: 600;
}

.guide-tour-step-title {
  padding-right: 34px;
  margin-bottom: 10px;
  color: #fff8f2;
  font-size: 1.14rem;
  font-weight: 700;
  line-height: 1.2;
}

.guide-tour-step-text {
  color: rgba(255, 248, 242, 0.88);
  font-size: 0.98rem;
  line-height: 1.55;
}

.guide-tour-dots {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.guide-tour-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

.guide-tour-dot.is-active {
  background: #7e91ff;
  transform: scale(1.15);
}

.guide-tour-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}

.guide-tour-buttons {
  display: flex;
  gap: 10px;
}

.guide-tour-button,
.guide-tour-link {
  border: none;
  font: inherit;
  cursor: pointer;
}

.guide-tour-button {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 700;
}

.guide-tour-button-primary {
  background: #7e91ff;
  color: #fff;
  box-shadow: 0 14px 22px rgba(126, 145, 255, 0.28);
}

.guide-tour-button-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff8f2;
}

.guide-tour-link {
  padding: 0;
  background: transparent;
  color: #7e91ff;
  font-weight: 700;
}

@media (max-width: 720px) {
  .guide-tour-card {
    width: min(320px, calc(100vw - 20px));
    padding: 20px 18px 16px;
    border-radius: 22px;
  }

  .guide-tour-step-text {
    font-size: 0.96rem;
    line-height: 1.5;
  }

  .guide-tour-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .guide-tour-buttons {
    width: 100%;
  }

  .guide-tour-button {
    flex: 1;
  }

  .guide-tour-link {
    width: 100%;
    min-height: 36px;
  }
}


.leaflet-container a {
  color: #ffffff;
}
