:root {
    --color-bg: #C9EAD9;
    --color-bg-soft: #EAF7F1;
    --color-primary: #1E8C7A;
    --color-primary-dark: #146857;
    --color-accent: #C9A876;
    --color-blush: #F3C9D4;
    --color-blush-dark: #7A3B52;
    --color-text: #1A3B34;
    --color-white: #FFFFFF;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Montserrat', sans-serif;
    --sp-2: 0.5rem;
    --sp-3: 1rem;
    --sp-4: 1.5rem;
    --sp-6: 3rem;
    --shadow-card: 0 4px 14px rgba(26, 59, 52, 0.08);
    --shadow-soft: 0 10px 28px rgba(30, 140, 122, 0.16);
}

* { box-sizing: border-box; }

/* El atributo [hidden] pierde contra cualquier `display` de una regla de autor
   (gana por origen antes que por especificidad), y varios elementos de esta
   hoja (.catalog-grid, .cart-button, .cart-panel) fijan `display` sin condición
   — sin esto, un panel de categoría "oculto" seguía renderizando en grid. */
[hidden] {
    display: none !important;
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-white);
}

h1, h2, h3 { font-family: var(--font-heading); }

.hero {
    background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-soft) 100%);
    text-align: center;
    padding: var(--sp-6) var(--sp-3);
}

.hero-title {
    font-size: 2.75rem;
    color: var(--color-primary);
    margin: 0 0 var(--sp-3);
}

.hero-brand {
    display: inline-block;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--color-blush-dark);
    background: var(--color-blush);
    padding: 0.45rem 1.5rem;
    border-radius: 999px;
}

.hero-brand::before,
.hero-brand::after {
    content: '\2665';
    color: var(--color-accent);
    margin: 0 0.5rem;
    font-size: 0.7rem;
    vertical-align: middle;
}

.about, .catalog, .testimonials {
    max-width: 960px;
    margin: 0 auto;
    padding: var(--sp-6) var(--sp-3);
}

.about h2, .catalog h2, .testimonials h2 {
    text-align: center;
    color: var(--color-primary);
    margin: 0 0 var(--sp-4);
}

.about h2::after, .catalog h2::after, .testimonials h2::after {
    content: '';
    display: block;
    width: 48px;
    height: 3px;
    background: var(--color-accent);
    margin: var(--sp-2) auto 0;
    border-radius: 999px;
}

.about p {
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.7;
}

.catalog-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
}

.catalog-tab {
    font-family: var(--font-body);
    font-weight: 600;
    border: 2px solid var(--color-primary);
    background: var(--color-white);
    color: var(--color-primary);
    padding: var(--sp-2) var(--sp-4);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.catalog-tab:hover {
    transform: translateY(-1px);
}

.catalog-tab.is-active {
    background: var(--color-primary);
    color: var(--color-white);
}

.catalog-grid, .testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    justify-content: center;
    gap: 2rem;
}

.product-card, .testimonial-card {
    background: var(--color-white);
    border: 1px solid var(--color-bg);
    border-radius: 16px;
    padding: var(--sp-4) var(--sp-3);
    text-align: center;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover, .testimonial-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft);
}

.product-photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.product-name {
    margin: var(--sp-3) 0 0.25rem;
    font-size: 1.1rem;
}

.product-talla {
    margin: 0 0 0.25rem;
    font-size: 0.85rem;
    opacity: 0.75;
}

.product-price {
    color: var(--color-accent);
    font-weight: 700;
    font-size: 1.1rem;
}

.testimonial-photo {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 50%;
    margin: 0 auto var(--sp-2);
    display: block;
}

.testimonial-text {
    font-style: italic;
    line-height: 1.6;
}

.testimonial-name {
    display: block;
    margin-top: var(--sp-2);
    font-weight: 700;
    color: var(--color-primary);
}

.testimonial-name::before {
    content: '\2014 ';
}

.site-footer {
    background: var(--color-primary);
    color: var(--color-white);
    text-align: center;
    padding: var(--sp-4);
    display: flex;
    justify-content: center;
    gap: var(--sp-4);
}

.site-footer a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--color-white);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.site-footer a i {
    font-size: 1.1rem;
}

.site-footer a:hover {
    color: var(--color-blush);
}

.product-price-wholesale {
    display: block;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--color-text);
    margin-top: 0.15rem;
}

.product-add-to-cart {
    display: flex;
    gap: 0.5rem;
    margin-top: var(--sp-2);
    justify-content: center;
    align-items: center;
}

.product-qty {
    width: 56px;
    text-align: center;
    border: 1px solid var(--color-bg);
    border-radius: 8px;
    padding: 0.4rem;
}

.product-add-btn {
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    padding: var(--sp-2) var(--sp-3);
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.product-add-btn:hover {
    background: var(--color-primary-dark);
}

.cart-button {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    z-index: 100;
    border: none;
}

.cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-blush-dark);
    color: var(--color-white);
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* === CARRITO LATERAL === */

.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 44, 38, 0.45);
    z-index: 40;
}

body.cart-open {
    overflow: hidden;
}

.cart-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(400px, 100vw);
    background: #fff;
    box-shadow: -8px 0 30px rgba(26, 59, 52, 0.18);
    display: flex;
    flex-direction: column;
    z-index: 50;
    animation: cart-slide-in 0.22s ease;
}

@keyframes cart-slide-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.cart-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-4);
    border-bottom: 1px solid var(--color-bg);
}

.cart-panel-header h3 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--color-primary);
}

.cart-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-primary);
    padding: 0 0.25rem;
}

/* --- Lista de productos --- */

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-3) var(--sp-4);
}

.cart-empty {
    padding: 0 var(--sp-4) var(--sp-4);
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.6;
}

