/* ==========================================================================
   Stephan's Pet Store - Shop Page Styles
   - 4 product boxes per row (desktop/laptop/tablet >= 768px)
   - 2 rows of 4 boxes = 8 products per page
   - White picture and product box background for all items
   ========================================================================== */

/* 1. Main Grid Layout: Enforce 4 Columns on Desktop (2 rows of 4 = 8 products) */
#products_grid #o_wsale_products_grid,
#products_grid .o_wsale_products_grid_table,
.o_wsale_products_grid_table.grid,
#products_grid .grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 20px !important;
    width: 100% !important;
}

/* Force each product card to take exactly 1 column slot */
#products_grid #o_wsale_products_grid > .oe_product,
#products_grid .o_wsale_products_grid_table > .oe_product,
.o_wsale_products_grid_table > .oe_product,
.oe_product.g-col-6.g-col-md-3.g-col-lg-3,
.oe_product {
    grid-column: span 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

/* 2. Responsive Breakpoints: 2 Columns on Mobile (<768px) */
@media (max-width: 767.98px) {
    #products_grid #o_wsale_products_grid,
    #products_grid .o_wsale_products_grid_table,
    .o_wsale_products_grid_table.grid,
    #products_grid .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }
}

/* Legacy table/row fallback if ever used */
#products_grid .o_wsale_products_grid_table_wrapper table tbody tr {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 20px !important;
    margin-bottom: 20px !important;
}
#products_grid .o_wsale_products_grid_table_wrapper table tbody td {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
}

/* 3. Product Box & Picture Background: Pure White to All */
#products_grid .oe_product,
#products_grid .o_wsale_product_grid_wrapper,
#products_grid .oe_product_cart,
#products_grid .oe_product_image,
#products_grid .oe_product_image_link,
#products_grid .oe_product_image_img_wrapper,
#products_grid .oe_product_image_img,
#products_grid .oe_product_image_img_secondary,
#products_grid .o_wsale_product_information,
#products_grid .o_wsale_product_information_text,
#products_grid .card,
.oe_product_cart,
.oe_product_cart .card-body,
.oe_product_image,
.oe_product_image_img_wrapper {
    background: #ffffff !important;
    background-color: #ffffff !important;
}

/* Skip off-screen card rendering until the browser approaches the next row. */
#products_grid .oe_product {
    content-visibility: auto;
    contain-intrinsic-size: auto 430px;
}

/* Above-the-fold cards must paint immediately; defer only later rows. */
#products_grid .oe_product:nth-child(-n + 4) {
    content-visibility: visible;
    contain-intrinsic-size: none;
}

/* 4. Product Card Aesthetics (Matches Next.js / Stephans Brand) */
#products_grid article.oe_product_cart,
article.oe_product_cart {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-radius: 14px !important;
    border: 1px solid #eae3d9 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease !important;
}

#products_grid article.oe_product_cart:hover,
article.oe_product_cart:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 10px 25px rgba(58, 37, 23, 0.09) !important;
    border-color: #c77e35 !important;
}

/* 5. Product Image Container & Fitting */
#products_grid .oe_product_image,
.oe_product_image {
    aspect-ratio: 1 / 1 !important;
    width: 100% !important;
    min-height: 220px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    overflow: hidden !important;
}

#products_grid .oe_product_image_link,
.oe_product_image_link {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ffffff !important;
}

#products_grid .oe_product_image_img_wrapper,
.oe_product_image_img_wrapper {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ffffff !important;
}

#products_grid .oe_product_image_img,
#products_grid .oe_product_image_img_secondary,
.oe_product_image_img,
.oe_product_image_img_secondary {
    max-width: 90% !important;
    max-height: 90% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    margin: auto !important;
    transition: transform 0.3s ease !important;
}

#products_grid article.oe_product_cart:hover .oe_product_image_img {
    transform: scale(1.04) !important;
}

/* 6. Typography & Pricing */
#products_grid .o_wsale_product_information,
.o_wsale_product_information {
    padding: 12px 14px 16px 14px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    background: #ffffff !important;
    border-top: 1px solid #f5f2ed !important;
}

#products_grid .o_wsale_products_item_title,
.o_wsale_products_item_title {
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: #222222 !important;
    line-height: 1.35 !important;
    margin-bottom: 8px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    min-height: 36px !important;
}

#products_grid .o_wsale_products_item_title a,
.o_wsale_products_item_title a {
    color: #222222 !important;
    text-decoration: none !important;
    transition: color 0.2s ease !important;
}

#products_grid .o_wsale_products_item_title a:hover,
.o_wsale_products_item_title a:hover {
    color: #c77e35 !important;
}

/* Price */
#products_grid .oe_price,
#products_grid .product_price,
.product_price {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #3e220f !important;
}

