/* =========================================================
   07 BUSCADOR
   Overlay fullscreen, input, cierre, ripple, resultados,
   filtros, sugerencias, estados y responsive.
========================================================= */

/* =========================
   BOTONES BASE / ACCESIBILIDAD
========================= */

.menu-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  color: #ffffff;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;

  -webkit-tap-highlight-color: transparent;
}

body.a11y-highlight-links a {
  text-decoration: underline !important;
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

/* =========================
   OVERLAY FULLSCREEN
========================= */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100002;

  width: 100%;
  height: 100dvh;

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  background: transparent;

  transition:
    opacity .15s ease,
    visibility .15s ease;
}

.search-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.search-overlay-bg {
  position: fixed;
  inset: 0;
  z-index: 1;

  background: transparent;
  pointer-events: none;
}

.search-overlay-inner {
  position: relative;
  z-index: 20;

  min-height: 100dvh;
  padding: 0;
  margin: 0 auto;

  opacity: 0;
  transform: translateX(20px);

  transition:
    opacity .45s cubic-bezier(.22, 1, .36, 1),
    transform .45s cubic-bezier(.22, 1, .36, 1);
}

.search-overlay.is-open .search-overlay-inner {
  opacity: 1;
  transform: translateX(0);
  transition-delay: .28s;
}

/* =========================
   ESTADOS DEL BODY
========================= */

body.search-active {
  overflow: hidden;
}

body.search-closing .search-overlay-inner {
  opacity: 0;
  transform: translateX(10px);
  transition-delay: 0s;
  transition-duration: .08s;
}

body.search-closing .search-results,
body.search-closing .search-status,
body.search-closing #site-search-input,
body.search-closing .search-criteria {
  opacity: 0;
  transition: opacity .08s ease;
}

/* Oculta el hamburger durante la apertura del buscador. */
body.search-opening .hamburger-btn,
body.search-opening #mobileMenuBtn,
body.search-active:not(.search-closing) .hamburger-btn,
body.search-active:not(.search-closing) #mobileMenuBtn {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition:
    opacity .2s ease,
    visibility .2s ease;
}

/* =========================
   INPUT DE BUSQUEDA
========================= */

#site-search-input {
  width: 100%;
  padding: 0 0 22px;

  color: #ffffff;
  font-size: clamp(1rem, 6vw, 5.15rem);
  font-weight: 200;
  line-height: 1.1;
  letter-spacing: .2px;

  background: transparent;
  border: 0;
  outline: 0;

  -webkit-appearance: none;
  appearance: none;
}

#site-search-input::placeholder {
  color: #eeeeee;
  opacity: .9;
}

/* =========================
   BOTON CERRAR
========================= */

#search-close {
  position: fixed;
  top: 35px;
  right: 161px;
  z-index: 100004;

  width: 25px;
  height: 25px;
  padding: 0;
  margin: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  background: transparent;
  border: 0;
  outline: 0;

  transform: rotate(-90deg);

  transition:
    opacity .35s ease-in-out,
    visibility .35s ease-in-out,
    transform .35s ease-in-out,
    right .45s cubic-bezier(.16, 1, .3, 1);
}

.search-overlay.is-open #search-close {
  right: 108px;

  opacity: 1;
  visibility: visible;
  pointer-events: auto;

  transform: rotate(0deg);
}

body.search-closing .search-overlay.is-open #search-close,
body.search-closing #search-close {
  right: 161px;

  opacity: 1;
  visibility: visible;
  pointer-events: auto;

  transform: rotate(-90deg);
}

#search-close:hover {
  transform: rotate(90deg);
}

#search-close span {
  position: absolute;
  top: 50%;
  left: 50%;

  width: 25px;
  height: 2.5px;

  background: #ffffff;
  border-radius: 999px;
  pointer-events: none;
  transform-origin: center;
}

#search-close span:first-child {
  transform: translate(-50%, -50%) rotate(45deg);
}

#search-close span:last-child {
  transform: translate(-50%, -50%) rotate(-45deg);
}

body.nav-is-shrink #search-close,
body.nav-is-shrink .search-overlay.is-open #search-close {
  top: 24px;
}

/* Navbar normal */
#search-close {
  top: 35px;
}

/* Navbar reducido */
.navbar-shrink ~ .search-overlay #search-close,
body.nav-is-shrink #search-close {
  top: 24px;
}

/* =========================
   BOTON ABRIR + RIPPLE
========================= */

.search-open-btn i {
  transition:
    opacity .35s ease,
    transform .35s ease;
}

.search-open-btn .search-ripple {
  position: fixed;
  z-index: 100001;

  width: 60px;
  height: 60px;
  border-radius: 50%;

  opacity: 0;
  pointer-events: none;

  background: #000a14;
  transform: scale(0);
  transform-origin: center center;

  transition:
    transform .7s cubic-bezier(.4, 0, .2, 1),
    opacity .2s ease,
    filter .35s ease;
}

body.search-active .search-ripple {
  opacity: 1;
  filter: brightness(1.3) saturate(1.2);
  transform: scale(120);
}

body.search-closing .search-ripple {
  opacity: 1;
  filter: brightness(1) saturate(1);
  transform: scale(0);

  transition:
    transform .55s cubic-bezier(.4, 0, .2, 1),
    opacity .2s ease .45s;
}

body.search-active .search-open-btn i {
  opacity: 0;
  transform: scale(.7);
}