.cart-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--color-bg);
}

.cart-item-photo {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
}

.cart-item-photo-empty {
    display: block;
    background: var(--color-bg-soft, #eef5f2);
}

.cart-item-body {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    margin: 0;
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.3;
}

.cart-item-price {
    margin: 0.15rem 0 0.5rem;
    font-size: 0.8rem;
    opacity: 0.7;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.cart-qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--color-bg);
    background: #fff;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-primary);
}

.cart-qty-btn:hover {
    background: var(--color-bg-soft, #eef5f2);
}

.cart-item-qty {
    min-width: 2rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.cart-item-remove {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: var(--color-blush-dark, #7A3B52);
    cursor: pointer;
    border-radius: 8px;
}

.cart-item-remove:hover {
    background: var(--color-blush, #F3C9D4);
}

.cart-item-subtotal {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-accent);
    white-space: nowrap;
}

/* --- Pie: opciones, total y envío --- */

.cart-foot {
    border-top: 1px solid var(--color-bg);
    padding: var(--sp-4);
    background: #fff;
}

.cart-options {
    border: none;
    margin: 0 0 0.9rem;
    padding: 0;
}

.cart-options legend {
    padding: 0;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-primary);
    margin-bottom: 0.4rem;
}

.cart-option {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-right: 0.9rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.cart-option-info {
    margin: 0.5rem 0 0;
    padding: 0.5rem 0.65rem;
    background: var(--color-bg-soft, #eef5f2);
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.4;
}

.cart-direccion {
    display: block;
    margin-top: 0.6rem;
    font-size: 0.8rem;
}

.cart-direccion textarea {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--color-bg);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.88rem;
    resize: vertical;
}

.cart-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.6rem 0 0.9rem;
    font-size: 0.95rem;
}

.cart-total strong {
    font-size: 1.3rem;
    color: var(--color-accent);
}

.cart-whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    background: var(--color-primary);
    color: var(--color-white, #fff);
    border: none;
    border-radius: 999px;
    padding: var(--sp-3);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.cart-whatsapp-btn:hover {
    background: var(--color-primary-dark);
}

.cart-whatsapp-btn:disabled {
    background: #aaa;
    cursor: not-allowed;
}

.cart-error {
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #fdecea;
    color: #8a1c13;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
}

/* --- Aviso flotante: se ve aunque el carrito esté cerrado --- */

.cart-toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translate(-50%, 1rem);
    background: #2b2b2b;
    color: #fff;
    padding: 0.7rem 1.1rem;
    border-radius: 999px;
    font-size: 0.88rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 60;
    max-width: calc(100vw - 2rem);
    text-align: center;
}

.cart-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* --- Producto agotado --- */

.product-photo-wrap {
    position: relative;
}

.product-badge-agotado {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(43, 43, 43, 0.85);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
}

.product-card.is-agotado .product-photo {
    opacity: 0.55;
}

.product-add-btn:disabled {
    background: #bbb;
    cursor: not-allowed;
}

/* Con el panel abierto el botón flotante estorba: queda justo encima del
   botón de enviar el pedido. */
body.cart-open .cart-button {
    display: none;
}

/* === CÓDIGO Y OPCIONES DEL PRODUCTO (talla / color) === */

.product-codigo {
    margin: 0 0 0.25rem;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.55;
}

.product-opciones {
    margin-top: 0.6rem;
    text-align: left;
}

.product-opciones-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
    margin-bottom: 0.25rem;
}

.product-opciones-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.opcion-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid var(--color-bg);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.82rem;
    cursor: pointer;
    background: #fff;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.opcion-chip input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.opcion-chip:has(input:checked) {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    font-weight: 600;
}

.opcion-chip:has(input:focus-visible) {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.opcion-muestra {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

/* === DATOS DE TRANSFERENCIA EN EL CARRITO === */

.cart-dato {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0;
    padding: 0.2rem 0;
    font-size: 0.82rem;
}

.cart-dato + .cart-dato {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.cart-dato-label {
    font-weight: 600;
    opacity: 0.7;
    white-space: nowrap;
}

.cart-dato-valor {
    text-align: right;
    word-break: break-word;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 900px) {
    .catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 640px) {
    .hero {
        padding: 3rem 1rem;
    }

    .hero-title {
        font-size: 1.9rem;
        line-height: 1.2;
    }

    .about,
    .catalog,
    .testimonials {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .catalog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .product-card {
        padding: 0.6rem;
    }

    .product-name {
        font-size: 0.95rem;
    }

    .product-price {
        font-size: 0.95rem;
    }

    .product-price-wholesale {
        display: block;
        font-size: 0.72rem;
    }

    .product-add-to-cart {
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .product-qty {
        width: 3.2rem;
    }

    .product-add-btn {
        flex: 1;
        min-width: 0;
        font-size: 0.82rem;
        padding: 0.5rem 0.6rem;
    }

    .catalog-tabs {
        gap: 0.35rem;
    }

    .catalog-tab {
        font-size: 0.82rem;
        padding: 0.4rem 0.8rem;
    }

    /* El carrito ocupa toda la pantalla del teléfono, como una app. */
    .cart-panel {
        width: 100vw;
    }

    .cart-item-photo {
        width: 48px;
        height: 48px;
    }

    .testimonials-grid {
        grid-template-columns: 1fr;
    }

    .site-footer {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

@media (max-width: 380px) {
    .catalog-grid {
        grid-template-columns: 1fr;
    }
}

/* Respeta a quien pidió menos animación en el sistema. */
@media (prefers-reduced-motion: reduce) {
    .cart-panel {
        animation: none;
    }

    .cart-toast {
        transition: none;
    }
}
