/* ================================================================
   WHATSAPP FLOTANTE
   ================================================================ */

.whatsapp-float {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1200;
    width: 54px;
    height: 54px;
    background: var(--color-wsp);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s;
}

.whatsapp-float:hover {
    transform: scale(1.1);
}

.whatsapp-icon {
    width: 28px;
    height: 28px;
}


/* ================================================================
   QUIÉNES SOMOS
   ================================================================ */

.quienes-somos {
    background: var(--color-secundario);
    border-top: 1px solid var(--color-gris-claro);
    padding: 2.2rem 1.5rem;
    margin-top: 2rem;
}

.qs-inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.qs-icon {
    font-size: 3.5rem;
    flex-shrink: 0;
    opacity: 0.65;
}

.qs-text h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--color-primario-legible, var(--color-primario));
    margin-bottom: 0.6rem;
    letter-spacing: 0.01em;
}

.qs-text p {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--color-gris-texto);
    line-height: 1.7;
    margin-bottom: 0.55rem;
}

.qs-btn {
    display: inline-block;
    margin-top: 0.5rem;
    background: var(--color-primario);
    color: var(--color-secundario);
    padding: 0.48rem 1.2rem;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.82rem;
    text-decoration: none;
    transition: background 0.18s, box-shadow 0.18s;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.qs-btn:hover {
    background: var(--color-primario-hover);
    box-shadow: 0 4px 12px rgba(27, 61, 46, 0.22);
}

@media (max-width: 500px) {
    .qs-inner {
        flex-direction: column;
        text-align: center;
        gap: 0.8rem;
    }
    .qs-icon {
        font-size: 2.5rem;
    }
}


/* ================================================================
   FOOTER
   ================================================================ */

footer {
    padding: 1.2rem 1rem;
    background: var(--color-primario-deep);
    color: rgba(196, 218, 180, 0.55);
    margin-top: 2rem;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}


/* ================================================================
   BOTÓN CONTACTO TIENDA
   ================================================================ */

.btn-contacto-tienda {
    text-align: center;
    margin: 0.8rem 0;
}

.btn-contacto-tienda button {
    background: var(--color-fondo-qty);
    color: var(--color-primario);
    border: 1.5px solid var(--color-gris-medio);
    border-radius: 8px;
    padding: 0.5rem 1.3rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.18s;
    font-weight: 500;
}

.btn-contacto-tienda button:hover {
    background: var(--color-primario);
    color: var(--color-secundario);
}


/* ================================================================
   STATUS DIV
   ================================================================ */

.status-div {
    margin: 2rem auto;
    text-align: center;
    padding: 1.5rem;
    border-radius: 12px;
    background: var(--color-fondo-qty);
    border-left: 5px solid var(--color-gris-medio);
    box-shadow: 0 4px 12px var(--color-status-sombra);
    max-width: 600px;
}

#status-div h3 {
    font-size: 1.3rem;
    color: var(--color-input-borde-error);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

#status-div p {
    margin: 0.5rem 0;
    color: var(--color-gris-oscuro);
    font-size: 0.95rem;
    line-height: 1.5;
}


/* ================================================================
   SPINNER CARGA
   ================================================================ */

.loading-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--color-gris-claro);
    border-top-color: var(--color-primario);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 5px;
    vertical-align: middle;
}

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


/* ================================================================
   MODAL DESCRIPCIÓN
   ================================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    /* 100vh en mobile incluye la barra del navegador: el modal quedaba más
       alto que el área visible y se cortaba abajo. dvh sigue al viewport real
       (la línea previa es el fallback). */
    height: 100vh;
    height: 100dvh;
    background: var(--color-modal-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 8000;
}

.modal-content {
    background: var(--color-secundario);
    border-radius: 14px;
    max-width: 580px;
    width: 95%;
    max-height: 82vh;
    overflow-y: auto;
    display: flex;
    flex-direction: row;
    gap: 1.4rem;
    padding: 1.8rem;
    position: relative;
    border: 1px solid var(--color-gris-claro);
}

.modal-img {
    width: 185px;
    height: 185px;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 10px;
    background: var(--color-fondo-claro);
    flex-shrink: 0;
    cursor: zoom-in;
}

.modal-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--color-primario);
    margin-bottom: 0.4rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.modal-desc {
    font-size: 0.88rem;
    font-weight: 400;
    color: var(--color-gris-texto);
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.modal-price {
    font-family: var(--font-body);
    font-size: 1.3rem;
    color: var(--color-primario);
    margin-bottom: 1rem;
    font-weight: 600;
}

.modal-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-controls .agregar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.35rem;
    min-width: 160px;
    color: var(--color-secundario);
    background: var(--color-primario);
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s, transform 0.12s;
    text-align: center;
    white-space: nowrap;
    margin: 0 auto;
    outline: none;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
}

