/* ==========================================================================
   BRICODY: AMAZON-STYLE PRODUCT PAGE RECONSTRUCTION (LIGHT THEME)
   ========================================================================== */

/* Prevent horizontal scroll from any padding expansions */
html, body {
    overflow-x: hidden !important;
}

.single-product div.product *,
.single-product div.product *::before,
.single-product div.product *::after {
    box-sizing: border-box !important;
}

/* --------------------------------------------------------------------------
   1. DESKTOP GRID LAYOUT (3 columns: Gallery | Center Info | Buy Box)
   -------------------------------------------------------------------------- */
.single-product div.product {
    display: grid !important;
    grid-template-columns: minmax(320px, 1fr) minmax(0, 1.8fr);
    gap: 40px;
    align-items: start;
    margin-bottom: 50px;
}

.single-product div.product .woocommerce-product-gallery {
    width: 100% !important;
    float: none !important;
    grid-column: 1;
    border-radius: 8px !important;
    overflow: hidden;
    border: none;
    box-shadow: none;
}

.single-product div.product .woocommerce-product-gallery img {
    border-radius: 8px !important;
    border: 1px solid #e7e7e7;
    width: 100%;
}

.single-product div.product .summary.entry-summary {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 30px;
    align-items: start;
    width: 100% !important;
    float: none !important;
    grid-column: 2;
    padding: 0 !important;
    margin: 0 !important;
}

/* --------------------------------------------------------------------------
   2. CENTER COLUMN INFO (Title, Rating, Excerpt, Swatches)
   -------------------------------------------------------------------------- */
.bricody-amazon-center {
    display: flex;
    flex-direction: column;
}

.bricody-amazon-center .product_title {
    font-size: 24px !important;
    line-height: 1.3 !important;
    margin-bottom: 8px;
    color: #0f1111 !important;
    font-weight: 500 !important;
    border-bottom: none !important;
    letter-spacing: normal;
    padding: 0;
}

.bricody-amazon-center .woocommerce-product-rating {
    margin-bottom: 15px;
    border-bottom: 1px solid #e7e7e7;
    padding-bottom: 12px;
}

/* Section: Short Description (About this Item) */
.bricody-amazon-center .woocommerce-product-details__short-description {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e7e7e7;
    order: 10; /* Force it to appear BELOW the swatches visually if needed */
}
.bricody-amazon-center .woocommerce-product-details__short-description::before {
    content: "Acerca de este producto";
    display: block;
    font-weight: 800;
    font-size: 17px;
    color: #0f1111;
    margin-bottom: 15px;
    letter-spacing: -0.02em;
}
.bricody-amazon-center .woocommerce-product-details__short-description ul {
    padding-left: 20px;
    margin-bottom: 20px;
    list-style-type: disc;
}
.bricody-amazon-center .woocommerce-product-details__short-description li,
.bricody-amazon-center .woocommerce-product-details__short-description p {
    margin-bottom: 8px;
    line-height: 1.5;
    color: #0f1111;
    font-size: 14px;
}

/* Section: Metadata (Categories) */
.bricody-amazon-center .product_meta {
    font-size: 13px;
    color: #007185;
    padding-top: 10px;
    border-top: none;
    order: 11;
}
.bricody-amazon-center .product_meta a {
    color: #007185 !important;
    text-decoration: none !important;
}
.bricody-amazon-center .product_meta a:hover {
    text-decoration: underline !important;
    color: #c45500 !important;
}

/* --------------------------------------------------------------------------
   3. SWATCHES (Medida & Apertura Amazon Native Replication)
   -------------------------------------------------------------------------- */
.bricody-amazon-swatch-wrap {
    margin-bottom: 20px;
    order: 5;
}

.bricody-amazon-swatch-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
    color: #0f1111;
    font-size: 15px;
}
.bricody-amazon-swatch-label strong {
    color: #c45500;
}

.bricody-amazon-swatch-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}

.bricody-amazon-swatch {
    display: inline-flex !important;
    flex: 0 1 auto !important; /* Don't force them to be enormous */
    min-width: 0 !important;
    margin-bottom: 0 !important;
    cursor: pointer;
}

.bricody-amazon-swatch input[type="radio"] {
    display: none !important;
}

.bricody-amazon-swatch .swatch-box {
    border: 1px solid #d5d9d9;
    padding: 10px 16px;
    border-radius: 8px;
    color: #0f1111;
    background: #fff;
    font-size: 15px;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    box-shadow: 0 1px 2px rgba(15,17,17,0.1) inset;
}

.bricody-amazon-swatch .swatch-box small {
    display: block;
    font-size: 14px;
    color: #2c5aa0; /* Color primario del tema */
    font-weight: 700;
    margin-top: 4px;
}

.bricody-amazon-swatch:hover .swatch-box {
    background: #f7fafa;
    border-color: #adb1b1;
    box-shadow: 0 2px 5px rgba(15,17,17,0.15);
}

.bricody-amazon-swatch.active .swatch-box {
    border: 2px solid #e77600;
    box-shadow: 0 0 0 1px #e77600 inset;
    background: #fdf8f3;
}

.bricody-amazon-swatch.active .swatch-box small {
    color: #c45500; /* Resalta el precio cuando está seleccionado */
}

/* --------------------------------------------------------------------------
   4. BUY BOX (Right Column)
   -------------------------------------------------------------------------- */
