/**
 * Modern Cart Styles - DLM Conseil E-Formation
 * Enhanced cart page styling for better user experience
 * Version: 2024.1
 */

/* ==========================================================================
   LAYOUT FIXES - Prevent cart styling from affecting header/footer
   ========================================================================== */

/* Ensure site structure remains intact */
body.woocommerce-cart,
body.page-template-page-panier {
    text-align: left; /* Override any global centering */
}

/* Header and footer should never be centered */
body.woocommerce-cart .site-header,
body.woocommerce-cart .site-footer,
body.page-template-page-panier .site-header,
body.page-template-page-panier .site-footer {
    text-align: left !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
}

/* Main content area should be properly contained */
body.woocommerce-cart .site-main,
body.page-template-page-panier .site-main {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    text-align: left;
}

/* Navigation should remain normal */
body.woocommerce-cart .main-navigation,
body.page-template-page-panier .main-navigation {
    text-align: left !important;
}

/* ==========================================================================
   CART SPECIFIC LAYOUT
   ========================================================================== */

/* Modern Cart Layout - Full Width */
.woocommerce-cart {
    width: 100%;
    margin: 0;
    padding: 2rem;
    text-align: left; /* Ensure cart content is left-aligned by default */
}

.woocommerce-cart-form {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-bottom: 2rem;
}

/* Cart Table Styling */
.woocommerce table.cart {
    border: none;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.woocommerce table.cart thead {
    background: linear-gradient(135deg, #9e3235 0%, #c41e3a 100%);
}

.woocommerce table.cart thead th {
    color: #ffffff !important;
    font-weight: 600;
    padding: 1.25rem 1rem;
    border: none;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.woocommerce table.cart tbody td {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.woocommerce table.cart tbody tr {
    transition: background-color 0.3s ease;
}

.woocommerce table.cart tbody tr:hover {
    background-color: #f8f9fa;
}

/* Product Image */
.woocommerce table.cart img {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.woocommerce table.cart img:hover {
    transform: scale(1.05);
}

/* Product Name */
.woocommerce table.cart .product-name a {
    color: #2c3e50;
    font-weight: 600;
    text-decoration: none;
    font-size: 1.125rem;
    transition: color 0.3s ease;
}

.woocommerce table.cart .product-name a:hover {
    color: #9e3235;
}

/* Price Styling */
.woocommerce table.cart .product-price .amount,
.woocommerce table.cart .product-subtotal .amount {
    color: #9e3235;
    font-weight: 700;
    font-size: 1.25rem;
}

/* Quantity Input */
.woocommerce table.cart .quantity input.qty {
    width: 80px;
    height: 45px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.woocommerce table.cart .quantity input.qty:focus {
    border-color: #9e3235;
    box-shadow: 0 0 0 3px rgba(158, 50, 53, 0.1);
    outline: none;
}

/* Update Cart Button */
.woocommerce table.cart .actions .button {
    background: linear-gradient(135deg, #9e3235 0%, #c41e3a 100%);
    color: #ffffff;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.woocommerce table.cart .actions .button:hover {
    background: linear-gradient(135deg, #c41e3a 0%, #9e3235 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(158, 50, 53, 0.3);
}

/* Remove Item Link */
.woocommerce table.cart .product-remove a {
    background: #dc3545;
    color: #ffffff !important;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
}

.woocommerce table.cart .product-remove a:hover {
    background: #c82333;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Cart Collaterals */
.cart-collaterals {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
}

.cart_totals {
    background: #ffffff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e1e5e9;
}

.cart_totals h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    border-bottom: 2px solid #9e3235;
    padding-bottom: 0.5rem;
}

.cart_totals table {
    border: none;
}

.cart_totals th,
.cart_totals td {
    padding: 0.875rem 0;
    border: none;
    border-bottom: 1px solid #f0f0f0;
}

.cart_totals th {
    font-weight: 600;
    color: #2c3e50;
}

.cart_totals .order-total th,
.cart_totals .order-total td {
    font-size: 1.25rem;
    font-weight: 700;
    color: #9e3235;
    border-bottom: 2px solid #9e3235;
    padding-top: 1.25rem;
}

/* Proceed to Checkout Button */
.wc-proceed-to-checkout .checkout-button {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #ffffff;
    border: none;
    padding: 1.25rem 3rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.125rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.wc-proceed-to-checkout .checkout-button:hover {
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}

/* Empty Cart Message */
.woocommerce .cart-empty {
    text-align: center;
    padding: 4rem 2rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.woocommerce .cart-empty p {
    font-size: 1.25rem;
    color: #6c757d;
    margin-bottom: 2rem;
}

.woocommerce .return-to-shop .button {
    background: linear-gradient(135deg, #9e3235 0%, #c41e3a 100%);
    color: #ffffff;
    padding: 1rem 2.5rem;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.woocommerce .return-to-shop .button:hover {
    background: linear-gradient(135deg, #c41e3a 0%, #9e3235 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(158, 50, 53, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .woocommerce-cart {
        padding: 1rem;
    }

    .woocommerce-cart-form {
        padding: 1rem;
    }

    .woocommerce table.cart {
        font-size: 0.875rem;
    }

    .woocommerce table.cart .product-name a {
        font-size: 1rem;
    }

    .woocommerce table.cart .product-price .amount,
    .woocommerce table.cart .product-subtotal .amount {
        font-size: 1rem;
    }

    .cart_totals {
        padding: 1rem;
    }

    .wc-proceed-to-checkout .checkout-button {
        padding: 1rem 2rem;
        font-size: 1rem;
    }
}

/* Loading States */
.cart-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.cart-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    border-top: 4px solid #9e3235;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   MOBILE RESPONSIVENESS - Ensure proper layout on all devices
   ========================================================================== */

@media (max-width: 768px) {
    /* Ensure header/footer stay normal on mobile */
    body.woocommerce-cart .site-header,
    body.woocommerce-cart .site-footer {
        text-align: center !important; /* Mobile headers can be centered */
    }

    /* But navigation should stay functional */
    body.woocommerce-cart .main-navigation {
        text-align: left !important;
    }
}

/* ==========================================================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================================================== */

.woocommerce table.cart .product-remove a:focus,
.woocommerce table.cart .actions .button:focus,
.wc-proceed-to-checkout .checkout-button:focus {
    outline: 2px solid #9e3235;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .woocommerce table.cart .product-remove,
    .woocommerce table.cart .actions,
    .wc-proceed-to-checkout {
        display: none;
    }

    .woocommerce-cart-form,
    .cart_totals {
        box-shadow: none;
        border: 1px solid #000;
    }
}
