/**
 * Elephu Cart - Custom Cart Styles
 * Modern, responsive cart page styling
 */

/* Cart Container */
.elephu-cart-container {
    background: #f8f9fa;
    min-height: 100vh;
}

/* Empty Cart State */
.empty-cart-state {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

/* Cart Item Cards */
.cart-item-card {
    transition: all 0.3s ease;
    position: relative;
}

.cart-item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Product Image Responsive */
.cart-item-card img {
    width: 80px !important;
    height: 80px !important;
    object-fit: cover !important;
    border-radius: 0.5rem !important;
}

@media (max-width: 768px) {
    .cart-item-card img {
        width: 60px !important;
        height: 60px !important;
    }
}

/* Quantity Controls */
.quantity-controls {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.quantity-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    cursor: pointer;
    min-width: 32px;
    min-height: 32px;
    position: relative;
    z-index: 1;
}

.quantity-btn:hover:not(:disabled) {
    background: #f3f4f6;
}

.quantity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Specific styles for quantity increase button */
.quantity-increase {
    pointer-events: auto;
    user-select: none;
}

.quantity-increase:hover {
    background: #f3f4f6 !important;
    transform: scale(1.05);
}

.quantity-increase:active {
    transform: scale(0.95);
}

/* Ensure SVG is clickable */
.quantity-btn svg {
    pointer-events: none;
    user-select: none;
}

.quantity-input {
    border: none;
    outline: none;
    background: transparent;
    text-align: center;
    font-weight: 600;
    color: #374151;
}

.quantity-input:focus {
    box-shadow: none;
}

/* Remove Button */
.remove-item-btn {
    transition: all 0.2s ease;
    border-radius: 0.5rem;
}

.remove-item-btn:hover {
    background: #fef2f2;
    transform: scale(1.1);
}

/* Coupon Section */
.coupon-section input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Cart Totals */
.cart-totals-container {
    position: sticky;
    top: 2rem;
}

/* Loading Overlay */
#cart-loading-overlay {
    backdrop-filter: blur(2px);
}

/* Notifications */
.cart-notification {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .elephu-cart-container {
        padding: 0;
    }
    
    .max-w-6xl {
        max-width: 100%;
        padding: 0 0.5rem;
    }
    
    /* Cart Items on Mobile */
    .cart-item-card {
        padding: 0.75rem;
    }
    
    .cart-item-card .flex {
        flex-direction: row;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .cart-item-card .flex-shrink-0 {
        flex-shrink: 0;
    }
    
    .cart-item-card .flex-1 {
        width: 100%;
        min-width: 0;
    }
    
    .cart-item-card .flex-1 .flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .cart-item-card .flex-1 .flex .flex-1 {
        width: 100%;
    }
    
    /* Product Name on Mobile */
    .cart-item-card h3 {
        font-size: 0.875rem;
        line-height: 1.25;
        margin-bottom: 0.25rem;
    }
    
    /* Product Price on Mobile */
    .cart-item-card .text-lg {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    /* Quantity Controls on Mobile */
    .quantity-controls {
        width: auto;
        justify-content: center;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
    }
    
    .quantity-input {
        width: 2.5rem;
        min-width: 2.5rem;
        font-size: 0.75rem;
        order: 2;
    }
    
    .quantity-btn {
        padding: 0.25rem;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .quantity-decrease {
        order: 1;
    }
    
    .quantity-increase {
        order: 3;
    }
    
    .quantity-btn svg {
        width: 0.75rem;
        height: 0.75rem;
    }
    
    /* Remove Button on Mobile */
    .remove-item-btn {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.25rem;
    }
    
    .remove-item-btn svg {
        width: 1rem;
        height: 1rem;
    }
    
    /* Coupon Section on Mobile */
    .coupon-section {
        width: 100%;
    }
    
    .coupon-section .flex {
        flex-direction: row;
        width: 100%;
        gap: 0.5rem;
    }
    
    .coupon-section input {
        flex: 1;
        font-size: 0.75rem;
        padding: 0.375rem;
    }
    
    .coupon-section button {
        flex-shrink: 0;
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
    
    /* Cart Actions on Mobile */
    .flex.flex-col.sm\\:flex-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    /* Update Button on Mobile */
    #update-cart-btn {
        width: 100%;
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    /* Cart Totals on Mobile */
    .lg\\:col-span-1 {
        position: static;
        margin-top: 1.5rem;
    }
    
    .cart-totals-container {
        position: static;
    }
    
    /* Checkout Button on Mobile */
    .proceed-checkout-btn {
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }
}

/* Tablet Responsive */
@media (min-width: 769px) and (max-width: 1023px) {
    .max-w-6xl {
        max-width: 100%;
        padding: 0 2rem;
    }
    
    .grid.grid-cols-1.lg\\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .lg\\:col-span-2 {
        grid-column: span 1;
    }
    
    .lg\\:col-span-1 {
        grid-column: span 1;
    }
}

/* Desktop Responsive */
@media (min-width: 1024px) {
    .grid.grid-cols-1.lg\\:grid-cols-3 {
        grid-template-columns: 2fr 1fr;
    }
    
    .lg\\:col-span-2 {
        grid-column: span 1;
    }
    
    .lg\\:col-span-1 {
        grid-column: span 1;
    }
}

/* Animation for cart updates */
.cart-item-updating {
    opacity: 0.7;
    transform: scale(0.98);
    pointer-events: none;
}

.cart-item-removing {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(-100%);
    }
}

/* Button Styles */
.btn-primary {
    background: #3b82f6;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #6b7280;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

/* Proceed to Checkout Button */
.proceed-checkout-btn {
    background: #3b82f6;
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 1.125rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
    text-align: center;
    width: 100%;
}

.proceed-checkout-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
    color: white;
    text-decoration: none;
}

/* Cart Totals Styling */
.cart_totals {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

/* Hide default WooCommerce checkout button to prevent duplication */
.cart_totals .wc-proceed-to-checkout,
.cart_totals .proceed-to-checkout,
.cart_totals .checkout-button,
.cart_totals .wc-forward,
.cart_totals a[href*="checkout"],
.cart_totals .button.checkout,
.cart_totals .checkout {
    display: none !important;
}

.cart_totals h2 {
    background: #f9fafb;
    padding: 1rem 1.5rem;
    margin: 0;
    border-bottom: 1px solid #e5e7eb;
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.cart_totals .shop_table {
    margin: 0;
    border: none;
}

.cart_totals .shop_table th,
.cart_totals .shop_table td {
    padding: 0.75rem 1.5rem;
    border: none;
    border-bottom: 1px solid #f3f4f6;
}

.cart_totals .shop_table tr:last-child th,
.cart_totals .shop_table tr:last-child td {
    border-bottom: none;
}

.cart_totals .shop_table .order-total {
    background: #f9fafb;
    font-weight: 700;
    font-size: 1.125rem;
}

.cart_totals .shop_table .order-total th,
.cart_totals .shop_table .order-total td {
    padding: 1rem 1.5rem;
}

/* Coupon Message */
#coupon-message {
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

#coupon-message.text-green-600 {
    color: #059669;
}

#coupon-message.text-red-600 {
    color: #dc2626;
}

#coupon-message.text-blue-600 {
    color: #2563eb;
}
