/* ============================================
   TEMA: TIENDA POSTA
   Version: 2026.08.07-1
   Base: layout Bento Store (grid ecommerce) con paleta patagonica
   Colores: madera #3D2B1F, oliva #5C6B3A, oxido #C45C26, bordo #7A2E2E, arena #F3EDE4.
   Tipografia: Montserrat (400/500/600/700).
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

:root {
    --bg-color: #F3EDE4;
    --accent-color: #C45C26;
    --secondary-color: #5C6B3A;
    --text-color: #3D2B1F;
    /* Superficies claras (no blanco puro) — contraste AA con madera #3D2B1F */
    --card-bg: #FAF6F0;
    --surface-raised: #F7F1E8;
    --surface-muted: #EBE3D6;

    --color-bg-body: #F3EDE4;
    --color-bg-category: #FAF6F0;
    --color-bg-card: #FAF6F0;
    --color-bg-header: transparent;
    --color-bg-nav: #FAF6F0;

    --color-text-primary: #3D2B1F;
    --color-text-secondary: #6B5344;
    --color-text-description: #7A6558;

    --color-border-category: rgba(61, 43, 31, 0.14);
    --color-border-accent: #C45C26;

    --color-price: #3D2B1F;
    --color-price-old: #9A8578;
    --color-price-promo: #7A2E2E;

    --color-promo-badge: #7A2E2E;
    --color-promo-bg: linear-gradient(135deg, #FAF6F0 0%, #F0E8DC 100%);
    --color-featured-bg: linear-gradient(135deg, #3D2B1F 0%, #5C4033 100%);

    --color-btn-primary: #3D2B1F;
    --color-btn-text: #ffffff;

    --font-primary: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --border-radius-card: 14px;
    --border-radius-category: 16px;

    --shadow-card: 0 4px 18px rgba(61, 43, 31, 0.07);
    --shadow-category: 0 8px 28px rgba(61, 43, 31, 0.09);
}

body {
    background: var(--color-bg-body);
    color: var(--color-text-primary);
    font-family: var(--font-primary);
}

body.theme-tienda-posta {
    letter-spacing: 0.01em;
    font-weight: 400;
}

body.theme-tienda-posta .menu-header h1,
body.theme-tienda-posta .category-title,
body.theme-tienda-posta .product-name,
body.theme-tienda-posta .featured-product-name,
body.theme-tienda-posta .super-featured-name,
body.theme-tienda-posta .presale-title {
    font-family: var(--font-primary);
    font-weight: 600;
    letter-spacing: 0.02em;
}

body.theme-tienda-posta .product-description,
body.theme-tienda-posta .menu-header .subtitle {
    font-weight: 400;
    letter-spacing: 0.015em;
}

body.theme-tienda-posta .menu-header {
    text-align: center;
    padding: 16px 20px 8px;
}

body.theme-tienda-posta .menu-header h1,
body.theme-tienda-posta .category-title,
body.theme-tienda-posta .product-name,
body.theme-tienda-posta .featured-product-name,
body.theme-tienda-posta .super-featured-name {
    color: var(--color-text-primary);
}

body.theme-tienda-posta .menu-header h1 {
    margin: 0 0 4px;
}

body.theme-tienda-posta .menu-header .subtitle {
    margin: 0 0 14px;
    color: var(--color-text-secondary);
}

body.theme-tienda-posta .menu-header .lang-selector,
body.theme-tienda-posta .header-logo {
    display: flex;
    justify-content: center;
}

/* Caja superior (buscador + botonera): redondeada, crema clara */
body.theme-tienda-posta .nav-container {
    background: var(--color-bg-nav);
    border: 1px solid var(--color-border-category);
    border-radius: 18px;
    box-shadow: var(--shadow-category);
    margin: 8px 12px 20px;
    padding: 14px 16px 16px;
    overflow: hidden;
}

body.theme-tienda-posta .info-bar {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 12px;
    padding: 14px 18px;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    font-size: 1em;
    line-height: 1.45;
    color: #fff;
    background: var(--color-text-primary);
    box-shadow: 0 4px 14px rgba(61, 43, 31, 0.12);
}

body.theme-tienda-posta .info-bar b,
body.theme-tienda-posta .info-bar strong,
body.theme-tienda-posta .info-bar span {
    background: transparent !important;
}

body.theme-tienda-posta .category {
    background: var(--color-bg-category);
    border: 1px solid var(--color-border-category);
    border-radius: var(--border-radius-category);
    box-shadow: var(--shadow-category);
}

body.theme-tienda-posta .product-card,
body.theme-tienda-posta .featured-product-card,
body.theme-tienda-posta .super-featured-card {
    background: var(--color-bg-card);
    border: 1px solid rgba(61, 43, 31, 0.1);
    border-radius: var(--border-radius-card);
    box-shadow: var(--shadow-card);
}

body.theme-tienda-posta .menu-search-bar input,
body.theme-tienda-posta .menu-search-input {
    background: #FFFCF7;
    border-color: rgba(61, 43, 31, 0.16);
    color: var(--color-text-primary);
}

/* Botonera principal: mobile grid, desktop fila centrada */
body.theme-tienda-posta .categories-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 12px auto;
    width: 100%;
    justify-items: center;
}

