.custom-single-product {
    --green-dark: #1F4E3D;
    --green-light: #2A6A52;
    --yellow-acc: #F6C844;
    --gray-bg: #F8F8F8;
    --gray-text: #666;
    --border-color: #EAEAEA;
    font-family: inherit;
}

/* Product page header: oculto - el banner con logo no se muestra */
.custom-product-header {
    display: none;
}

/* Breadcrumb dentro del summary-column */
.summary-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--gray-text);
    margin-bottom: 14px;
}
.summary-breadcrumbs a {
    color: var(--gray-text);
    text-decoration: none;
}
.summary-breadcrumbs a:hover {
    color: var(--green-dark);
    text-decoration: underline;
}
.summary-breadcrumbs .sep {
    color: #bbb;
    margin: 0 1px;
}
.summary-breadcrumbs .current {
    font-weight: 600;
    color: var(--green-dark);
}

/* Layout */
.product-top-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    max-width: 1200px;
    margin: 0 auto;
}
@media(max-width: 900px){
    .product-top-details {
        grid-template-columns: 1fr;
    }
}

/* Base resets inside the custom layout to overwrite store-theme */
.product-top-details .summary-column h1 {
    font-size: 2rem;
    color: var(--green-dark);
    font-weight: 700;
    margin: 10px 0;
}
.cat-badge-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}
.cat-badge-wrap .category-name {
    color: var(--gray-text);
    font-size: 0.95rem;
}
.cat-badge-wrap .stock-badge {
    background: #E8F5E9;
    color: #4CAF50;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

/* Ratings */
.custom-rating {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.custom-rating .stars {
    font-size: 1.1rem;
    letter-spacing: 1px;
}
.custom-rating .star--full,
.custom-rating .star--half  { color: #FFC107; }
.custom-rating .star--half  { opacity: 0.6; }
.custom-rating .star--empty { color: #ddd; }
.custom-rating .review-count {
    color: var(--gray-text);
    font-size: 0.9rem;
}
.custom-rating .review-link {
    font-size: 0.85rem;
    color: var(--green-dark);
    text-decoration: underline;
}
.custom-rating .no-reviews {
    font-size: 0.85rem;
    font-style: italic;
}

/* Category name as link */
.cat-badge-wrap a.category-name {
    color: var(--gray-text);
    text-decoration: none;
}
.cat-badge-wrap a.category-name:hover {
    color: var(--green-dark);
    text-decoration: underline;
}

/* Price */
.custom-price-wrap {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}
.custom-price-wrap .current-price {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--green-dark);
}
.custom-price-wrap .old-price {
    font-size: 1.2rem;
    color: #A0A0A0;
    text-decoration: line-through;
}

.summary-column .product-excerpt {
    color: var(--gray-text);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

/* Variations */
.custom-variations {
    margin-bottom: 30px;
}
.variation-row {
    margin-bottom: 20px;
}
.variation-row .var-label {
    font-weight: 600;
    color: var(--green-dark);
    margin-bottom: 10px;
    display: block;
    font-size: 0.95rem;
}
.var-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}
.var-pills.colors-pills {
    gap: 10px;
}
.var-pill {
    padding: 8px 18px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--gray-text);
    cursor: pointer;
    transition: all 0.2s;
}
.var-pill.active {
    background: var(--yellow-acc);
    color: var(--green-dark);
    font-weight: 600;
    border-color: var(--yellow-acc);
}

.color-pill {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
}
.color-pill.active {
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--gray-text);
}

/* Add to cart row */
.custom-add-to-cart {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}
.custom-qty {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 5px 15px;
}
.custom-qty button {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--gray-text);
    cursor: pointer;
}
.custom-qty input {
    width: 40px;
    text-align: center;
    border: none;
    font-weight: 600;
    background: transparent;
}
.custom-qty input:focus { outline: none; }

.btn-add-cart {
    background: var(--green-dark);
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}
.btn-buy-now {
    background: var(--yellow-acc);
    color: var(--green-dark);
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}
.btn-wishlist {
    background: none;
    border: 1px solid var(--border-color);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gray-text);
    font-size: 1.1rem;
}

