/**
 * JoykasCake - WooCommerce Custom Styles
 * Matches the main theme design system
 */

/* =============================================
   WOOCOMMERCE WRAPPER & GRID SYSTEM
   ============================================= */

.joykas-woo-wrapper {
    padding-top: 5%;
    min-height: 80vh;
    background-color: #f4f7f6;
    /* Modern Light Gray */
    padding-bottom: 80px;
    padding-left: 20px;
    padding-right: 20px;
}

/* Shop Layout: Sidebar + Grid - Fixed with explicit class */
.joykas-woo-wrapper.has-sidebar {
    display: grid !important;
    grid-template-columns: 260px 1fr !important;
    gap: 40px !important;
    width: 100%;
    margin: 0 auto;
    align-items: start;
}

/* Sidebar Styling - Force Left Column */
.joykas-shop-sidebar {
    grid-column: 1 !important;
    grid-row: 1 / span 20 !important;
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 100px;
    height: fit-content;
    z-index: 10;
}

/* All other direct children go to Column 2 */
.joykas-woo-wrapper.has-sidebar>*:not(.joykas-shop-sidebar) {
    grid-column: 2 !important;
    width: 100%;
}

.joykas-sidebar-title {
    font-size: 1.2rem;
    color: var(--brand-dark);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--brand-pink-soft);
}

.joykas-cat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.joykas-cat-list li {
    margin-bottom: 5px;
}

.joykas-cat-list li a {
    display: block;
    padding: 10px 12px;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.joykas-cat-list li a:hover,
.joykas-cat-list li a.active {
    background: #e8f5e9;
    /* Light Green Tint */
    color: #2e7d32;
    /* Dark Green */
    font-weight: 600;
}

.joykas-cat-list li a i {
    color: #43a047;
}

/* Shop Header & Notices - Right Column */
.woocommerce-products-header,
.woocommerce-notices-wrapper,
.woocommerce-result-count,
.woocommerce-ordering,
.woocommerce-pagination {
    grid-column: 2;
}

.woocommerce-products-header {
    background: white;
    padding: 20px 30px;
    margin-bottom: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    grid-row: 1;
    display: flex;
    align-items: center;
}

.woocommerce-products-header__title {
    font-size: 1.8rem;
    color: var(--brand-dark);
    margin: 0;
    font-weight: 800;
}

/* Product Grid container */
.woocommerce ul.products {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
    gap: 25px !important;
    padding: 0 !important;
    /* Reset padding */
    margin: 0 0 60px !important;
    list-style: none !important;
    grid-column: 2;
    /* Right Column */
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
    display: none !important;
}

/* Product Card */
.woocommerce ul.products li.product {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.25s ease;
    padding: 12px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    height: 100%;
    text-align: left;
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
}

.woocommerce ul.products li.product:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

/* Image styling */
.woocommerce ul.products li.product a img {
    width: 100% !important;
    aspect-ratio: 4/3 !important;
    height: auto !important;
    object-fit: cover !important;
    border-radius: 12px !important;
    margin-bottom: 12px !important;
    background-color: #f0f0f0;
}

/* Typography */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #282c3f;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title::after {
    content: "Artisanal Cake";
    display: block;
    font-size: 0.8rem;
    color: #686b78;
    font-weight: 400;
    margin-top: 4px;
}

.woocommerce ul.products li.product .price {
    font-size: 1.1rem;
    font-weight: 600;
    color: #282c3f;
    margin-bottom: 15px;
}

.woocommerce ul.products li.product .price del {
    color: #999;
    font-weight: 400;
    font-size: 0.9em;
}

.woocommerce ul.products li.product .price ins {
    text-decoration: none;
    font-weight: 600;
    background: transparent;
}

/* ADD TO CART BUTTONS - THEME PINK STYLE */
.woocommerce a.button.add_to_cart_button,
.woocommerce button.button.alt,
.woocommerce input.button.alt,
.woocommerce #respond input#submit.alt,
.woocommerce .wc-proceed-to-checkout a.checkout-button {
    background: linear-gradient(135deg, #FF324B, #D0002F) !important;
    /* Theme Pink Gradient */
    color: white !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(255, 50, 75, 0.3) !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none !important;
    transition: all 0.3s ease !important;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    line-height: 1 !important;
}

/* Card Button Specifics */
.woocommerce ul.products li.product .button {
    width: 100%;
    margin-top: auto;
    background: white !important;
    color: #FF324B !important;
    border: 1px solid #d4d5d9 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

.woocommerce ul.products li.product .button:hover {
    background: #FF324B !important;
    color: white !important;
    border-color: #FF324B !important;
    box-shadow: 0 4px 12px rgba(255, 50, 75, 0.4) !important;
}

/* Big Action Buttons (Checkout/Place Order) */
.woocommerce .wc-proceed-to-checkout a.checkout-button,
.woocommerce #payment #place_order {
    width: 100%;
    display: block;
    padding: 18px 30px !important;
    font-size: 1.1rem !important;
}

.woocommerce .wc-proceed-to-checkout a.checkout-button:hover,
.woocommerce #payment #place_order:hover {
    background: linear-gradient(135deg, #D0002F, #B00020) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 50, 75, 0.4) !important;
}

/* Sale Badge */
.woocommerce span.onsale {
    background: #FF5722;
    /* Amazon Orange/Red */
    top: 15px;
    left: 15px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* =============================================
   CHECKOUT PAGE (SPLIT LAYOUT)
   ============================================= */

.woocommerce-checkout .woocommerce {
    max-width: 1300px;
    margin: 0 auto;
}

.woocommerce form.checkout {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
}

#customer_details {
    flex: 1 1 600px;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.woocommerce-checkout-review-order {
    flex: 0 0 400px;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    /* Stronger shadow */
    height: fit-content;
    position: sticky;
    top: 100px;
    border: 1px solid var(--border-light);
}

/* Default Headings */
.woocommerce-checkout h3 {
    margin-top: 0;
    color: var(--brand-dark);
}

/* Form Fields */
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

.woocommerce form .form-row input.input-text:focus {
    border-color: #60b246;
    /* Focus Green */
    box-shadow: 0 0 0 2px rgba(96, 178, 70, 0.1);
    outline: none;
}

/* Delivery Section (My Custom HTML) */
#delivery_details {
    background: #f1f8e9;
    /* Light Green Tint */
    padding: 25px;
    border-radius: 8px;
    margin-top: 30px;
    border: 1px solid #c5e1a5;
}

#delivery_details h3 {
    color: #2e7d32;
    font-size: 1.2rem;
    margin-bottom: 20px;
}