.modal-controls .agregar-btn:hover,
.modal-controls .agregar-btn:focus-visible {
    background: var(--color-primario-hover);
    transform: translateY(-1px);
    color: var(--color-secundario);
}

/* El outline se apagaba también en :focus-visible, así que navegando con
   teclado no se veía dónde estaba el foco. Se deja el anillo global (base.css). */

.modal-controls.quantity-controls {
    background: transparent;
    border: none;
    padding: 0;
}

.modal-controls.quantity-controls button {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    border: 1px solid var(--color-gris-medio);
    background: var(--color-secundario);
    color: var(--color-primario);
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, transform 0.12s;
}

.modal-controls.quantity-controls button:hover {
    background: var(--color-primario);
    color: var(--color-secundario);
    transform: translateY(-1px);
}

.modal-controls.quantity-controls span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: var(--color-fondo-qty);
    color: var(--color-primario);
    font-weight: 700;
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--color-gris-medio);
    cursor: pointer;
    transition: color 0.12s;
}

.modal-close-btn:hover {
    color: var(--color-input-borde-error);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.93) translateY(22px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content-anim {
    animation: modalFadeIn 0.26s cubic-bezier(.4, 0, .2, 1);
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.93) translateY(22px);
    }
}

.modal-content-anim-close {
    animation: modalFadeOut 0.15s cubic-bezier(.4, 0, .2, 1) forwards;
}

@media (max-width: 600px) {
    .modal-content {
        flex-direction: column;
        gap: 0.8rem;
        padding: 1rem;
        max-width: 98vw;
    }
    .modal-img {
        width: 100%;
        max-width: 230px;
        height: auto;
        margin: 0 auto;
    }
}


/* ================================================================
   ZOOM DE IMAGEN
   ================================================================ */

.zoom-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-zoom-overlay);
    z-index: 15000;
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.zoom-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.zoom-clone {
    position: fixed;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    cursor: zoom-out;
    z-index: 15001;
    transition: top 0.3s ease, left 0.3s ease, width 0.3s ease, height 0.3s ease, border-radius 0.3s ease;
}

.zoom-close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 28px;
    color: var(--color-secundario);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    line-height: 38px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    z-index: 15002;
    background: var(--color-zoom-close-bg);
    transition: background 0.2s;
}

.zoom-close-btn:hover {
    background: var(--color-zoom-close-hover);
}

@media (max-width: 600px) {
    .header-inner {
        flex-wrap: wrap;
        /* Mismo eje lateral que el resto de las secciones. */
        padding: 0.5rem var(--padding-lateral) 0.45rem;
        row-gap: 0.4rem;
    }
    .header-search {
        order: 3;
        width: 100%;
        max-width: 100%;
        flex-basis: 100%;
        min-width: 0;
    }
    .header-logo {
        flex: 1;
    }
    .header-cart-btn {
        flex-shrink: 0;
    }
    .header-logo-text strong {
        font-size: 0.92rem;
    }
    .header-logo-text span {
        display: none;
    }
    #cart {
        width: 100vw;
        right: -100vw;
    }
    #cart.visible {
        right: 0;
    }
    .inputs-grid {
        grid-template-columns: 1fr;
    }
    .product-grid {
        grid-template-columns: 1fr 1fr;
    }
    /* Antes acá había `.product img { height: 125px }`. .prod-img-wrap ya
       define aspect-ratio 4/3 y la imagen es height:100%: forzar 125px la
       dejaba más baja que el wrapper y quedaba una franja gris (#f3f4f6) de
       ~10px abajo de cada foto en mobile. */
    .zoom-close-btn {
        top: 10px;
        right: 10px;
        font-size: 22px;
        width: 32px;
        height: 32px;
        line-height: 32px;
    }
    .zoom-clone {
        max-width: 95vw !important;
        max-height: 95vh !important;
    }
}


/* ================================================================
   MOBILE: TAMAÑO DE FUENTE EN INPUTS
   iOS Safari hace zoom automático al enfocar cualquier input con
   font-size < 16px. En el checkout eso deja la página zoomeada y
   desalineada, y el cliente tiene que hacer pinch para seguir. 16px
   exactos en mobile evitan el zoom sin cambiar nada en desktop.
   !important porque los originales usan selectores con id
   (#cart input[...], #cupon-input) que ganan por especificidad.
   ================================================================ */

