/* ========================================
   HEADER — includes/header.php
   Figma: archivo "Web-INACOOP", node 1203-6755 (desktop), 1210-6853
   (mobile cerrado) y 1237-13 (mobile, buscador abierto).

   Ancho: 1160px de contenido, como el resto de las plantillas custom
   (el Figma dice 1240 con 24px de padding; se alinea con el contenido de
   las páginas). Los <button> llevan tres clases (o elemento + dos) por el
   reseteo de hello-biz, que pinta los botones rosados en hover/focus.
   ======================================== */

/* Fijo arriba, como el sticky del header de Elementor (que también lo
   hacía con position: fixed + un espaciador). No se usa position: sticky
   porque con un input adentro el navegador recalcula mal la posición del
   cursor y scrollea la página hacia arriba en cada tecla. El lugar que el
   header deja en el flujo lo ocupa .inacoop-header-espaciador.
   Con la barra de admin se corre su alto (WP define la variable); en
   ≤600px la barra no es fija, así que ahí va pegado arriba. El z-index
   alto es porque el panel del menú y el de búsqueda viven adentro de este
   contexto de apilamiento. */
.inacoop-header {
  position: fixed;
  top: var(--wp-admin--admin-bar--height, 0px);
  left: 0;
  right: 0;
  z-index: 1000;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
}

.inacoop-header-espaciador {
  height: calc(5.75rem + 1px);
}

@media (max-width: 600px) {
  .admin-bar .inacoop-header {
    top: 0;
  }
}

.inacoop-header .inacoop-header__inner {
  box-sizing: content-box;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 1160px;
  height: 5.75rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---- Logo ---- */

.inacoop-header .inacoop-header__logo {
  display: block;
  flex-shrink: 0;
  width: 16.793rem;
  margin-right: auto;
}

.inacoop-header .inacoop-header__logo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
}

/* ---- Buscador inline (desktop/tablet) ---- */

.inacoop-header .inacoop-header__buscador {
  position: relative;
  flex-shrink: 0;
  width: 13.75rem;
  margin: 0;
}

.inacoop-header .inacoop-header__buscador .inacoop-header__buscador-input {
  box-sizing: border-box;
  width: 100%;
  height: 2.75rem;
  margin: 0;
  padding: 0 2.5rem 0 1rem;
  border: 1px solid #401e5e;
  border-radius: 999px;
  background: #fff;
  font-family: Asap, sans-serif;
  font-weight: 400;
  font-size: 1rem;
  line-height: normal;
  color: #401e5e;
  box-shadow: none;
}

.inacoop-header .inacoop-header__buscador-input::placeholder {
  color: rgba(64, 30, 94, 0.6);
  opacity: 1;
}

.inacoop-header .inacoop-header__buscador .inacoop-header__buscador-input:focus {
  border-color: #401e5e;
  outline: none;
}

