/*
 * ============================================================
 * VALDIZARBE - HEADER CSS
 * ============================================================
 * CSS independiente para el header:
 * - variables y alturas estables
 * - topbar
 * - navegación
 * - acciones de cuenta/carrito
 * - buscador
 * - menú responsive
 * - fixes específicos de PrestaShop/theme
 * ============================================================
 */

:root {
  --vdz-primary: #006aa6;
  --vdz-primary-dark: #031847;
  --vdz-primary-soft: #eaf5fb;
  --vdz-accent: #009fe3;
  --vdz-white: #ffffff;
  --vdz-text: #121826;
  --vdz-muted: #667085;
  --vdz-border: #d9e2ec;
  --vdz-shadow: 0 10px 30px rgba(3, 24, 71, .12);
  --vdz-radius: 12px;

  /* Alturas estables: evitan recalcular layout por JS y reducen CLS. */
  --vdz-topbar-height: 35px;
  --vdz-main-height: 76px;
  --vdz-search-height: 58px;
  --vdz-header-compact-height: 111px;
  --vdz-header-full-height: 169px;
}

/* ==============================
   OFFSET GLOBAL PARA HEADER FIJO
============================== */

/* En páginas interiores el buscador siempre está visible. */
body {
  padding-top: var(--vdz-header-full-height);
}

/* Home: inicialmente sin buscador. */
body#index {
  padding-top: var(--vdz-header-compact-height);
}

/* Home: al hacer scroll o al existir parámetros AJAX se muestra buscador. */
body#index.vdz-has-searchbar,
body#index.vdz-is-scrolled {
  padding-top: var(--vdz-header-full-height);
}

/* ==============================
   HEADER VALDIZARBE
============================== */

.vdz-header,
.vdz-header * {
  box-sizing: border-box;
}

.vdz-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 9999;
  background: var(--vdz-white);
  box-shadow: 0 2px 10px rgba(3, 24, 71, .08);
  transition: box-shadow .2s ease;
  contain: layout style;
}

.vdz-header.is-scrolled,
.vdz-header.has-url-params {
  box-shadow: 0 8px 28px rgba(3, 24, 71, .16);
}

.vdz-container {
  width: min(100% - 32px, 1500px);
  margin-inline: auto;
}

/* ==============================
   TOPBAR
============================== */

.vdz-topbar {
  background: var(--vdz-primary-dark);
  color: var(--vdz-white);
  font-size: 12px;
  line-height: 1;
}

.vdz-topbar__inner {
  min-height: var(--vdz-topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.vdz-topbar__social {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vdz-topbar__social-link {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: var(--vdz-white);
  text-decoration: none;
  opacity: .9;
  transition: opacity .2s ease, transform .2s ease;
}

.vdz-topbar__social-link:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.vdz-topbar__info {
  font-weight: 600;
  white-space: nowrap;
}

/* ==============================
   MAIN HEADER
============================== */

.vdz-main {
  background: var(--vdz-white);
  border-bottom: 1px solid var(--vdz-border);
}

.vdz-main__inner {
  min-height: var(--vdz-main-height);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
}

.vdz-logo {
  display: flex;
  align-items: center;
  min-width: 160px;
}

.vdz-logo a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.vdz-logo__img {
  display: block;
  width: auto;
  max-width: 190px;
  max-height: 54px;
  object-fit: contain;
}

/* ==============================
   NAVEGACIÓN
============================== */

.vdz-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 12px;
}

.vdz-nav__list {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.vdz-nav__item {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
}

.vdz-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  color: var(--vdz-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 999px;
  transition: color .2s ease, background-color .2s ease;
}

.vdz-nav__link::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 7px;
  height: 2px;
  background: var(--vdz-accent);
  border-radius: 999px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .2s ease;
}

.vdz-nav__link:hover {
  color: var(--vdz-primary);
  background: var(--vdz-primary-soft);
  text-decoration: none;
}

.vdz-nav__link:hover::after {
  transform: scaleX(1);
}

@media (min-width: 1300px) {
  .vdz-main__inner {
    grid-template-columns: 210px minmax(0, 1fr) auto;
  }

  .vdz-nav {
    padding-left: 0;
  }
}

/* ==============================
   ACTIONS: CUENTA + CARRITO
============================== */

.vdz-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.vdz-action__link,
.vdz-cart {
  min-width: 42px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--vdz-primary-dark);
  background: var(--vdz-white);
  border: 1px solid var(--vdz-border);
  border-radius: 14px;
  text-decoration: none;
  transition: border-color .2s ease, background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.vdz-action__link {
  gap: 8px;
  padding: 0 14px;
}

.vdz-action__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--vdz-primary-dark);
}

.vdz-action__icon svg {
  display: block;
}