@media (min-width: 769px) {
    body.theme-tienda-posta .categories-buttons {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 12px;
        margin: 18px auto 24px;
    }

    body.theme-tienda-posta .categories-buttons .category-button {
        flex: 0 1 auto;
    }

    body.theme-tienda-posta .subcategories-buttons {
        justify-content: center;
    }
}

body.theme-tienda-posta .category-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--surface-raised);
    color: var(--color-text-primary);
    border: 1px solid rgba(61, 43, 31, 0.16);
    border-radius: 999px;
    padding: 12px 18px;
    min-width: 96px;
    text-align: center;
}

body.theme-tienda-posta .category-button .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    width: 36px;
    height: 36px;
    line-height: 0;
}

body.theme-tienda-posta .category-button .btn-icon img {
    display: block;
    width: 32px;
    height: 32px;
    max-width: 32px;
    max-height: 32px;
    margin: 0 auto;
    object-fit: contain;
    object-position: center center;
}

body.theme-tienda-posta .category-button .btn-label {
    display: block;
    width: 100%;
    text-align: center;
    line-height: 1.2;
}

@media (min-width: 769px) {
    body.theme-tienda-posta .category-button {
        flex-direction: column;
    }
}

body.theme-tienda-posta .category-button.active,
body.theme-tienda-posta .category-button:hover {
    background: var(--color-text-primary);
    color: #fff;
    border-color: var(--color-text-primary);
}

body.theme-tienda-posta .category-button.active {
    box-shadow: 0 0 0 2px var(--accent-color);
}

/* Catálogo ecommerce: imagen grande + hover a 2ª foto */
body.theme-tienda-posta .product-card .product-image-wrap {
    display: block;
    float: none;
    width: 100%;
    height: 220px;
    margin: 0 0 12px;
    border-radius: 12px;
}

body.theme-tienda-posta .product-card .product-image-wrap .product-image {
    float: none !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    border-radius: 12px !important;
    object-fit: cover !important;
}

body.theme-tienda-posta .product-price,
body.theme-tienda-posta .featured-product-price,
body.theme-tienda-posta .multi-price-value {
    color: var(--color-price);
    font-weight: 700;
}

/* Precio alineado con el nombre (desktop + mobile) */
body.theme-tienda-posta .product-name-row,
body.theme-tienda-posta .super-featured-name-row,
body.theme-tienda-posta .featured-product-name-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

body.theme-tienda-posta .product-name-row .product-name,
body.theme-tienda-posta .product-name-row .product-name-link,
body.theme-tienda-posta .super-featured-name-row .super-featured-name,
body.theme-tienda-posta .featured-product-name-row .featured-product-name {
    flex: 1 1 auto;
    min-width: 0;
}