/* Payment Box */
#payment {
    background: transparent !important;
}

#payment div.payment_box {
    background: #fff3e0;
    color: #e65100;
    padding: 15px;
}

/* Cart & Other Pages */
.woocommerce-cart .woocommerce,
.woocommerce-account .woocommerce {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header Icons */
.header-cart-link,
.header-account-link {
    font-size: 20px;
    color: var(--brand-dark);
    margin-right: 20px;
}

.header-cart-link .cart-count {
    background: #60b246;
    /* Green Badge */
}

/* Order Received */
.woocommerce-order-received .woocommerce {
    max-width: 800px;
    text-align: center;
}

.woocommerce-thankyou-order-received {
    color: #60b246;
    font-size: 2rem;
    font-weight: 700;
}

/* Mobile Responsive */
@media (max-width: 991px) {

    .post-type-archive-product .joykas-woo-wrapper,
    .tax-product_cat .joykas-woo-wrapper {
        grid-template-columns: 1fr;
        /* Stack sidebar */
    }

    .joykas-shop-sidebar {
        position: static;
        margin-bottom: 30px;
        order: 0;
        /* Sidebar on top? or bottom? Swiggy keeps pills on top */
    }

    .woocommerce-checkout-review-order {
        width: 100%;
        flex: none;
        position: static;
        order: 2;
    }

    #customer_details {
        order: 1;
    }

    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .woocommerce ul.products {
        grid-template-columns: 1fr !important;
    }

}

/* =============================================
   HEADER CART FIX & QUANTITY STYLING
   ============================================= */

/* Header Cart Badge Fix */
.header-icons .header-cart-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    width: 40px;
    margin-left: 10px;
    color: #333;
    text-decoration: none;
}

.header-icons .header-cart-link i {
    font-size: 22px;
    color: #333;
}

.header-icons .cart-count {
    position: absolute;
    top: -6px;
    right: -8px;
    background-color: #FF324B;
    /* Brand Pink */
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    height: 18px;
    width: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Product Page Quantity Styling */
.woocommerce div.product form.cart .quantity {
    float: none;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-right: 15px;
    position: relative;
    background: #fff;
}

/* Add "Qty" Label inline */
.woocommerce div.product form.cart .quantity::before {
    content: 'Qty';
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-right: 8px;
}

.woocommerce div.product form.cart .quantity input.qty {
    width: 50px;
    height: 46px;
    /* Match standard button height */
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    text-align: center;
    padding: 0;
}

/* Align Add to Cart Button */
.single_add_to_cart_button.button {
    height: 46px;
    padding: 0 30px;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    background-color: #FF324B;
    /* Theme Pink */
    color: white;
    border-radius: 4px;
    border: none;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.single_add_to_cart_button.button:hover {
    background-color: #D0002F;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(255, 50, 75, 0.3);
}

/* SIGNLE PRODUCT PRICE - MAKE IT HUGE */
.woocommerce div.product p.price,
.woocommerce div.product span.price {
    color: #FF324B !important;
    /* Brand Pink for eye-catching */
    font-size: 2.2rem !important;
    /* Very Large */
    font-weight: 800 !important;
    /* Extra Bold */
    margin-bottom: 20px !important;
    display: block;
}

.woocommerce div.product p.price del {
    font-size: 1.2rem !important;
    color: #999 !important;
    font-weight: normal !important;
    opacity: 0.6;
}

.woocommerce div.product p.price ins {
    text-decoration: none;
    font-weight: 800;
}

/* =============================================
   SINGLE PRODUCT IMAGE FIX
   ============================================= */

/* Ensure product gallery is visible */
.woocommerce div.product div.images {
    width: 48% !important;
    float: left !important;
    margin-right: 4% !important;
}

.woocommerce div.product div.images img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Placeholder for products without images */
.woocommerce div.product div.images .woocommerce-product-gallery__wrapper {
    min-height: 300px;
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.woocommerce div.product div.images .woocommerce-product-gallery__image img {
    max-width: 100%;
    height: auto;
}

/* Summary section alignment */
.woocommerce div.product div.summary {
    width: 48% !important;
    float: left !important;
}

/* Clear floats */
.woocommerce div.product::after {
    content: "";
    display: table;
    clear: both;
}

/* Mobile: Stack image and summary */
@media (max-width: 768px) {

    .woocommerce div.product div.images,
    .woocommerce div.product div.summary {
        width: 100% !important;
        float: none !important;
        margin-right: 0 !important;
    }

    .woocommerce div.product div.images {
        margin-bottom: 20px;
    }
}