.vdz-action__text {
  max-width: 120px;
  color: var(--vdz-primary-dark);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vdz-action__link:hover,
.vdz-cart:hover {
  background: var(--vdz-primary-soft);
  border-color: rgba(0, 106, 166, .35);
  box-shadow: 0 8px 18px rgba(3, 24, 71, .08);
  transform: translateY(-1px);
  text-decoration: none;
}

.vdz-action__link.auton-login__btn,
.vdz-action__link.viana-account,
.vdz-action__link.pedros-account {
  color: var(--vdz-primary-dark);
}

.vdz-action__link .auton-login__text,
.vdz-action__link .viana-account__text,
.vdz-action__link .pedros-account__text {
  color: var(--vdz-primary-dark);
}

.vdz-cart {
  position: relative;
}

.vdz-cart a,
.vdz-cart button,
.vdz-cart .cart-preview,
.vdz-cart .blockcart,
.vdz-cart .seinto-cart,
.vdz-cart .shopping-cart {
  min-width: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--vdz-primary-dark);
  text-decoration: none;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.vdz-cart svg,
.vdz-cart i {
  color: var(--vdz-primary-dark);
}

.vdz-cart .cart-products-count,
.vdz-cart .cart-count,
.vdz-cart .ajax_cart_quantity {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--vdz-white);
  background: var(--vdz-accent);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

/* ==============================
   SEARCH BAR
============================== */

.vdz-searchbar {
  display: block;
  background: var(--vdz-primary);
  padding: 8px 0;
}

/* Home: totalmente colapsado hasta scroll/parámetros. Esto elimina la franja azul residual. */
.vdz-header--home:not(.is-scrolled):not(.has-url-params) .vdz-searchbar {
  height: 0;
  min-height: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  border: 0;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  background: transparent;
  pointer-events: none;
}

/* Home visible por scroll o parámetros AJAX. */
.vdz-header--home.is-scrolled .vdz-searchbar,
.vdz-header--home.has-url-params .vdz-searchbar {
  height: var(--vdz-search-height);
  min-height: var(--vdz-search-height);
  max-height: var(--vdz-search-height);
  padding-top: 8px;
  padding-bottom: 8px;
  opacity: 1;
  visibility: visible;
  overflow: visible;
  background: var(--vdz-primary);
  pointer-events: auto;
}

/* Interiores: siempre visible. */
.vdz-header:not(.vdz-header--home) .vdz-searchbar {
  height: var(--vdz-search-height);
  min-height: var(--vdz-search-height);
  max-height: var(--vdz-search-height);
  opacity: 1;
  visibility: visible;
  overflow: visible;
  pointer-events: auto;
}

.vdz-search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.vdz-search__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.vdz-search__input {
  width: 100%;
  height: 42px;
  padding: 0 54px 0 18px;
  color: var(--vdz-text);
  background: var(--vdz-white);
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  box-shadow: 0 6px 18px rgba(3, 24, 71, .12);
}

.vdz-search__input::placeholder {
  color: var(--vdz-muted);
}

.vdz-search__input:focus {
  border-color: var(--vdz-accent);
  box-shadow: 0 0 0 4px rgba(0, 159, 227, .18), 0 8px 22px rgba(3, 24, 71, .16);
}

.vdz-search__button {
  position: absolute;
  right: 4px;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  color: var(--vdz-primary-dark);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}

.vdz-search__button svg {
  display: block;
}

.vdz-search__button:hover {
  color: var(--vdz-white);
  background: var(--vdz-primary-dark);
}

/* ==============================
   MENU TOGGLE
============================== */

.vdz-menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  background: var(--vdz-white);
  border: 1px solid var(--vdz-border);
  border-radius: 999px;
  cursor: pointer;
}

.vdz-menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: var(--vdz-primary-dark);
  border-radius: 999px;
  transition: transform .2s ease, opacity .2s ease;
}

/* ==============================
   RESPONSIVE TABLET
============================== */

@media (max-width: 1200px) {
  .vdz-main__inner {
    gap: 18px;
  }

  .vdz-nav {
    padding-left: 0;
  }

  .vdz-nav__link {
    padding: 0 8px;
    font-size: 13px;
  }

  .vdz-logo__img {
    max-width: 170px;
  }
}