/* 7. Pagination Styling */
#products_grid .pagination {
    margin-top: 40px !important;
    margin-bottom: 40px !important;
    gap: 8px !important;
    justify-content: center !important;
}

#products_grid .pagination .page-item .page-link {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #555555 !important;
    border: 1px solid #eae3d9 !important;
    background: #ffffff !important;
    transition: all 0.2s ease !important;
}

#products_grid .pagination .page-item.active .page-link {
    background-color: #3e220f !important;
    border-color: #3e220f !important;
    color: #ffffff !important;
}

#products_grid .pagination .page-item .page-link:hover {
    background-color: #f8f5f0 !important;
    border-color: #c77e35 !important;
    color: #3e220f !important;
}

/* 8. Fix Description in Product Box on /shop (prevent raw HTML or stretched cards) */
#products_grid .oe_subdescription_wrapper,
#products_grid .oe_subdescription,
.oe_subdescription_wrapper,
.oe_subdescription {
    display: none !important;
    max-height: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 9. Product Details Page Width & Responsive Container Alignment */
.o_wsale_product_page {
    width: 100% !important;
}

#product_detail {
    width: 100% !important;
    max-width: 1320px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
}

#product_detail .row {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    align-items: flex-start !important;
}

/* Product gallery column (50% on desktop) */
#product_detail .o_wsale_product_images {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    padding-right: 25px !important;
    padding-left: 0 !important;
}

/* Keep full-resolution product media while giving the packshot breathing room. */
#product_detail .o_product_detail_img_wrapper {
    overflow: hidden !important;
    background: #ffffff !important;
}

#product_detail .o_product_detail_img_wrapper > img.product_detail_img {
    width: 82% !important;
    height: 82% !important;
    max-width: 82% !important;
    max-height: 82% !important;
    margin: auto !important;
    object-fit: contain !important;
    object-position: center !important;
}

/* Product details column (50% on desktop) */
#product_details {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    padding-left: 25px !important;
    padding-right: 0 !important;
}

#product_details #o_wsale_product_details_content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Product full description container below product section */
#product_full_description {
    width: 100% !important;
    max-width: 1320px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    box-sizing: border-box !important;
}

.stephans-product-description {
    background: #ffffff !important;
    border: 1px solid #eae3d9 !important;
    border-radius: 14px !important;
    padding: 32px !important;
    margin-top: 24px !important;
    margin-bottom: 40px !important;
    box-shadow: 0 2px 12px rgba(58, 37, 23, 0.04) !important;
}

.stephans-product-description h3 {
    color: #3e220f !important;
    font-weight: 700 !important;
    margin-bottom: 16px !important;
    font-size: 1.5rem !important;
}

.stephans-product-description h4 {
    color: #3e220f !important;
    font-weight: 600 !important;
    margin-top: 20px !important;
    margin-bottom: 12px !important;
    font-size: 1.15rem !important;
}

.stephans-product-description p,
.stephans-product-description li {
    color: #4a4a4a !important;
    line-height: 1.6 !important;
    font-size: 0.95rem !important;
}

.stephans-product-description .table {
    width: 100% !important;
    max-width: 100% !important;
    background: #ffffff !important;
    border: 1px solid #eae3d9 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    margin-top: 10px !important;
}

.stephans-product-description .table th {
    background: #fbf9f6 !important;
    color: #3e220f !important;
    font-weight: 600 !important;
    width: 45% !important;
    padding: 10px 14px !important;
    border-color: #eae3d9 !important;
}

.stephans-product-description .table td {
    padding: 10px 14px !important;
    border-color: #eae3d9 !important;
    color: #222222 !important;
}

@media (max-width: 991.98px) {
    #product_detail .o_wsale_product_images,
    #product_details {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .stephans-product-description {
        padding: 20px !important;
    }
}

/* Product description: theme-aligned reading width and content rhythm. */
#product_full_description {
    width: 100% !important;
    max-width: 1320px !important;
    margin: 40px auto 72px !important;
    padding: 0 20px !important;
    box-sizing: border-box !important;
}

#product_full_description > .stephans-product-description {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: clamp(28px, 4vw, 52px) !important;
    border: 1px solid #eae3d9 !important;
    border-radius: 20px !important;
    background: #fbf8f5 !important;
    box-shadow: 0 10px 32px rgba(58, 37, 23, 0.06) !important;
}

.stephans-product-description h3 {
    max-width: 100% !important;
    margin: 0 0 14px !important;
    color: #2a211c !important;
    font-family: "Playfair Display", Georgia, "Times New Roman", serif !important;
    font-size: clamp(1.75rem, 3vw, 2.35rem) !important;
    font-weight: 500 !important;
    line-height: 1.18 !important;
}

.stephans-product-description h4 {
    margin: 0 0 16px !important;
    color: #3e220f !important;
    font-family: "Playfair Display", Georgia, "Times New Roman", serif !important;
    font-size: 1.35rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
}