body.theme-tienda-posta .product-name-row .price-container,
body.theme-tienda-posta .super-featured-name-row .price-container,
body.theme-tienda-posta .featured-product-name-row .price-container {
    margin-top: 0;
    margin-left: auto;
    flex: 0 0 auto;
    align-items: baseline;
    gap: 8px;
}

body.theme-tienda-posta .product-name-row .product-price,
body.theme-tienda-posta .super-featured-name-row .product-price {
    line-height: 1.2;
    white-space: nowrap;
}

/* Multiprecios: fila propia y opciones envolventes dentro de la tarjeta */
body.theme-tienda-posta .product-name-row:has(.multi-price),
body.theme-tienda-posta .super-featured-name-row:has(.multi-price),
body.theme-tienda-posta .featured-product-name-row:has(.multi-price) {
    flex-wrap: wrap;
}

body.theme-tienda-posta .price-container:has(.multi-price) {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
    white-space: normal;
    overflow: hidden;
}

body.theme-tienda-posta .multi-price {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

body.theme-tienda-posta .multi-price > span {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

body.theme-tienda-posta .multi-price-separator {
    display: none;
}

body.theme-tienda-posta .promo-price,
body.theme-tienda-posta .product-price.promo-price {
    color: var(--color-price-promo);
}

body.theme-tienda-posta .low-stock-badge {
    background: var(--accent-color);
    color: #fff;
    font-weight: 700;
}

body.theme-tienda-posta .out-of-stock-badge {
    background: #3D2B1F;
    color: #fff;
}

body.theme-tienda-posta .coming-soon-badge {
    background: var(--secondary-color);
    color: #fff;
}

body.theme-tienda-posta .presale-badge {
    background: var(--secondary-color);
    color: #fff;
}

body.theme-tienda-posta .presale-section {
    background: var(--color-bg-category);
    border: 1px solid var(--color-border-category);
    border-radius: var(--border-radius-category);
    box-shadow: var(--shadow-category);
}

body.theme-tienda-posta .presale-title {
    color: var(--color-text-primary);
    border-bottom-color: var(--accent-color);
}

body.theme-tienda-posta .product-card.presale-card {
    border-color: rgba(196, 92, 38, 0.65);
}

body.theme-tienda-posta .catalog-footer-social-link {
    background: var(--color-text-primary);
    color: #fff;
}

body.theme-tienda-posta .catalog-footer-address i {
    color: var(--secondary-color);
}

body.theme-tienda-posta .cart-add-btn {
    background: var(--accent-color);
    color: #fff;
    border: none;
}

body.theme-tienda-posta .favorite-btn.is-active,
body.theme-tienda-posta .favorite-btn:hover {
    color: #C45C26;
    background: #3D2B1F;
}

body.theme-tienda-posta .floating-btn.favorites-float-btn {
    background: #3D2B1F;
    color: #C45C26;
}

body.theme-tienda-posta .cart-add-btn:hover {
    background: #A84E20;
}

body.theme-tienda-posta .product-page-cta,
body.theme-tienda-posta .product-name-link:hover {
    color: var(--secondary-color);
}

body.theme-tienda-posta .product-page-cta {
    background: var(--color-text-primary);
    color: #fff;
}

body.theme-tienda-posta .product-page-cta:hover {
    background: #5C4033;
}

body.theme-tienda-posta .nav-hamburger-btn {
    background: var(--color-text-primary);
    color: #fff;
}

body.theme-tienda-posta .nav-drawer-link.active {
    background: rgba(196, 92, 38, 0.35);
    color: var(--color-text-primary);
}

body.theme-tienda-posta .featured-products-title,
body.theme-tienda-posta a {
    color: var(--secondary-color);
}

body.theme-tienda-posta .category-title {
    border-bottom: 4px solid var(--accent-color);
    font-size: clamp(1.35em, 2.2vw, 1.85em);
    margin-bottom: 14px;
    padding-bottom: 10px;
    text-align: center;
}

/* Evitar doble línea por h2 anidado (renderCategoryTitle + wrapper) */
body.theme-tienda-posta h2.category-title > .category-title,
body.theme-tienda-posta h2.category-title > .dual-title {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
    font-size: inherit;
    color: inherit;
    text-align: center;
}

@media (max-width: 768px) {
    body.theme-tienda-posta .category-title {
        font-size: 1.1em;
        margin-bottom: 10px;
        padding-bottom: 6px;
        line-height: 1.25;
        text-align: center;
    }

    body.theme-tienda-posta .menu-header h1 {
        font-size: 1.35em;
        line-height: 1.15;
    }

    body.theme-tienda-posta .categories-buttons .category-button {
        width: 100%;
        min-height: 64px;
        padding: 8px 6px;
        font-size: 0.82em;
        gap: 4px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    body.theme-tienda-posta .categories-buttons .btn-label {
        font-size: 0.78em;
        line-height: 1.2;
        font-weight: 700;
        text-align: center;
        width: 100%;
    }

    body.theme-tienda-posta .categories-buttons .btn-icon {
        width: 28px;
        height: 28px;
        font-size: 1em;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body.theme-tienda-posta .categories-buttons .btn-icon img {
        display: block;
        max-width: 28px;
        max-height: 28px;
        width: 28px;
        height: 28px;
        margin: 0 auto;
        object-fit: contain;
        object-position: center center;
    }
}

/* ============================================================
   Mobile bento grid (2 columnas en fila; ritmo de imagen asimétrico)
   Nota: CSS columns llena de arriba a abajo → se veía 1 columna
   a la izquierda con pocos ítems. Grid coloca lado a lado.
   ============================================================ */
@media (max-width: 768px) {
    body.theme-tienda-posta .category {
        padding: 14px 10px 16px;
        margin-left: 8px;
        margin-right: 8px;
    }

    body.theme-tienda-posta .presale-section {
        margin-left: 8px;
        margin-right: 8px;
        padding: 14px 10px 12px;
    }

    body.theme-tienda-posta .products-grid,
    body.theme-tienda-posta .presale-section .products-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100%;
        align-items: start;
    }

    body.theme-tienda-posta .products-grid > .product-card,
    body.theme-tienda-posta .presale-section .products-grid > .product-card {
        display: block;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 8px;
        box-sizing: border-box;
        overflow: hidden;
        min-width: 0;
    }

    /* Un solo producto en la grilla: ancho completo */
    body.theme-tienda-posta .products-grid > .product-card:only-child,
    body.theme-tienda-posta .presale-section .products-grid > .product-card:only-child {
        grid-column: 1 / -1;
    }

    /* Super destacado: ancho completo */
    body.theme-tienda-posta .products-grid > .super-featured-card--in-grid {
        display: block;
        width: 100%;
        max-width: 100%;
        margin: 0;
        grid-column: 1 / -1;
        overflow: hidden;
        min-width: 0;
    }

    /* Tras un super-destacado, un solo producto restante no queda a media columna */
    body.theme-tienda-posta .products-grid > .super-featured-card--in-grid + .product-card:last-child {
        grid-column: 1 / -1;
    }

    body.theme-tienda-posta .product-card .product-image-wrap {
        height: 150px;
        margin-bottom: 8px;
        border-radius: 10px;
    }

    /* Ritmo bento: alturas de imagen alternadas */
    body.theme-tienda-posta .products-grid > .product-card:nth-child(6n+1) .product-image-wrap,
    body.theme-tienda-posta .presale-section .products-grid > .product-card:nth-child(6n+1) .product-image-wrap {
        height: 168px;
    }
    body.theme-tienda-posta .products-grid > .product-card:nth-child(6n+2) .product-image-wrap,
    body.theme-tienda-posta .presale-section .products-grid > .product-card:nth-child(6n+2) .product-image-wrap {
        height: 210px;
    }
    body.theme-tienda-posta .products-grid > .product-card:nth-child(6n+3) .product-image-wrap,
    body.theme-tienda-posta .presale-section .products-grid > .product-card:nth-child(6n+3) .product-image-wrap {
        height: 132px;
    }
    body.theme-tienda-posta .products-grid > .product-card:nth-child(6n+4) .product-image-wrap,
    body.theme-tienda-posta .presale-section .products-grid > .product-card:nth-child(6n+4) .product-image-wrap {
        height: 188px;
    }
    body.theme-tienda-posta .products-grid > .product-card:nth-child(6n+5) .product-image-wrap,
    body.theme-tienda-posta .presale-section .products-grid > .product-card:nth-child(6n+5) .product-image-wrap {
        height: 240px;
    }
    body.theme-tienda-posta .products-grid > .product-card:nth-child(6n+6) .product-image-wrap,
    body.theme-tienda-posta .presale-section .products-grid > .product-card:nth-child(6n+6) .product-image-wrap {
        height: 148px;
    }

    /* Categoría con un solo producto: formato más alto para mostrarlo completo */
    body.theme-tienda-posta .products-grid > .product-card:only-child .product-image-wrap,
    body.theme-tienda-posta .presale-section .products-grid > .product-card:only-child .product-image-wrap {
        height: clamp(280px, 72vw, 380px);
    }

    body.theme-tienda-posta .product-card .product-image-wrap .product-image {
        border-radius: 10px !important;
    }

    body.theme-tienda-posta .product-name-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        min-width: 0;
        max-width: 100%;
    }

    body.theme-tienda-posta .product-name-row .product-name,
    body.theme-tienda-posta .product-name-row .product-name-link {
        font-size: 0.88em;
        line-height: 1.25;
        margin-bottom: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    body.theme-tienda-posta .product-name-row .price-container {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: 1 1 auto;
        flex-wrap: wrap;
        align-items: flex-start;
        white-space: normal;
        overflow: hidden;
    }

    body.theme-tienda-posta .product-name-row .product-price {
        font-size: 0.92em;
    }

    /* Multiprecio: permitir salto de línea (evita desborde) */
    body.theme-tienda-posta .product-name-row .product-price.multi-price,
    body.theme-tienda-posta .product-name-row .product-price {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        max-width: 100%;
        display: block;
        line-height: 1.35;
    }

    body.theme-tienda-posta .product-name-row .multi-price-label,
    body.theme-tienda-posta .product-name-row .multi-price-value,
    body.theme-tienda-posta .product-name-row .multi-price-separator {
        white-space: normal;
    }

    body.theme-tienda-posta .product-name-row .multi-price-label,
    body.theme-tienda-posta .product-name-row .multi-price-value {
        font-size: 0.86em;
    }

    body.theme-tienda-posta .product-description.product-description--excerpt {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        overflow: hidden;
        font-size: 0.74em;
        line-height: 1.35;
        margin-top: 4px;
        max-width: 100%;
    }

    body.theme-tienda-posta .product-card--cart .cart-add-btn {
        width: 30px;
        height: 30px;
        top: 6px;
        right: 6px;
        font-size: 12px;
    }

    body.theme-tienda-posta .presale-badge,
    body.theme-tienda-posta .coming-soon-badge,
    body.theme-tienda-posta .out-of-stock-badge,
    body.theme-tienda-posta .low-stock-badge {
        font-size: 0.72em;
        padding: 4px 8px;
        margin-top: 6px;
    }

    body.theme-tienda-posta .promotion-badge,
    body.theme-tienda-posta .spotlight-badge {
        font-size: 0.7em;
    }

    body.theme-tienda-posta .price-without-vat {
        font-size: 0.68em;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}
