/* Responsive Cart Styling */

/* Base cart table styling improvements */
.cart-table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th {
    background-color: var(--bg);
    text-align: left;
    padding: 15px 10px;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
}

.cart-table td {
    padding: 15px 10px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

/* Mobile Cart Actions - Fixed bottom bar */
.mobile-cart-actions {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg);
    padding: 12px 15px;
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.mobile-cart-actions.active {
    transform: translateY(0);
}

.mobile-cart-total {
    font-weight: 600;
    font-size: 1.1rem;
}

.mobile-checkout-button {
    padding: 10px 15px;
    min-width: 150px;
}

/* Cart items container for scroll on mobile */
.cart-items-container {
    width: 100%;
    overflow-x: auto;
}

/* Enhanced mobile styling for cart items */
@media (max-width: 767px) {
    /* Add bottom padding to body for fixed mobile cart actions */
    body.cart-page {
        padding-bottom: 70px;
    }
    
    /* Show the mobile cart actions */
    .mobile-cart-actions {
        display: flex;
    }
    
    /* Hide table headers on mobile */
    .cart-table thead {
        display: none;
    }
    
    /* Convert table rows to cards */
    .cart-table, 
    .cart-table tbody, 
    .cart-table tr, 
    .cart-table td {
        display: block;
        width: 100%;
        text-align: right;
    }
    
    .cart-item-row {
        position: relative;
        margin-bottom: 1.5rem;
        padding: 15px;
        background-color: var(--bg-accent);
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }
    
    .cart-table td {
        padding: 8px 0;
        border: none;
    }
    
    /* Add data-label values before cells */
    .cart-table td:before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: var(--text-secondary);
    }
    
    /* Product info styling */
    .cart-table td:first-child {
        padding-top: 0;
    }
    
    .cart-product {
        display: flex;
        text-align: left;
        margin-bottom: 10px;
    }
    
    .cart-product-image {
        width: 70px;
        height: 70px;
    }
    
    .cart-product-details {
        padding-left: 15px;
    }
    
    .cart-product-details h4 {
        margin-top: 0;
        margin-bottom: 5px;
    }
    
    /* Quantity controls */
    .cart-quantity {
        width: 100px;
        display: inline-flex;
        margin: 0;
    }
    
    /* Remove button */
    .cart-remove {
        position: absolute;
        top: 15px;
        right: 15px;
        background-color: rgba(217, 4, 41, 0.1);
        width: 30px;
        height: 30px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }
    
    /* Cart summary responsive layout */
    .cart-summary {
        flex-direction: column;
    }
    
    .cart-actions {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        width: 100%;
        margin-bottom: 20px;
    }
    
    .cart-actions button {
        flex: 1;
        min-width: 140px;
        white-space: nowrap;
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .cart-totals {
        width: 100%;
        border-top: 1px solid var(--border);
        padding-top: 20px;
    }
    
    /* Desktop checkout button - hide on mobile */
    .checkout-button {
        display: none;
    }
}

/* Small mobile screens */
@media (max-width: 380px) {
    .cart-product-image {
        width: 60px;
        height: 60px;
    }
    
    .cart-product-details h4 {
        font-size: 14px;
    }
    
    .cart-product-options {
        font-size: 12px;
    }
    
    .cart-actions {
        flex-direction: column;
    }
    
    .cart-actions button {
        width: 100%;
    }
}

/* iPhone X/notch safe area fix */
@supports (padding: max(0px)) {
    .mobile-cart-actions {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    body.cart-page {
        padding-bottom: max(70px, calc(env(safe-area-inset-bottom) + 70px));
    }
}