.bricody-amazon-buybox {
    background: #fff;
    border: 1px solid #d5d9d9;
    border-radius: 8px;
    padding: 18px;
    position: sticky;
    top: 30px;
}

.bricody-amazon-buybox .price {
    font-size: 28px !important;
    color: #0f1111 !important;
    font-weight: 500 !important;
    margin-bottom: 20px !important;
    display: block;
}

.bricody-amazon-buybox form.cart {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 0;
}

.bricody-amazon-buybox form.cart .quantity {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
}

.bricody-amazon-buybox form.cart .quantity input.qty {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #d5d9d9;
    color: #0f1111;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(15,17,17,0.15) inset;
    transition: all 0.2s;
}

.bricody-amazon-buybox form.cart .quantity input.qty:focus {
    outline: none !important;
    border-color: #007185 !important;
    box-shadow: 0 0 0 3px rgba(0,113,133,.3) !important;
}

.bricody-amazon-buybox button[type="submit"].single_add_to_cart_button {
    width: 100% !important;
    border-radius: 999px !important;
    padding: 12px 16px !important;
    background: #ffd814 !important; /* Amazon Primary Yellow */
    color: #0f1111 !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    text-shadow: none !important;
    line-height: 1;
    border: 1px solid #FCD200 !important;
    box-shadow: 0 2px 5px 0 rgba(213,217,217,.5) !important;
    cursor: pointer;
    margin: 0 !important;
    transition: all 0.2s ease;
}

.bricody-amazon-buybox button[type="submit"].single_add_to_cart_button:hover {
    background: #f7ca00 !important;
    border-color: #f2c200 !important;
}

.bricody-amazon-buybox::after {
    content: "\1F512 \a0 Transacci\f3n segura"; /* Safe UTF-8 */
    display: block;
    text-align: left;
    margin-top: 15px;
    font-size: 14px;
    color: #007185;
}

/* --------------------------------------------------------------------------
   5. LONG DESCRIPTION & TABS (Full Width Bottom)
   -------------------------------------------------------------------------- */
.woocommerce-tabs.wc-tabs-wrapper {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    margin-top: 60px !important;
    padding-top: 40px !important;
    border-top: 1px solid #e7e7e7 !important;
    clear: both !important;
}


.woocommerce-tabs ul.tabs {
    display: none !important; /* Mantenemos las pestañas ocultas para un flujo lineal */
}

.woocommerce-tabs .panel {
    background: transparent !important;
    padding: 0 !important;
}

/* Título de la sección principal */
.woocommerce-tabs .panel::before {
    content: "Descripción del producto";
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: #0f1111;
    margin-bottom: 25px;
    letter-spacing: -0.02em;
}

.woocommerce-tabs .panel p {
    font-size: 16px !important;
    line-height: 1.6 !important;
    color: #333 !important;
    margin-bottom: 20px !important;
    max-width: 800px;
}

/* Estilo para tablas de especificaciones técnicas */
.woocommerce-tabs table.shop_attributes {
    border-collapse: collapse !important;
    width: 100% !important;
    max-width: 600px !important;
    margin-top: 20px !important;
    border: 1px solid #e7e7e7 !important;
}

.woocommerce-tabs table.shop_attributes th {
    background: #f3f3f3 !important;
    color: #444 !important;
    padding: 12px 15px !important;
    width: 200px !important;
    font-weight: 700 !important;
    border: 1px solid #e7e7e7 !important;
}

.woocommerce-tabs table.shop_attributes td {
    padding: 12px 15px !important;
    font-style: normal !important;
    color: #0f1111 !important;
    border: 1px solid #e7e7e7 !important;
}


/* --------------------------------------------------------------------------
   6. RELATED PRODUCTS
   -------------------------------------------------------------------------- */
.related.products, .upsells.products {
    grid-column: 1 / -1 !important;
    margin-top: 40px !important;
    padding-top: 30px !important;
    border-top: 1px solid #e7e7e7 !important;
    width: 100% !important;
}

.related.products h2 {
    font-size: 24px !important;
    margin-bottom: 25px !important;
    color: #0f1111 !important;
}

.related.products ul.products {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 20px !important;
}

.related.products ul.products::before,
.related.products ul.products::after {
    display: none !important;
}

.related.products ul.products li.product {
    width: 100% !important;
    margin: 0 !important;
    clear: none !important;
}

/* --------------------------------------------------------------------------
   7. PURE MOBILE RECONSTRUCTION (Crucial)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .single-product div.product {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
    }

    .single-product div.product .woocommerce-product-gallery {
        margin-bottom: 20px !important;
    }

    .single-product div.product .summary.entry-summary {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
    }

    .bricody-amazon-center {
        order: 1; /* Center column content goes first on mobile */
        padding-bottom: 20px;
    }

    .bricody-amazon-buybox {
        order: 2; /* Buybox goes exactly after variations */
        position: static !important;
        margin-top: 0 !important;
        margin-bottom: 30px !important;
        padding: 20px !important;
        border-radius: 8px !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    .bricody-amazon-swatch {
        flex: 1 1 45% !important; /* Two columns strictly! */
        justify-content: center !important;
    }
    
    .bricody-amazon-swatch .swatch-box {
        width: 100%;
    }

    .woocommerce-tabs.wc-tabs-wrapper {
        order: 3;
        margin-top: 0 !important;
        padding-top: 30px !important;
    }
}
