/* =========================================
   SINGLE PRODUCT PAGE STYLES
   ========================================= */

/* GLOBAL HIDES */
/* Hide Breadcrumbs (Blocksy & WC) */
.ct-breadcrumbs,
.woocommerce-breadcrumb,
.storefront-breadcrumb-delimiter {
    display: none !important;
}

/* Hide Meta (SKU, Category tags) globally on product page */
.product_meta,
.posted_in,
.sku_wrapper {
    display: none !important;
}

/* Container & Layout */
.single-product .ct-container,
.single-product .ct-container-full {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

/* =========================================
   MAIN LAYOUT GRID
   ========================================= */
/* Grid removed as per user request to use default block layout which works better */

.product-type-simple,
.product-type-variable {
    /* Ensure clear floats if display block is used */
    display: block; 
}

/* Fix for Blocksy container width constraints */
.product-entry-wrapper {
    width: 100% !important;
    max-width: none !important;
}

/* Ensure Product Gallery and Summary sit side-by-side on desktop if not using grid */
@media (min-width: 900px) {
    .woocommerce-product-gallery {
        width: 45% !important; /* Reduced from 55% */
        float: left !important;
        margin-right: 5% !important;
        margin-bottom: 0 !important;
    }

    .entry-summary {
        width: 50% !important; /* Increased from 40% */
        float: right !important;
        clear: right !important;
    }
    
    /* Clearfix after product info */
    .product-type-simple::after,
    .product-type-variable::after {
        content: "";
        display: table;
        clear: both;
    }
}

/* =========================================
   PRODUCT GALLERY (Vertical Thumbnails Left)
   ========================================= */
   
/* Target Blocksy's specific flexy gallery structure */
.flexy-container[data-flexy] {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 1.5rem !important;
    align-items: flex-start !important;
}

/* Thumbnails Container - Move to Left */
.flexy-pills[data-type="thumbs"] {
    width: 80px !important;
    min-width: 80px !important;
    height: auto !important;
    margin-top: 0 !important;
    order: -1 !important; /* Move to the left */
    display: flex !important;
    flex-direction: column !important;
}

/* Main Image Container - Right side */
.flexy-container[data-flexy] > .flexy {
    width: calc(100% - 95px) !important;
    flex: 1 !important;
    margin-bottom: 0 !important;
}

/* Force vertical stacking of thumbnails */
.flexy-pills ol {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    height: auto !important;
    transform: none !important; /* Disable any existing JS transforms if possible */
}

.flexy-pills li {
    width: 100% !important;
    height: auto !important;
    margin-right: 0 !important;
    display: block !important;
    margin-bottom: 0 !important;
}

/* Thumbnail Images Styling */
.flexy-pills img,
.flexy-pills span.ct-media-container {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    border-radius: 8px !important;
    border: 1px solid #eee;
    cursor: pointer;
    transition: all 0.2s ease;
}

.flexy-pills li.active img,
.flexy-pills li:hover img {
    border-color: var(--brand-primary, #FF5F14);
}

/* Also keep the standard WC classes just in case, but prioritize flexy */
.woocommerce-product-gallery {
    display: flex !important;
    gap: 1.5rem;
}

/* Thumbnails styling */
.flex-control-nav.flex-control-thumbs li {
    width: 100% !important;
    float: none !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.flex-control-nav.flex-control-thumbs img {
    cursor: pointer;
    border: 1px solid #eee;
    border-radius: 8px;
    opacity: 0.6;
    transition: opacity 0.2s, border-color 0.2s;
    display: block;
    width: 100%;
    height: auto;
}

.flex-control-nav.flex-control-thumbs img.flex-active,
.flex-control-nav.flex-control-thumbs img:hover {
    opacity: 1;
    border-color: var(--brand-primary, #FF5F14);
}

.woocommerce-product-gallery__image img {
    border-radius: 12px;
}

/* =========================================
   PRODUCT INFO
   ========================================= */

.product_title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #1b1b1b;
    line-height: 1.2;
}

.price {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1b1b1b !important;
    margin-bottom: 1.5rem;
    display: block;
}

.woocommerce-product-details__short-description {
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.6;
    color: #555;
}

.woocommerce-product-details__short-description ul {
    list-style-type: none !important; /* Remove bullets but keep layout */
    padding-left: 0 !important;
    margin-top: 1rem;
}

.woocommerce-product-details__short-description li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.6rem;
}

.woocommerce-product-details__short-description li::before {
    content: "•";
    position: absolute;
    left: 0;
    font-weight: bold;
    color: #333;
}


/* =========================================
   ADD TO CART ACTION
   ========================================= */

/* For Simple Products: The form is the container */
form.cart:not(.variations_form) {
    display: flex !important;
    flex-wrap: wrap; 
    align-items: center !important;
    gap: 1rem !important;
}

/* For Variable Products: The add-to-cart wrapper inside is the container */
.woocommerce-variation-add-to-cart {
    display: flex !important;
    flex-wrap: wrap; 
    align-items: center !important;
    gap: 1rem !important;
}

/* Ensure the variable product form doesn't flex vertically weirdly */
form.cart.variations_form {
    display: block !important;
}

/* Hide the weird "7 disponibles" that appears twice or in wrong place for variations */
/* Often in variable products it appears inside single_variation AND somewhere else */
.woocommerce-variation-availability {
    display: block;
    width: 100%;
    margin-bottom: 1rem;
}

.quantity {
    display: flex;
    border-radius: 8px;
    height: 48px;
    width: 130px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0; /* Prevent shrinking */
}

.quantity input.qty {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    text-align: center;
    background: transparent !important;
    font-weight: 700;
    font-size: 1.1rem;
    color: #1b1b1b;
    padding: 0;
    appearance: none;
    -moz-appearance: textfield;
}

/* FIX FOR BUNDLED PRODUCTS LAYOUT */
/* Hide simple products in bundle summary (like the Maleta) since they have no options 
   and we hid their stock info, leaving an empty box */
.bundled_product_summary:has(.cart[data-type="simple"]) {
    display: none !important;
}

.bundled_product_summary {
    width: 100% !important;
}

.bundle_button {
    display: flex !important;
    justify-content: flex-start !important; /* Start aligned, gap will handle spacing */
    flex-wrap: nowrap !important;
    gap: 20px !important;
    align-items: center !important;
    width: 100%;
}

/* Ensure bundle button takes appropriate space */
.bundle_button .single_add_to_cart_button {
    margin: 0 !important;
}

/* Button Styling */
.single_add_to_cart_button {
    background-color: var(--brand-primary, #FF5F14) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    height: 48px !important;
    padding: 0 2.5rem !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    flex-grow: 1; /* Expand to fill space if needed, or remove for fixed size */
    max-width: 300px;
    /* Ensure disabled button keeps shape */
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    line-height: 1 !important; /* Fix vertical alignment text inside button */
}

.single_add_to_cart_button.disabled {
    opacity: 0.5 !important;
    cursor: not-allowed;
    background-color: #ccc !important;
    color: #666 !important;
}

/* Hide bundled product stock availability if duplicated */
.bundled_product .bundled_item_cart_details p.stock {
    display: none !important;
}

/* Ensure variable products quantity and button align properly */
.woocommerce-variation-add-to-cart .quantity,
.woocommerce-variation-add-to-cart .single_add_to_cart_button {
    margin: 0 !important; /* Reset margins that might push them vertically */
}

/* Force flex container for variable products to keep button inline */
.woocommerce-variation-add-to-cart {
    display: flex !important;
    flex-wrap: nowrap !important; /* Prevent wrapping to next line */
    align-items: center !important;
    gap: 1rem !important;
}

.single_variation_wrap {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Adjust variation select boxes */
table.variations {
    width: 100%;
    margin-bottom: 1.5rem;
}

table.variations td.label {
    padding-right: 1rem;
    vertical-align: middle;
    width: auto;
}

table.variations td.value {
    padding-left: 0;
    vertical-align: middle;
}

/* Hide duplicate stock info if needed, or style it */
.woocommerce-variation-availability p.stock {
    font-size: 0.9rem;
    color: #555;
    margin: 0;
}

.single_add_to_cart_button:hover {
    background-color: #e65512 !important;
    transform: translateY(-1px);
}

/* =========================================
   RELATED PRODUCTS
   ========================================= */
.related.products {
    border-top: 1px solid #f0f0f0;
    padding-top: 4rem;
    grid-column: 1 / -1 !important; /* Ensure it takes full width */
    width: 100%;
}

.related.products > h2 {
    text-align: left;
    font-size: 1.8rem;
    margin-bottom: 2rem;
}

.related.products ul.products {
    display: grid !important;
    /* Force 3 columns layout logic even if fewer items */
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2rem !important;
}

/* Hide Category/Tags in Related Products loop */
.related.products .product .posted_in,
.related.products .product .product-category,
.related.products .product .ct-product-meta,
.related.products .product .tagged_as,
.related.products .product .meta-post-categories,
.related.products .product .entry-meta {
    display: none !important;
}

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

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

.related.products .product {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 1.25rem;
    overflow: hidden;
    padding-bottom: 1.5rem;
    transition: transform 0.2s;
}

.related.products .product:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.related.products .product img {
    height: 200px;
    width: 100%;
    object-fit: cover;
    background: linear-gradient(135deg, rgba(255, 95, 20, 0.9), rgba(255, 95, 20, 0.65));
    border-radius: 0 !important;
    margin-bottom: 1rem !important;
}

.related.products .product .woocommerce-loop-product__title {
    font-size: 1rem !important;
    padding: 0 1.2rem;
    margin-bottom: 0.5rem;
    color: #1b1b1b;
    line-height: 1.3;
}

.related.products .product .price {
    font-size: 1.1rem !important;
    padding: 0 1.2rem;
    margin-bottom: 1rem !important;
    color: var(--brand-primary, #FF5F14) !important;
    text-align: left;
}

.related.products .product .button {
    margin: 0 1.2rem !important;
    width: calc(100% - 2.4rem);
    background: var(--brand-primary, #FF5F14) !important;
    color: #fff !important;
    border-radius: 8px !important;
    text-align: center;
    padding: 0.6rem !important;
    font-size: 0.8rem !important;
    font-weight: 600;
}