.custom-meta {
    font-size: 0.9rem;
    color: var(--gray-text);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.custom-meta span {
    font-weight: 600;
    color: var(--green-dark);
}
.custom-meta a {
    color: var(--gray-text);
    text-decoration: none;
}
.meta-socials {
    display: flex;
    align-items: center;
    gap: 10px;
}
.meta-socials .s-icon {
    width: 25px; height: 25px;
    background: var(--green-dark);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* Tabs */
.custom-tabs-container {
    max-width: 1200px;
    margin: 60px auto;
}
.custom-tabs-nav {
    display: flex;
    justify-content: center;
    gap: 40px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}
.custom-tabs-nav a {
    color: var(--gray-text);
    font-weight: 600;
    font-size: 1.1rem;
    padding-bottom: 15px;
    position: relative;
    cursor: pointer;
    text-decoration: none;
}
.custom-tabs-nav a.active {
    color: var(--green-dark);
}
.custom-tabs-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--green-dark);
}
.custom-tab-content {
    display: none;
    color: var(--gray-text);
    line-height: 1.8;
}
.custom-tab-content.active {
    display: block;
}

/* WooCommerce Overrides */
.woocommerce div.product.custom-single-product form.cart { box-shadow: none; border: none; padding: 0; display: block; }
.woocommerce div.product.custom-single-product .store-product-card-price { display: none; }

/* Override Woo Variations and Cart Add Form */
.woocommerce div.product.custom-single-product form.cart {
    display: flex;
    flex-direction: column;
    gap: 30px;
    background: transparent !important;
}

.woocommerce div.product.custom-single-product form.cart .variations {
    width: 100%;
}

.woocommerce div.product.custom-single-product form.cart .variations tr {
    display: block;
    margin-bottom: 20px;
}

.woocommerce div.product.custom-single-product form.cart .variations th {
    display: block;
    text-align: left;
    font-size: 0.95rem;
    color: var(--green-dark);
    font-weight: 600;
    margin-bottom: 10px;
    padding: 0 !important;
}

.woocommerce div.product.custom-single-product form.cart .woocommerce-variation-add-to-cart {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.woocommerce div.product.custom-single-product form.cart .quantity .qty {
    width: 60px;
    height: 48px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    text-align: center;
    font-weight: 600;
    padding: 0;
}

.woocommerce div.product.custom-single-product form.cart .single_add_to_cart_button {
    background: var(--green-dark) !important;
    color: white !important;
    border-radius: 25px !important;
    padding: 12px 30px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    border: none !important;
    transition: background 0.3s;
}

.woocommerce div.product.custom-single-product form.cart .single_add_to_cart_button:hover {
    background: var(--green-light) !important;
    transform: none !important;
}

.custom-buy-now-btn {
    background: var(--yellow-acc) !important;
    color: var(--green-dark) !important;
    border-radius: 25px !important;
    padding: 12px 30px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border: none !important;
    cursor: pointer;
    margin-left: 10px;
}

.woocommerce-tabs ul.tabs {
    display: flex !important;
    gap: 30px !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 0 !important;
    margin-bottom: 30px !important;
}

.woocommerce-tabs ul.tabs li {
    background: transparent !important;
    border: none !important;
    padding: 0 0 15px 0 !important;
    border-radius: 0 !important;
}

.woocommerce-tabs ul.tabs li::before, .woocommerce-tabs ul.tabs li::after { display: none !important; }

.woocommerce-tabs ul.tabs li a {
    color: var(--gray-text) !important;
    font-weight: 600 !important;
    font-size: 1.1rem !important;
    padding: 0 !important;
}

.woocommerce-tabs ul.tabs li.active a {
    color: var(--green-dark) !important;
}

.woocommerce-tabs ul.tabs li.active {
    border-bottom: 3px solid var(--green-dark) !important;
}

/* Fix: asegurar que la 'I' de 'Información adicional' no se corte */
.woocommerce-tabs ul.tabs li a {
    text-indent: 0 !important;
    padding-left: 0 !important;
    overflow: visible !important;
    clip: auto !important;
}

/* Estilos para la sección de Valoraciones (reviews) similar a Info adicional */
#tab-reviews .woocommerce-Reviews-title {
    display: block !important;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}
#tab-reviews .comment-form-rating label {
    font-weight: 600;
    color: var(--green-dark);
}
#tab-reviews .star-rating {
    color: #FFC107;
}
#tab-reviews #review_form .comment-form p label {
    font-weight: 600;
    color: var(--green-dark);
    font-size: 0.9rem;
}
#tab-reviews #review_form .comment-form input[type="text"],
#tab-reviews #review_form .comment-form input[type="email"],
#tab-reviews #review_form .comment-form textarea {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
}
#tab-reviews #review_form .comment-form input:focus,
#tab-reviews #review_form .comment-form textarea:focus {
    border-color: var(--green-dark);
}
#tab-reviews #review_form .form-submit #submit {
    background: var(--green-dark);
    color: #fff;
    border: none;
    border-radius: 25px;
    padding: 10px 28px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}
