/* =========================
   RESPONSIVE - TABLET
   ========================= */
@media (max-width: 1024px) {

  .header-search-wrap {
    max-width: min(560px, 42vw);
  }

  /* Contenido – grid Grogin en home/catálogo */
  .productos:not(#nuevos):not(#destacados):not(#prod-cat-destacados):not(#catalogo-grid) {
    flex-direction: column;
    align-items: center;
  }

  /* Cabecera más compacta */
  .top-bar {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }

  .top-bar h1 {
    font-size: 20px;
    margin: 0;
  }

  /*MENÚ: ocultar barra normal y mostrar hamburguesa */
  nav ul {
    display: none !important;
  }

  .hamburger {
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-right: 0;
    flex-shrink: 0;
  }

  nav {
    top: 0;
    box-shadow: none;
  }

  /* Footer: grid 4 cols en footer.css (no forzar columna aquí) */

  /* ========================================================
     🔥 SOLUCIÓN ALTURA HEADER (LOGIN COMPACTO) 🔥
     Forzamos a los inputs a ser de una sola línea y baja altura
     para que no estiren el header más que el texto de usuario.
     ======================================================== */
  
  /* Contenedor del formulario en línea */
  .search-login {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important; /* Obliga a no bajar de línea */
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Inputs (Cajas de texto) Ultra Compactos */
  .search-login input[type="text"],
  .search-login input[type="password"] {
    width: auto !important;
    flex: 1;                 /* Se reparten el espacio disponible */
    min-width: 70px;         /* Ancho mínimo usable */
    height: 28px !important; /* Altura reducida fija (antes era auto/32px) */
    padding: 0 5px !important;
    margin: 0 !important;
    font-size: 12px !important; /* Letra pequeña para que quepa */
    border: 1px solid #ccc !important;
    box-sizing: border-box;
  }

  /* Botón Ingresar Compacto */
  .search-login button {
    height: 28px !important; /* Misma altura que los inputs */
    padding: 0 10px !important;
    margin: 0 !important;
    font-size: 12px !important;
    line-height: 28px !important; /* Centrado vertical exacto */
    white-space: nowrap;
  }

  /* Ocultar enlace de registro para ahorrar espacio */
  .search-login a {
    display: none; 
  }
  
  /* Ajuste al contenedor padre (si existe en tu HTML) para quitar márgenes extra */
  #btn-login {
    margin-top: 4px !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
  }
}

/* =========================
   RESPONSIVE - CELULAR
   ========================= */
@media (max-width: 600px) {

  header.site-header {
    padding-top: var(--header-topbar-padding-top, 2px);
    padding-bottom: var(--header-topbar-padding-bottom, 2px);
  }

  .top-bar h1 {
    font-size: 18px;
    display: none !important; /* OCULTAR TÍTULO EN MÓVIL PEQUEÑO */
  }

  .header-search-input-wrap .search-results {
    width: calc(100% + 10px) !important;
    max-width: none !important;
    left: 0 !important;
    right: auto !important;
    transform: none !important;
    top: 100% !important;
    margin-top: 1px !important;
    box-sizing: border-box !important;
    font-size: 12px;
  }

  .producto {
    width: 90%;
  }

  footer {
    font-size: 12px;
  }

  .whatsapp img {
    width: 20px;
    height: 20px;
  }

  .mobile-drawer {
    width: 86vw;
  }

  .drawer-menu li a {
    font-size: 1.05rem;
    padding: 14px 18px;
  }
}

/* =========================
   900px - Contacto
   ========================= */
@media (max-width: 900px) {
  .contacto-contenedor {
    flex-direction: column;
    align-items: stretch;
  }

  .contact-mapa {
    margin-top: 25px;
    min-width: auto;
  }
}

/* 900px - Detalle producto layout */
@media (max-width: 900px) {
  .product-detail-layout {
    flex-direction: column;
  }

  .product-sidebar {
    width: 100%;
  }
}

/* 768px - Detalle producto card (ESTILO CUADRADO PERFECTO) */
@media (max-width: 768px) {

  /* 1. Contenedor Principal */
  .product-detail-card {
    display: flex;
    flex-direction: column;
    gap: 10px; 
    margin: 0;
    padding: 0;
  }

  /* 2. El Marco de la Foto (EL CUADRADO) */
  .product-detail-img-wrapper {
    width: 100% !important;       
    aspect-ratio: 1 / 1;          
    overflow: hidden;             
    position: relative;
    background: #ffffff;          
    margin: 0;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
  }

  /* 3. La Imagen */
  .product-detail-img-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain; 
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-origin: center center;
    will-change: transform; 
  }

  /* 4. Efecto ZOOM al mantener presionado */
  .product-detail-img-wrapper:active img {
    transform: scale(1.8); 
    cursor: zoom-in;
  }

  /* 5. Información del producto (Texto) */
  .product-detail-info {
    width: 100%;
    padding: 0 15px; 
    box-sizing: border-box;
  }
}