@media (max-width: 768px) {
    #cart select,
    #cart input[type="text"],
    #cart input[type="email"],
    #cart input[type="tel"],
    #cart input[type="date"],
    #cupon-input,
    .header-search input,
    .cuenta-input,
    .sidebar-price-inputs input,
    .fn-form input,
    .toolbar-sort,
    .pd-review-input,
    .pd-restock-input {
        font-size: 16px !important;
    }
    /* El código OTP de mi-cuenta ya es más grande a propósito. */
    .cuenta-input-codigo {
        font-size: 1.2rem !important;
    }
}


/* ================================================================
   TOUCH: ÁREAS DE TOQUE MÍNIMAS
   Los +/- del carrito medían 22px y los de la tarjeta 28px: por
   debajo del mínimo usable con el dedo (~40px). Solo se agrandan en
   dispositivos sin hover, así que el desktop queda igual.
   ================================================================ */

@media (hover: none) {
    .quantity-controls button {
        width: 36px;
        height: 36px;
    }
    /* Los estilos de carrito "moderno" y "checkout" bajan estos botones a
       26/28px con selectores de id, que ganan por especificidad: hay que
       nombrarlos explícitamente. */
    .cart-item .quantity-controls button,
    #cart[data-estilo="moderno"] .cart-item .quantity-controls button,
    #cart[data-estilo="checkout"] .cart-item .quantity-controls button {
        width: 32px;
        height: 32px;
    }
    .remove-btn,
    #cart[data-estilo="moderno"] .remove-btn,
    #cart[data-estilo="checkout"] .remove-btn {
        width: 32px;
        height: 32px;
    }
    .close-cart {
        width: 38px;
        height: 38px;
    }
    .cerrar-banner {
        padding: 0.5rem;
        right: 8px;
    }
    /* Los links del nav y los toggles medían 29-30px de alto: se tocan mal con
       el dedo. 36px es el mínimo cómodo sin agrandar el nav de desktop.
       (También se aplica por ancho más abajo: hay teléfonos que reportan
       hover y ventanas angostas que igual se usan con el dedo.) */
    #category-buttons .nav-link-btn,
    #category-buttons .dropdown-btn,
    #category-buttons .quick-pill,
    .featured-toggle-btn,
    .volver-btn,
    .btn-cargar-mas {
        min-height: 44px;
    }
    /* Los botones flotantes de la tarjeta (favorito / vista rápida) se
       revelan con :hover — en touch no hay hover, quedaban inalcanzables. */
    .prod-hover-actions {
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
}


/* Mismo mínimo de toque por ancho de pantalla: `(hover: none)` no matchea en
   algunos dispositivos ni en una ventana angosta de escritorio. */
@media (max-width: 600px) {
    #category-buttons .nav-link-btn,
    #category-buttons .dropdown-btn,
    #category-buttons .quick-pill,
    .featured-toggle-btn,
    .volver-btn,
    .btn-cargar-mas,
    .pd-ab-back,
    .pd-ab-action-link,
    .pd-variante-pill,
    /* Medidos a 390px: el corazón de la tarjeta en 22px, los +/- del carrito
       en 26, quitar del carrito en 32, cerrar carrito en 38, el enlace de la
       dirección del pie en 34 y los del breadcrumb en 16. */
    .prod-fav-btn,
    .close-cart,
    .remove-btn,
    .qs-btn,
    .footer-dir-link,
    .pd-breadcrumb a,
    .quantity-controls button,
    /* Última pasada de medición: redes del pie en 20px, "sin stock" en 37,
       pasos del checkout en 43 y las flechas del hero de alimentos en 40. */
    .footer-red-link,
    .btn-sin-stock,
    .btn-step-next,
    .btn-step-prev,
    .al-hero-prev,
    .al-hero-next {
        min-height: 44px;
    }
    .prod-fav-btn,
    .close-cart,
    .remove-btn,
    .quantity-controls button,
    .al-hero-prev,
    .al-hero-next {
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    /* Enlaces de texto dentro de una línea: se les da alto de toque sin
       romper el flujo del párrafo. */
    .pd-breadcrumb a,
    .footer-dir-link {
        display: inline-flex;
        align-items: center;
    }
    /* Controles del carrito: los +/- y el botón de quitar medían 22px. */
    .cart-item .quantity-controls button,
    #cart[data-estilo="moderno"] .cart-item .quantity-controls button,
    #cart[data-estilo="checkout"] .cart-item .quantity-controls button,
    .remove-btn,
    #cart[data-estilo="moderno"] .remove-btn,
    #cart[data-estilo="checkout"] .remove-btn {
        width: 32px;
        height: 32px;
    }
    .quantity-controls button { width: 36px; height: 36px; }
    .close-cart { width: 38px; height: 38px; }
}