/* Saca la "x" nativa de los input type=search: se superpone a la lupa. */
.inacoop-header input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.inacoop-header .inacoop-header__buscador button.inacoop-header__buscador-submit {
  position: absolute;
  top: 0;
  right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.inacoop-header .inacoop-header__buscador-submit img {
  display: block;
  width: 1.125rem;
  height: 1.125rem;
  max-width: none;
  border-radius: 0;
}

/* ---- Botón lupa + panel (sólo mobile) ---- */

.inacoop-header .inacoop-header__inner button.inacoop-header__lupa {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 1px solid #401e5e;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.inacoop-header .inacoop-header__inner button.inacoop-header__lupa:hover,
.inacoop-header .inacoop-header__inner button.inacoop-header__lupa:focus,
.inacoop-header .inacoop-header__inner button.inacoop-header__lupa:active {
  background: transparent;
}

.inacoop-header .inacoop-header__inner button.inacoop-header__lupa:focus-visible,
.inacoop-header .inacoop-header__busqueda button.inacoop-header__busqueda-submit:focus-visible,
.inacoop-header .inacoop-header__buscador button.inacoop-header__buscador-submit:focus-visible {
  outline: 2px solid #0077a3;
  outline-offset: 2px;
}

/* Abierto: la lupa se vuelve la X sin borde (node 1237-41). */
.inacoop-header .inacoop-header__inner button.inacoop-header__lupa[aria-expanded="true"] {
  border-color: transparent;
  border-radius: 0.5rem;
}

.inacoop-header .inacoop-header__lupa-icon {
  display: block;
  max-width: none;
  border-radius: 0;
}

.inacoop-header .inacoop-header__lupa-icon--abrir {
  width: 1.25rem;
  height: 1.25rem;
}

.inacoop-header .inacoop-header__lupa-icon--cerrar {
  display: none;
  width: 2rem;
  height: 2rem;
}

.inacoop-header .inacoop-header__lupa[aria-expanded="true"] .inacoop-header__lupa-icon--abrir {
  display: none;
}

.inacoop-header .inacoop-header__lupa[aria-expanded="true"] .inacoop-header__lupa-icon--cerrar {
  display: block;
}

/* Panel de búsqueda (node 1237-44): flota sobre el contenido, debajo del
   header. El [hidden] lo pone/saca header.js. */
.inacoop-header .inacoop-header__busqueda {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  box-sizing: border-box;
  min-height: 8.5rem;
  padding: 1.125rem 1rem;
  background: #fff;
  border: 1px solid #e0dbe5;
  box-shadow: 0 3px 8px rgba(31, 13, 46, 0.1);
}

.inacoop-header .inacoop-header__busqueda[hidden] {
  display: none;
}

.inacoop-header .inacoop-header__busqueda-form {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin: 0;
}

.inacoop-header .inacoop-header__busqueda-titulo {
  margin: 0;
  font-family: Asap, sans-serif;
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.375rem;
  color: #38174f;
}

.inacoop-header .inacoop-header__busqueda-campo {
  display: flex;
  height: 3rem;
  border: 1.5px solid #38174f;
  border-radius: 1.5rem;
  background: #fff;
  overflow: hidden;
}

.inacoop-header .inacoop-header__busqueda-campo .inacoop-header__busqueda-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 0;
  background: #fff;
  font-family: Asap, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.5rem;
  color: #38174f;
  box-shadow: none;
}

.inacoop-header .inacoop-header__busqueda-campo .inacoop-header__busqueda-input:focus {
  outline: none;
}

.inacoop-header .inacoop-header__busqueda-input::placeholder {
  color: #615969;
  opacity: 1;
}

.inacoop-header .inacoop-header__busqueda-campo button.inacoop-header__busqueda-submit {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #f5f0f7;
  cursor: pointer;
}

.inacoop-header .inacoop-header__busqueda-campo button.inacoop-header__busqueda-submit:hover,
.inacoop-header .inacoop-header__busqueda-campo button.inacoop-header__busqueda-submit:focus {
  background: #ebe2f0;
}

.inacoop-header .inacoop-header__busqueda-submit img {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  max-width: none;
  border-radius: 0;
}

/* ========================================
   Mobile (node 1210-6853): 64px de alto, logo de 212px, el input se
   cambia por la lupa y el botón del menú queda sin texto.
   ======================================== */

@media (max-width: 767px) {
  .inacoop-header .inacoop-header__inner {
    height: 4rem;
    padding: 0 1rem;
  }

  .inacoop-header-espaciador {
    height: calc(4rem + 1px);
  }

  .inacoop-header .inacoop-header__logo {
    width: 13.291rem;
    flex-shrink: 1;
    min-width: 0;
  }

  .inacoop-header .inacoop-header__buscador {
    display: none;
  }

  .inacoop-header .inacoop-header__inner button.inacoop-header__lupa {
    display: flex;
  }

  .inacoop-header .inacoop-nav .inacoop-nav__trigger-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
}

/* El panel de búsqueda sólo existe en mobile: si se agranda la ventana
   con el panel abierto, no queda colgando. */
@media (min-width: 768px) {
  .inacoop-header .inacoop-header__busqueda {
    display: none;
  }
}