/* 768px - Registro */
@media (max-width: 768px) {
  .register-card {
    padding: 18px 15px 22px;
  }

  .register-form .form-grid {
    flex-direction: column;
  }
}

/* 600px - Grids */
@media (max-width: 600px) {

  #destacados,
  #nuevos,
  #similares-container {
    grid-template-columns: 1fr;
  }
}

/* ==========================
   MENÚ RESPONSIVE: ocultar nav desktop y usar drawer
   ========================== */
@media (max-width: 1024px) {
  nav ul {
    display: none !important;
  }

  .hamburger {
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .header-actions-logged {
    display: none !important;
  }

  #user-greeting {
    display: none !important;
  }

  .top-bar {
    align-items: center !important;
    justify-content: flex-start;
    text-align: left;
  }
}


/* =========================
   CELULAR: Nueva Distribución Header
   Orden: Logo -> Buscar -> Carrito -> Menú
   ========================= */
@media (max-width: 1024px) {

  header.site-header {
    padding: var(--header-topbar-padding-top, 2px) 1px var(--header-topbar-padding-bottom, 2px);
    width: 100%;
    box-sizing: border-box;
    overflow-x: clip;
  }

  .top-bar {
    display: grid !important;
    grid-template-columns: minmax(0, auto) 1fr auto auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 8px;
    row-gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .top-left {
    display: flex;
    align-items: center;
    gap: 10px;
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    min-width: 0;
  }

  header.site-header .top-bar:has(.header-weather) {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-rows: auto !important;
  }

  header.site-header .top-bar:has(.header-top-trailing):not(:has(.header-weather)) {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-rows: auto !important;
  }

  header.site-header .top-bar:has(.header-weather) .header-weather {
    display: none !important;
  }

  header.site-header .top-bar:has(.header-weather) .header-top-trailing,
  header.site-header .top-bar:has(.header-top-trailing):not(:has(.header-weather)) .header-top-trailing {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: auto;
    max-width: 100%;
    min-width: 0;
  }

  .header-top-trailing {
    grid-template-columns: auto;
    column-gap: 8px;
  }

  .header-top-trailing .header-top-social {
    display: none !important;
  }

  .top-bar:not(:has(.header-weather)):not(:has(.header-top-trailing)) .top-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    grid-column: 2 / 5;
    grid-row: 1;
    justify-self: end;
    min-width: 0;
  }

  .top-bar:has(.header-weather) .top-right,
  .top-bar:has(.header-top-trailing) .top-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
    min-width: 0;
  }

  .logo-link {
    display: flex;
    min-width: 0;
  }

  .logo-img {
    height: var(--header-logo-height, 48px);
    width: auto;
    max-width: min(38vw, var(--header-logo-max-width, 100px));
    object-fit: contain;
  }

  .header-search-wrap {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }

  .header-search-pill {
    min-height: 36px;
  }

  .header-search-input-wrap input#header-search {
    height: 32px;
    line-height: 32px;
  }

  .header-search-submit {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  .header-search-categoria {
    flex: 0 0 32%;
    width: 32%;
    max-width: 32%;
    min-width: 92px;
    font-size: 0.8rem;
  }

  .btn-cart-header-pill {
    padding: 3px 12px;
    min-height: 36px;
    min-width: calc(6rem + 8px);
    justify-content: center;
    gap: 24px;
    font-size: 0.8rem;
  }

  .btn-cart-header-pill .cart-header-icon {
    font-size: 1.2rem;
  }

  .btn-cart-header-pill .cart-header-total {
    min-width: 0;
    text-align: left;
  }

  #user-greeting:empty {
    display: none !important;
  }
}

/* =========================
   RESPONSIVE PREVIO PEDIDO (Móvil < 900px)
   ========================= */
@media (max-width: 900px) {
  .checkout-layout {
    flex-direction: column;
    gap: 20px;
  }

  .checkout-summary,
  .checkout-sidebar {
    width: 100%;
    position: static;
  }

  .checkout-sidebar {
    order: 2;
  }

  .cart-summary-box {
    overflow-x: auto;
  }
}

/* RESPONSIVE CONTACTO*/
@media (max-width: 900px) {
  .contacto-grid {
    grid-template-columns: 1fr;
  }
  .col-map {
    margin-top: 0;
  }
  #mapa-tiendas {
    min-height: 300px;
  }
  .form-row-responsive {
    flex-direction: column;
    gap: 0;
  }
}

/* --- Arreglo para DNI/Celular Responsive --- */
.form-row-responsive {
  display: flex;
  gap: 15px;
}

/* En celulares, cambiar la dirección a columna */
@media (max-width: 600px) {
  .form-row-responsive {
    flex-direction: column;
    gap: 0; 
  }
}

/* =========================================
   MEJORA CAPTCHA PARA CELULAR
   ========================================= */

@media (max-width: 600px) {
  
  .captcha-group .captcha-box {
    flex-wrap: wrap; 
  }

  .captcha-box img {
    flex: 1; 
  }

  .captcha-box input {
    flex: 1 1 100%;
    margin-top: 10px;
    height: 45px;
    font-size: 1.2rem;
    padding: 10px;
  }
}

