/**
 * Cart Layout Fix - DLM Conseil E-Formation
 * Makes WooCommerce cart page use full width and prevents layout constraints
 * Version: 3.0 - WooCommerce Standard Structure Fix
 */

/* ==========================================================================
   FULL WIDTH WOOCOMMERCE CART LAYOUT
   ========================================================================== */

/* Remove width constraints from WooCommerce cart container */
body.woocommerce-cart .woocommerce-cart .container {
    max-width: none !important;
    width: 100% !important;
    padding: 0 20px !important;
    margin: 0 !important;
}

/* Ensure main woocommerce-cart wrapper is full width */
.woocommerce-cart {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Make WooCommerce cart content use full width */
.woocommerce-cart .woocommerce {
    width: 100% !important;
    max-width: none !important;
}

/* Make WooCommerce cart form use full width */
.woocommerce-cart-form,
.cart-collaterals,
.woocommerce table.cart,
.woocommerce .cart-collaterals .cart_totals,
.woocommerce .cart-collaterals .cross-sells {
    width: 100% !important;
    max-width: none !important;
}

/* Optimize cart table for full width */
.woocommerce table.cart {
    table-layout: auto !important;
    border-collapse: collapse !important;
}

.woocommerce table.cart td {
    padding: 20px 15px !important;
}

.woocommerce table.cart th {
    padding: 20px 15px !important;
}

/* ==========================================================================
   SITE STRUCTURE PROTECTION - HEADER/FOOTER UNCHANGED
   ========================================================================== */

/* Ensure site wrapper maintains proper structure */
body.woocommerce-cart {
    margin: 0 !important;
    padding: 0 !important;
}

/* Site wrapper should never be affected by cart styling */
body.woocommerce-cart #page {
    width: 100% !important;
    max-width: none !important;
    position: relative !important;
    margin: 0 !important;
}

/* Header protection - maintain theme default layout */
body.woocommerce-cart .site-header {
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    margin: 0 !important;
    padding: 0 !important;
    /* DO NOT override text-align - let theme handle it */
}

/* Header content maintains flexbox layout */
body.woocommerce-cart .header-content {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    /* DO NOT override text-align - let theme handle it */
}

/* Top bar maintains left-right layout */
body.woocommerce-cart .top-bar-content {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    /* DO NOT override text-align - let theme handle it */
}

/* Navigation protection - maintain theme default layout */
body.woocommerce-cart .main-navigation {
    width: auto !important;
    position: relative !important;
    /* DO NOT override text-align - let theme handle it */
}

/* Header actions maintain right alignment */
body.woocommerce-cart .header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
}

/* ==========================================================================
   CART CONTENT LAYOUT OPTIMIZATION
   ========================================================================== */

/* Main cart content area */
body.woocommerce-cart .site-main {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 20px !important;
}

/* Cart form wrapper */
.woocommerce-cart-form {
    margin-bottom: 40px !important;
}

/* Cart collaterals (totals and cross-sells) */
.cart-collaterals {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 40px !important;
    margin-top: 40px !important;
}

.cart-collaterals .cart_totals {
    flex: 1 1 400px !important;
    min-width: 400px !important;
}

.cart-collaterals .cross-sells {
    flex: 1 1 500px !important;
}

/* ==========================================================================
   FOOTER PROTECTION - MAINTAIN THEME DEFAULT LAYOUT
   ========================================================================== */

/* Footer maintains theme default layout */
body.woocommerce-cart .site-footer {
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    margin: 0 !important;
    clear: both !important;
    /* DO NOT override text-align - let theme handle it */
}

/* Footer maintains grid layout */
body.woocommerce-cart .footer-main .row {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2rem !important;
    align-items: start !important;
    /* DO NOT override text-align - let theme handle it */
}

/* Footer sections maintain theme default alignment */
body.woocommerce-cart .footer-section,
body.woocommerce-cart .footer-section h3,
body.woocommerce-cart .footer-section p,
body.woocommerce-cart .footer-section ul,
body.woocommerce-cart .footer-section li {
    /* DO NOT override text-align - let theme handle it */
}

/* ==========================================================================
   RESPONSIVE DESIGN FOR FULL WIDTH
   ========================================================================== */

@media screen and (max-width: 768px) {
    /* Mobile full width adjustments */
    body.woocommerce-cart .woocommerce-cart .container {
        padding: 0 15px !important;
    }

    body.woocommerce-cart .site-main {
        padding: 15px !important;
    }

    .cart-collaterals {
        flex-direction: column !important;
        gap: 20px !important;
    }

    .cart-collaterals .cart_totals,
    .cart-collaterals .cross-sells {
        flex: 1 1 auto !important;
        min-width: auto !important;
    }

    /* Mobile header adjustments */
    body.woocommerce-cart .header-content {
        flex-wrap: wrap !important;
        gap: 1rem !important;
    }

    /* Mobile top bar adjustments */
    body.woocommerce-cart .top-bar-content {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    /* Mobile footer adjustments */
    body.woocommerce-cart .footer-main .row {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
}

/* ==========================================================================
   CART TABLE ENHANCEMENTS FOR FULL WIDTH
   ========================================================================== */

/* Make product images responsive in full width */
.woocommerce table.cart img {
    max-width: 80px !important;
    height: auto !important;
}

/* Optimize product name column */
.woocommerce table.cart .product-name {
    width: auto !important;
    min-width: 200px !important;
}

/* Optimize quantity column */
.woocommerce table.cart .product-quantity {
    width: 120px !important;
}

/* Optimize price columns */
.woocommerce table.cart .product-price,
.woocommerce table.cart .product-subtotal {
    width: 100px !important;
}

/* Remove button column optimization */
.woocommerce table.cart .product-remove {
    width: 50px !important;
}

/* ==========================================================================
   WOOCOMMERCE NOTICES AND BREADCRUMBS
   ========================================================================== */

/* Ensure notices display properly */
.woocommerce-notices-wrapper {
    width: 100% !important;
    margin: 20px auto !important;
}

/* Breadcrumb styling */
.woocommerce-breadcrumb {
    margin: 20px auto !important;
    padding: 0 20px !important;
}