#tab-reviews #review_form .form-submit #submit:hover {
    background: var(--green-light);
}
#tab-reviews .comment-text {
    background: var(--gray-bg);
    border-radius: 12px;
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}
#tab-reviews .woocommerce-review__author {
    font-weight: 700;
    color: var(--green-dark);
}
#tab-reviews .woocommerce-review__dash,
#tab-reviews .woocommerce-review__published-date {
    font-size: 0.8rem;
    color: var(--gray-text);
}

.woocommerce-tabs .panel {
    color: var(--gray-text) !important;
    line-height: 1.8 !important;
}

/* Mejoras de estructura y visibilidad del formulario de valoraciones */
#tab-reviews #review_form_wrapper {
    margin-top: 24px;
}
#tab-reviews #review_form .comment-form p {
    margin-bottom: 20px;
}
#tab-reviews #review_form .comment-form input[type="text"],
#tab-reviews #review_form .comment-form input[type="email"],
#tab-reviews #review_form .comment-form textarea {
    background: #fff;
}
#tab-reviews #review_form .comment-form textarea {
    min-height: 120px;
    resize: vertical;
}
#tab-reviews .comment-form-rating {
    margin-bottom: 20px;
}
#tab-reviews .woocommerce-noreviews {
    font-style: italic;
    color: var(--gray-text);
    margin-bottom: 20px;
    display: block;
}
#tab-reviews .comment-form .stars {
    display: inline-flex;
    gap: 4px;
    font-size: 1.3rem;
    margin-top: 6px;
}

.woocommerce-tabs .panel h2 {
    display: none; /* Hide default tab heading */
}

/* Related Products Grid Overrides */
.product-related-section ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 30px !important;
}

.product-related-section ul.products li.product {
    width: 100% !important;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    position: relative;
    box-shadow: none !important;
}

.product-related-section li.product .onsale {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--green-dark);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
    height: auto;
    width: auto;
    line-height: 1;
}

.product-related-section li.product img {
    margin-bottom: 20px;
    border-radius: 12px;
    background: var(--gray-bg);
}

.product-related-section li.product .woocommerce-loop-product__title {
    color: var(--green-dark);
    font-size: 1.1rem !important;
    margin-bottom: 10px;
}

.product-related-section li.product .price {
    color: var(--green-dark) !important;
    font-weight: 700 !important;
}

@media(max-width: 1024px){
    .product-related-section ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media(max-width: 600px){
    .product-related-section ul.products {
        grid-template-columns: 1fr !important;
    }
}

/* Custom stable gallery */
.custom-gallery {
    display: grid;
    gap: 18px;
}

.custom-gallery__main {
    display: block;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 18px;
    box-shadow: 0 8px 24px rgba(72,0,25,.06);
    overflow: hidden;
}

.custom-gallery__main-image {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #fff8fc;
    border-radius: 22px;
}

.custom-gallery__thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-left: 0;
    margin: 0;
}

.custom-gallery__thumb {
    appearance: none;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 0;
    width: 78px;
    height: 78px;
    overflow: hidden;
    background: #fff;
    cursor: pointer;
    flex: 0 0 auto;
}

.custom-gallery__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.custom-gallery__thumb.is-active {
    border-color: var(--yellow-acc);
}

@media (max-width: 900px) {
    .custom-gallery__main {
        padding: 12px;
    }

    .custom-gallery__thumbs {
        justify-content: center;
    }
}

/* FlexSlider: no usar all:unset — respeta sus propiedades inline de layout */

/* FIX LAYOUT: Remove default grid from custom-single-product */
.woocommerce div.product.custom-single-product {
    display: block !important; /* Overrides the grid template minmax columns */
}


/* Ensure inner wraps take up available space in the correct grid */
.woocommerce div.product.custom-single-product div.images {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
}

.woocommerce div.product.custom-single-product div.summary {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
}

