/*
 * Last update: 2025-01-27 12:00:00
 * Author: GaryH
 * Related: tpl_shopping_cart_default.php, templatecss.css
 * Summary: Modern, responsive shopping cart optimization
 */

/* MODERN SHOPPING CART STYLES */

/* Cart Container */
.modern-cart-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
}

/* Cart Header */
.cart-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cart-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.cart-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    color: #333;
}

.cart-title i {
    color: #007bff;
    font-size: 24px;
}

.cart-count {
    background: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    margin-left: 10px;
}

.continue-shopping-btn {
    background: #28a745;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.continue-shopping-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40,167,69,0.3);
    color: white;
    text-decoration: none;
}

/* Cart Messages */
.cart-messages {
    margin-bottom: 20px;
}

.cart-messages .alert {
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

/* Enhanced Table Styling */
.table-responsive {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

#cartContentsDisplay {
    margin: 0;
    border: none;
}

#cartContentsDisplay th {
    background: linear-gradient(135deg, #343a40, #495057);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    padding: 18px 15px;
    border: none;
}

#cartContentsDisplay td {
    padding: 20px 15px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
}

#cartContentsDisplay tr:last-child td {
    border-bottom: none;
}

#cartContentsDisplay tr:hover {
    background: #f8f9fa;
}

/* Product Display */
.cartProductDisplay {
    display: flex;
    align-items: center;
    gap: 15px;
}

#cartImage img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#product_name a {
    font-weight: 600;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    line-height: 1.4;
}

#product_name a:hover {
    color: #007bff;
    text-decoration: underline;
}

.alert-text {
    background: #dc3545;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
    display: inline-block;
}

.cartAttribsList {
    margin-top: 10px;
}

.cartAttribsList ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cartAttribsList li {
    background: #f8f9fa;
    padding: 6px 10px;
    margin: 4px 0;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
}

/* Price Display */
.cartUnitDisplay, .cartTotalDisplay {
    font-weight: 600;
    font-size: 16px;
    color: #28a745;
}

/* Quantity Controls */
.cartQuantity {
    text-align: center;
}

.cartQuantity input[type="text"] {
    width: 60px;
    padding: 8px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    transition: border-color 0.3s ease;
}

.cartQuantity input[type="text"]:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

/* Action Buttons */
.update-btn, .delete-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.update-btn {
    background: #17a2b8;
    color: white;
}

.update-btn:hover {
    background: #138496;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(23,162,184,0.3);
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.delete-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220,53,69,0.3);
    color: white;
    text-decoration: none;
}

/* Cart Summary */
.cart-summary {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
}

.cart-summary-content {
    padding: 25px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-row.subtotal {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    background: linear-gradient(135deg, #28a745, #20c997);
    margin: -25px -25px 20px -25px;
    padding: 20px 25px;
    color: white;
}

.summary-label {
    font-weight: 600;
}

.summary-value {
    font-weight: 700;
}

.summary-additional {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

/* Legacy Cart Subtotal - Keep for compatibility */
#cartSubTotal {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: 12px;
    text-align: right;
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Cart Buttons Container */
.cart-buttons-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 30px;
}

.cart-button-group, .cart-checkout-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.checkout-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 25px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(40,167,69,0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkout-btn:hover {
    background: linear-gradient(135deg, #218838, #1ea080);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40,167,69,0.4);
    color: white;
    text-decoration: none;
}

.checkout-btn i {
    font-size: 20px;
}

/* Empty Cart Styling */
#cartEmptyText {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    color: #666;
    font-size: 24px;
    margin-bottom: 30px;
}

/* MOBILE RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .modern-cart-container {
        padding: 15px;
    }
    
    .cart-header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .cart-title {
        font-size: 24px;
        flex-direction: column;
        gap: 8px;
    }
    
    .cart-count {
        margin-left: 0;
    }
    
    /* Mobile Table - Stack Layout */
    .table-responsive {
        overflow-x: auto;
    }
    
    #cartContentsDisplay {
        min-width: 600px;
    }
    
    #cartContentsDisplay th,
    #cartContentsDisplay td {
        padding: 12px 8px;
        font-size: 14px;
    }
    
    .cartProductDisplay {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    #cartImage img {
        width: 60px;
        height: 60px;
    }
    
    .cart-buttons-container {
        flex-direction: column;
        text-align: center;
    }
    
    .cart-button-group,
    .cart-checkout-group {
        justify-content: center;
        width: 100%;
    }
    
    .checkout-btn {
        width: 100%;
        justify-content: center;
        padding: 18px;
    }
    
    #cartSubTotal {
        text-align: center;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .cart-title {
        font-size: 20px;
    }
    
    .continue-shopping-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Ultra-mobile: Card-based layout */
    #cartContentsDisplay,
    .table-responsive {
        display: none;
    }
    
    .cart-items-mobile {
        display: block;
    }
}

/* Card-based mobile layout */
.cart-items-mobile {
    display: none;
}

@media (max-width: 480px) {
    .cart-items-mobile {
        display: block;
    }
    
    .cart-item-mobile {
        background: white;
        border-radius: 12px;
        padding: 20px;
        margin-bottom: 20px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    
    .cart-item-mobile-header {
        display: flex;
        gap: 15px;
        margin-bottom: 15px;
    }
    
    .cart-item-mobile-image img {
        width: 80px;
        height: 80px;
        object-fit: cover;
        border-radius: 8px;
    }
    
    .cart-item-mobile-info h3 {
        margin: 0 0 10px 0;
        font-size: 16px;
        font-weight: 600;
    }
    
    .cart-item-mobile-details {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        margin-bottom: 15px;
    }
    
    .cart-item-mobile-detail {
        text-align: center;
    }
    
    .cart-item-mobile-detail label {
        display: block;
        font-size: 12px;
        color: #666;
        margin-bottom: 5px;
        text-transform: uppercase;
        font-weight: 600;
    }
    
    .cart-item-mobile-detail .value {
        font-size: 16px;
        font-weight: 600;
        color: #333;
    }
    
    .cart-item-mobile-actions {
        display: flex;
        gap: 10px;
        justify-content: center;
    }
}

/* Animation and Transitions */
.cart-item-mobile,
#cartContentsDisplay tr,
.cart-buttons-container {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading States */
.cart-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.cart-loading i {
    font-size: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Success/Error States */
.cart-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.cart-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}