@media (max-width: 1024px) {
  .btn-outline-header {
    display: none !important;
  }
}

/* =========================
   LOGIN RESPONSIVE (Móvil)
   ========================= */
@media (max-width: 768px) {
  body.page-auth {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--color-brand-gold, #B9984B) !important;
    background-color: var(--color-brand-gold, #B9984B) !important;
  }

  body.page-auth.site-public::before {
    display: none !important;
    content: none !important;
  }

  body.page-auth > header.site-header {
    flex-shrink: 0;
  }

  body.page-auth > footer {
    flex-shrink: 0;
    margin-top: 0 !important;
  }

  main.auth-page {
    overflow-x: hidden;
  }

  /* Solo alto del contenido: sin hueco dorado bajo los términos */
  main.auth-page.auth-page--split {
    flex: 0 0 auto;
    display: block;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0;
    background: var(--color-brand-gold, #B9984B) !important;
    background-color: var(--color-brand-gold, #B9984B) !important;
  }

  .incorporacion-wrapper,
  main.auth-page.auth-page--split .wrapper-datos {
    flex-direction: column !important;
    min-height: auto !important;
    width: 100%;
    background: var(--color-brand-gold, #B9984B);
  }

  .incorporacion-form-side,
  main.auth-page.auth-page--split .side-form {
    flex: 0 0 auto !important;
    width: 100% !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    padding: 26px 16px 12px !important;
    box-sizing: border-box !important;
  }

  .incorporacion-form-container,
  main.auth-page.auth-page--split .container-form {
    max-width: 100% !important;
    width: 100% !important;
    transform: none !important;
  }

  .incorporacion-visual,
  main.auth-page.auth-page--split .side-visual {
    display: none !important;
  }

  .btn-continue-custom {
    margin-bottom: 12px !important;
  }

  .login-footer-links {
    margin-top: 8px !important;
  }

  .login-legal-note {
    margin-top: 12px !important;
    margin-bottom: 0 !important;
  }

  /* Casillas iguales a escritorio (evita autofill azul del navegador) */
  .input-login-custom,
  main.auth-page .input-login-custom {
    background: rgba(255, 255, 255, 0.06) !important;
    background-color: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.19) !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff;
    caret-color: #fff;
    padding: 14px !important;
    min-height: 0 !important;
    height: auto !important;
    line-height: 1.35 !important;
    box-shadow: none !important;
  }

  .input-login-custom::placeholder {
    color: rgba(255, 255, 255, 0.55);
    opacity: 1;
  }

  .input-login-custom:-webkit-autofill,
  .input-login-custom:-webkit-autofill:hover,
  .input-login-custom:-webkit-autofill:focus,
  .input-login-custom:-webkit-autofill:active {
    -webkit-text-fill-color: #fff !important;
    caret-color: #fff;
    transition: background-color 99999s ease-out 0s;
    box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.06) inset !important;
    border: 1px solid rgba(255, 255, 255, 0.19) !important;
  }
}

/* =========================
   GROGIN – Hero & Home
   ========================= */
@media (max-width: 991px) {
  .home-hero__inner {
    padding: 0 12px;
  }
}

@media (max-width: 1200px) {
  .home-main .home-section #nuevos,
  .home-main .home-section #destacados,
  .home-main .home-section #prod-cat-destacados {
    --home-card-cols: 4;
  }
}

@media (max-width: 1024px) {
  .home-main .home-section .productos,
  .home-main .home-section #nuevos,
  .home-main .home-section #destacados,
  .home-main .home-section #prod-cat-destacados {
    --home-card-cols: 3;
  }

  .home-main .producto,
  .productos .producto {
    width: 100%;
    max-width: none;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-header__actions {
    width: 100%;
    justify-content: flex-end;
  }

  /* Portada celular: ocultar bloques de productos nuevos, por categoría y destacados */
  .home-main .home-section:has(#nuevos),
  .home-main .home-section:has(#prod-cat-destacados),
  .home-main .home-section:has(#destacados) {
    display: none !important;
  }

  /* Portada: botón Agregar solo con icono */
  .home-main .catalogo-add-cart-label {
    display: none;
  }

  .home-main .catalogo-add-cart-btn {
    gap: 0;
  }
}

@media (max-width: 576px) {
  .home-section {
    --home-section-x: 12px;
  }

  .home-main .home-section .productos,
  .home-main .home-section #nuevos,
  .home-main .home-section #destacados,
  .home-main .home-section #prod-cat-destacados,
  #catalogo-grid.productos {
    --home-card-cols: 2;
  }

  .section-header {
    padding-left: 0;
    padding-right: 0;
  }

  .home-section .section-title,
  body.site-public .module-section-title {
    font-size: 1.15rem;
  }

  .home-section .section-subtitle {
    font-size: 0.8rem;
  }

  .section-link-all {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .header-search-wrap {
    max-width: 100%;
    margin: 0;
    order: 3;
    width: 100%;
  }

  header .top-bar {
    flex-wrap: wrap;
  }
}