.stephans-product-description p,
.stephans-product-description li {
    color: #5f554e !important;
    font-size: 0.96rem !important;
    line-height: 1.72 !important;
}

.stephans-product-description > p {
    max-width: 100% !important;
    margin-bottom: 16px !important;
}

.stephans-product-description > p.lead {
    max-width: 100% !important;
    color: #4e2a15 !important;
    font-size: 1.05rem !important;
}

.stephans-product-description > .row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 48px !important;
    width: 100% !important;
    margin: 34px 0 0 !important;
}

.stephans-product-description > .row > [class*="col-"] {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
}

.stephans-product-description ul {
    margin: 0 !important;
    padding-left: 20px !important;
}

.stephans-product-description li + li {
    margin-top: 7px !important;
}

.stephans-product-description .table {
    margin: 0 !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    background: #fff !important;
}

.stephans-product-description a {
    color: #9a5d2d !important;
    text-decoration-color: rgba(154, 93, 45, 0.4) !important;
    text-underline-offset: 3px !important;
}

.stephans-product-description a:hover {
    color: #4e2a15 !important;
}

@media (max-width: 991.98px) {
    .stephans-product-description > .row {
        grid-template-columns: 1fr !important;
        gap: 28px !important;
    }
}

@media (max-width: 575.98px) {
    #product_full_description {
        margin: 24px auto 48px !important;
        padding: 0 16px !important;
    }

    #product_full_description > .stephans-product-description {
        padding: 22px 18px !important;
        border-radius: 14px !important;
    }

    .stephans-product-description .table th,
    .stephans-product-description .table td {
        padding: 9px 10px !important;
        font-size: 0.88rem !important;
    }

    #product_detail .o_product_detail_img_wrapper > img.product_detail_img {
        width: 88% !important;
        height: 88% !important;
        max-width: 88% !important;
        max-height: 88% !important;
    }
}

/* ==========================================================================
   Stephan's Brand Theme Button Overrides (#3e220f)
   ========================================================================== */
#add_to_cart,
.js_check_product .a-submit,
.btn-primary,
button.btn-primary,
a.btn-primary,
.o_wsale_product_btn .btn-primary,
.oe_cart .btn-primary,
#o_payment_form_pay,
.o_payment_submit_button,
.o_wsale_product_page .btn-primary {
    background-color: #3e220f !important;
    border-color: #3e220f !important;
    color: #ffffff !important;
    border-radius: 999px !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
    box-shadow: 0 4px 14px rgba(62, 34, 15, 0.2) !important;
    transition: all 0.2s ease !important;
}

#add_to_cart:hover,
.js_check_product .a-submit:hover,
.btn-primary:hover,
button.btn-primary:hover,
a.btn-primary:hover,
.o_wsale_product_btn .btn-primary:hover,
.oe_cart .btn-primary:hover,
#o_payment_form_pay:hover,
.o_payment_submit_button:hover,
.o_wsale_product_page .btn-primary:hover {
    background-color: #2a170a !important;
    border-color: #2a170a !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 18px rgba(62, 34, 15, 0.3) !important;
}

/* Secondary & Quantity Stepper Buttons */
.css_quantity {
    border-radius: 999px !important;
    overflow: hidden !important;
    border: 1px solid #e4e4e7 !important;
    background: #fafaf9 !important;
}

.css_quantity .btn {
    background-color: #fafaf9 !important;
    border: 0 !important;
    color: #3e220f !important;
    font-weight: 700 !important;
    transition: background-color 0.15s !important;
}

.css_quantity .btn:hover {
    background-color: #f4f4f5 !important;
    color: #3e220f !important;
}

.css_quantity input.js_quantity {
    border: 0 !important;
    background: transparent !important;
    font-weight: 700 !important;
    color: #3e220f !important;
}


/* ==========================================================================
   Product Detail Page - Pure White Canvas & Minimalist Plain Boxes
   ========================================================================== */
body:has(.o_wsale_product_page),
body.o_wsale_product_page,
.o_wsale_product_page,
#wrap.o_wsale_product_page,
#product_detail,
#product_detail_main,
#product_details,
#product_full_description,
.oe_website_sale,
.stephans-product-description {
    background: #ffffff !important;
    background-color: #ffffff !important;
}

/* Reduced box shadows / Plain flat card styling across all product descriptions */
#product_full_description .card,
#product_full_description .border,
#product_full_description [class*="shadow"],
.stephans-product-description .card,
.stephans-product-description .border,
.stephans-product-description [class*="shadow"] {
    box-shadow: none !important;
    background-color: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
}

#product_full_description .alert,
.stephans-product-description .alert {
    box-shadow: none !important;
    background-color: #f9fafb !important;
    border: 1px solid #e5e7eb !important;
    color: #374151 !important;
    border-radius: 8px !important;
}