@media (max-width: 1100px) {
  .vdz-main__inner {
    grid-template-columns: auto auto 1fr;
    gap: 16px;
  }

  .vdz-logo {
    order: 1;
  }

  .vdz-menu-toggle {
    display: inline-block;
    order: 2;
  }

  .vdz-actions {
    order: 3;
  }

  /* Se ancla al borde inferior REAL del header.
     Así siempre queda debajo del buscador, esté visible u oculto. */
  .vdz-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    padding-left: 0;
    background: var(--vdz-white);
    border-bottom: 1px solid var(--vdz-border);
    box-shadow: var(--vdz-shadow);
    z-index: 20;
  }

  .vdz-header.is-menu-open .vdz-nav {
    display: block;
  }

  .vdz-nav__list {
    width: min(100% - 32px, 1500px);
    margin-inline: auto;
    padding: 14px 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .vdz-nav__link {
    width: 100%;
    min-height: 46px;
    justify-content: flex-start;
    padding: 0 14px;
    background: var(--vdz-primary-soft);
    border-radius: 10px;
    white-space: normal;
  }

  .vdz-nav__link::after {
    display: none;
  }

  .vdz-header.is-menu-open .vdz-menu-toggle span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .vdz-header.is-menu-open .vdz-menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  .vdz-header.is-menu-open .vdz-menu-toggle span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }
}

/* ==============================
   RESPONSIVE MOBILE
============================== */

@media (max-width: 767px) {
  :root {
    --vdz-topbar-height: 30px;
    --vdz-main-height: 68px;
    --vdz-search-height: 54px;
    --vdz-header-compact-height: 98px;
    --vdz-header-full-height: 152px;
  }

  body {
    padding-top: var(--vdz-header-full-height);
  }

  body#index {
    padding-top: var(--vdz-header-compact-height);
  }

  body#index.vdz-has-searchbar,
  body#index.vdz-is-scrolled {
    padding-top: var(--vdz-header-full-height);
  }

  .vdz-container {
    width: min(100% - 24px, 1500px);
  }

  .vdz-topbar__inner {
    min-height: var(--vdz-topbar-height);
  }

  .vdz-topbar__social {
    display: none;
  }

  .vdz-topbar__info {
    width: 100%;
    text-align: center;
    font-size: 11px;
    line-height: 1.2;
  }

  .vdz-main__inner {
    min-height: var(--vdz-main-height);
    grid-template-columns: auto 1fr auto;
    gap: 10px;
  }

  .vdz-logo {
    min-width: 0;
  }

  .vdz-logo__img {
    max-width: 150px;
    max-height: 48px;
  }

  .vdz-menu-toggle {
    order: 3;
  }

  .vdz-actions {
    order: 2;
    justify-self: end;
    gap: 8px;
  }

  .vdz-action__link {
    width: 42px;
    min-width: 42px;
    padding: 0;
  }

  .vdz-action__text {
    display: none;
  }

  .vdz-cart {
    width: 42px;
    min-width: 42px;
  }

  .vdz-nav__list {
    grid-template-columns: 1fr;
    padding: 12px 0;
    max-height: calc(100dvh - var(--vdz-header-compact-height));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .vdz-header.is-scrolled .vdz-nav__list,
  .vdz-header.has-url-params .vdz-nav__list,
  .vdz-header:not(.vdz-header--home) .vdz-nav__list {
    max-height: calc(100dvh - var(--vdz-header-full-height));
  }

  .vdz-searchbar,
  .vdz-header--home.is-scrolled .vdz-searchbar,
  .vdz-header--home.has-url-params .vdz-searchbar,
  .vdz-header:not(.vdz-header--home) .vdz-searchbar {
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .vdz-header--home:not(.is-scrolled):not(.has-url-params) .vdz-searchbar {
    padding-top: 0;
    padding-bottom: 0;
  }

  .vdz-search__input {
    height: 40px;
    padding-left: 16px;
    padding-right: 48px;
    font-size: 13px;
  }

  .vdz-search__button {
    width: 32px;
    height: 32px;
  }
}

/* ==============================
   EXTRA SMALL
============================== */

@media (max-width: 420px) {
  .vdz-logo__img {
    max-width: 128px;
  }

  .vdz-main__inner {
    gap: 8px;
  }

  .vdz-actions {
    gap: 6px;
  }

  .vdz-action__link,
  .vdz-cart,
  .vdz-menu-toggle {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
  }

  .vdz-cart a,
  .vdz-cart button,
  .vdz-cart .cart-preview,
  .vdz-cart .blockcart,
  .vdz-cart .seinto-cart,
  .vdz-cart .shopping-cart {
    min-width: 38px;
    min-height: 38px;
  }
}

/* ==============================
   FIXES PRESTASHOP / THEME
============================== */

.vdz-header a {
  text-decoration: none;
}

.vdz-header ul {
  list-style: none;
}

.vdz-header img {
  max-width: 100%;
  height: auto;
}

.vdz-header button,
.vdz-header input {
  font-family: inherit;
}

/* Reduce animaciones si el usuario lo solicita. */
@media (prefers-reduced-motion: reduce) {
  .vdz-header,
  .vdz-header *,
  .vdz-header *::before,
  .vdz-header *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}