/* Mobile Adjustments */
@media (max-width: 900px) {
    .product-top-details {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
    .woocommerce div.product.custom-single-product .images-column {
        position: relative !important;
        top: 0 !important;
    }
}

/* Sticky gallery solo en desktop: envuelto en min-width para no sobreescribir
   el position:relative del bloque mobile que viene después en el archivo */
@media (min-width: 901px) {
    .woocommerce div.product.custom-single-product .images-column {
        position: sticky !important;
        top: 30px !important;
        align-self: start !important;
    }
}

/* Ensure Gallery Thumbs are visible */
.woocommerce div.product.custom-single-product div.images .flex-control-thumbs {
    display: flex !important;
    gap: 15px !important;
    margin-top: 15px !important;
    list-style: none !important;
    padding: 0 !important;
    justify-content: center;
}

.woocommerce div.product.custom-single-product div.images .flex-control-thumbs li {
    width: 80px !important;
    flex: 0 0 80px !important;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.woocommerce div.product.custom-single-product div.images .flex-control-thumbs li img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    aspect-ratio: 1/1;
    border-radius: 0;
    box-shadow: none;
}

.woocommerce div.product.custom-single-product div.images .flex-control-thumbs li:hover,
.woocommerce div.product.custom-single-product div.images .flex-control-thumbs li img.flex-active {
    border-color: var(--yellow-acc);
}

/* CRITICAL FIX FOR IMAGES COLUMN SIZING */
.woocommerce div.product.custom-single-product .images-column {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    /* Sin overflow:hidden aquí: romperia el sticky; .flex-viewport ya recorta el slider */
}
.woocommerce div.product.custom-single-product div.images {
    width: 100% !important;
    float: none !important;
}

.woocommerce div.product.custom-single-product .summary-column {
    min-width: 0;
    max-width: 100%;
    width: 100%;
}

.woocommerce div.product.custom-single-product .product-top-details {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 60px !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    align-items: start !important;
    padding-bottom: 160px !important;
}

@media(max-width: 900px){
    .woocommerce div.product.custom-single-product .product-top-details {
        grid-template-columns: 1fr !important;
        gap: 40px !important;
    }
}

/* ── GALERÍA DE PRODUCTO: FlexSlider slider 1:1 ────────────────────── */

/* 1. El outer .woocommerce-product-gallery no tiene card styling (thumbs quedan fuera) */
.woocommerce div.product.custom-single-product .woocommerce-product-gallery {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

/* 2. .flex-viewport = ventana de recorte del slider → aquí va el card.
   SIN padding: el padding expone el siguiente slide en el área de relleno. */
.woocommerce div.product.custom-single-product .flex-viewport {
    height: auto !important;
    overflow: hidden !important;
    background: #fff !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 28px !important;
    box-shadow: 0 8px 24px rgba(72,0,25,.06) !important;
    box-sizing: border-box !important;
}

/* 3. .woocommerce-product-gallery__wrapper = rail que FlexSlider anima.
   NO sobrescribir width (FlexSlider la pone en 300% para 3 slides) */
.woocommerce div.product.custom-single-product .woocommerce-product-gallery__wrapper {
    display: block !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    aspect-ratio: auto !important;
    margin: 0 !important;
}

/* 4. Cada slide: display block, sin tocar width ni float (FlexSlider los gestiona) */
.woocommerce div.product.custom-single-product .woocommerce-product-gallery__image {
    display: block !important;
    background: transparent !important;
    border-radius: 0 !important;
    overflow: visible !important;
    margin: 0 !important;
    height: auto !important;
}

/* 5. Anchor = cuadrado 1:1 que recorta la imagen */
.woocommerce div.product.custom-single-product .woocommerce-product-gallery__image a {
    display: block !important;
    aspect-ratio: 1 / 1 !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    background: #fff8fc !important;
    width: 100% !important;
}

/* 6. Imagen cubre el cuadrado completo */
.woocommerce div.product.custom-single-product .woocommerce-product-gallery__image img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center !important;
    border-radius: 0 !important;
    transform: none !important;
    margin: 0 !important;
    aspect-ratio: auto !important;
}

/* 7. Thumbnails debajo del card */
.woocommerce div.product.custom-single-product div.images .flex-control-thumbs {
    margin-top: 25px !important;
    padding: 0 !important;
}

/* ── Reference Image Gallery (rig) ───────────────────────────────── */
.ref-image-gallery-wrap {
    margin-bottom: 18px;
}

.ref-image-gallery-wrap__label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-text, #480019);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px;
}

#ref-image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Common slot styles */
.rig-slot {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Filled slot */
.rig-slot--filled {
    background: #efebce;
    border: 2px solid var(--color-primary, #A3A380);
}

.rig-slot__img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
}

/* Remove button */
.rig-slot__remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e53e3e;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: background .15s;
    z-index: 2;
}
.rig-slot__remove:hover { background: #c53030; }

/* Add slot */
.rig-slot--add {
    background: #efebce;
    border: 2px dashed var(--color-primary, #A3A380);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    user-select: none;
    -webkit-user-select: none;
}
.rig-slot--add:hover,
.rig-slot--add:focus-visible {
    background: #e2ddb5;
    border-color: var(--color-primary-dark, #480019);
    outline: none;
}

.rig-slot__icon {
    color: var(--color-primary, #A3A380);
}

.rig-slot__label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-primary, #A3A380);
    text-transform: uppercase;
    letter-spacing: .04em;
    line-height: 1;
}