body.search-closing .search-open-btn i {
  opacity: 1;
  transform: scale(1);
}

/* =========================
   RESULTADOS
========================= */

.search-results {
  position: relative;
  z-index: 20;

  display: flex;
  flex-direction: column;
  gap: 34px;

  min-height: 140px;
  padding-bottom: 80px;

  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 8px, 0);

  transition:
    opacity .28s ease,
    transform .28s ease;

  will-change: opacity, transform;
}

.search-results.is-visible,
.search-results:not(:empty) {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
}

.search-result-item {
  display: block;
  text-decoration: none;

  opacity: 0;
  transform: translate3d(0, 8px, 0);
  animation: searchResultIn .35s ease both;
}

.search-result-section {
  display: block;
  margin-bottom: 8px;

  color: rgba(255, 255, 255, .9);
  font-size: .85rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.search-result-title {
  display: inline-block;
  margin-bottom: 10px;

  color: #84d0f5;
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-weight: 300;
  line-height: 1.15;
  text-decoration: none;

  opacity: 1;
  transition: opacity .3s ease-in-out;
}

.search-result-title:hover {
  opacity: .6;
}

.search-result-desc {
  max-width: 780px;
  margin: 0;

  color: rgba(255, 255, 255, .65);
  font-size: 1rem;
  line-height: 1.7;
}

.search-empty,
.search-helper,
.search-status {
  display: block;
  min-height: 28px;
  margin: 0 0 28px;

  color: rgba(255, 255, 255, .65);
  font-size: 1.1rem;
  line-height: 1.45;
}

/* =========================
   FILTROS / CRITERIOS
========================= */

.search-criteria {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: .5rem;

  margin: 1.2rem 0 1rem;
}

.search-criteria button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 5px 14px;
  border-radius: 999px;

  color: rgba(255, 255, 255, .45);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .01em;

  cursor: pointer;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .18);
  appearance: none;

  transition:
    background .25s ease,
    border-color .25s ease,
    color .25s ease,
    transform .25s ease,
    box-shadow .25s ease;
}

.search-criteria button:hover {
  color: #ffffff;
  border-color: rgba(125, 213, 255, .75);
}

.search-criteria button.active,
.search-criteria button.is-active {
  color: #ffffff;
  background: rgba(125, 213, 255, .18);
  border-color: #7dd5ff;

  box-shadow:
    0 0 0 3px rgba(125, 213, 255, .18),
    inset 0 0 0 1px rgba(255, 255, 255, .12);
}

/* =========================
   SUGERENCIAS
   Nota: se conserva display:none porque venia asi en tu CSS.
========================= */

.search-suggestion-terms {
  width: 100%;
  max-width: 100%;
  margin: 0;

  display: none;
  flex-direction: column;
  gap: 0;
}

.search-suggestion-terms button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;

  padding: .85rem 0;

  color: rgba(255, 255, 255, .58);
  font-size: 1rem;
  font-weight: 500;
  text-align: left;

  cursor: pointer;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  appearance: none;

  transition:
    color .25s ease,
    background .25s ease,
    padding-left .25s ease;
}

.search-suggestion-terms button::before {
  content: "⌕";
  flex: 0 0 auto;

  width: 22px;

  color: rgba(132, 208, 245, .55);
  font-size: 1.1rem;
  line-height: 1;
}

.search-suggestion-terms button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, .035);
  padding-left: .75rem;
}

.search-suggestion-terms button:last-child {
  border-bottom: 0;
}

/* =========================
   HIGHLIGHT EN PAGINA
========================= */

.search-page-highlight {
  padding: .1275em 0;

  color: rgb(37, 68, 104);
  background-color: var(--bs-highlight-bg);
  border-radius: 4px;

  animation: searchHighlightPulse 1.8s ease;
}

/* =========================
   ANIMACIONES
========================= */

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

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

@keyframes searchHighlightPulse {
  0% {
    background-color: rgba(132, 208, 245, .45);
  }

  100% {
    background-color: var(--bs-highlight-bg);
  }
}

/* =========================
   RESPONSIVE / TABLET Y MOVIL
========================= */

@media (max-width: 991px) {
  .search-overlay {
    padding-top: 6rem;
    background: #000a14;
  }

  .search-overlay-bg {
    opacity: 1;
    background:
      linear-gradient(rgba(0, 10, 20, .92), rgba(0, 10, 20, .96)),
      url("../assets/img/menu_bg.jpg") center / cover no-repeat;
  }

  #search-close,
  .search-overlay.is-open #search-close,
  body.search-closing .search-overlay.is-open #search-close,
  body.search-closing #search-close {
    top: 15px !important;
    right: 32px !important;
  }

  .search-overlay.is-open #search-close {
    transform: rotate(0deg);
  }

  body.search-closing .search-overlay.is-open #search-close,
  body.search-closing #search-close {
    transform: rotate(-90deg);
  }

  .search-open-btn {
    position: relative;
    flex: 0 0 32px;

    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    margin: 0 10px 0 0 !important;
    padding: 0 !important;

    display: inline-flex !important;
    align-items: center;
    justify-content: center;

    overflow: visible;
  }

  .search-open-btn i,
  .search-open-btn svg {
    position: relative;
    z-index: 2;
    pointer-events: none;
  }

  .search-open-btn .search-ripple {
    top: 40px;
    right: 78px;
    z-index: 1;

    width: 42px;
    height: 42px;
  }
}
