/**
 * Instant Cart CSS
 * Styling for the instant loading cart page
 */

/* Cart Items Styling */
.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cart-item {
    display: grid;
    grid-template-columns: 1fr 1fr auto 120px 60px;
    gap: 20px;
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fafafa;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
    height: fit-content;
}

.cart-item:hover {
    background: #f9f9f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cart-item.updating,
.cart-item.removing {
    opacity: 0.6;
    pointer-events: none;
}

.cart-item.updating::after,
.cart-item.removing::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.cart-item.updating::after {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%233b82f6" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="animate-spin"><path d="M21 12a9 9 0 11-6.219-8.56"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px;
}

/* Item Details */
.item-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0; /* Allow text truncation */
}

.item-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.item-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #1f2937;
    line-height: 1.3;
}

.item-name a {
    color: inherit;
    text-decoration: none;
}

.item-name a:hover {
    color: #3b82f6;
}

.deal-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #dc2626;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.deal-badge i {
    font-size: 10px;
}

.item-price {
    font-size: 14px;
    color: #6b7280;
}

.item-price del {
    color: #9ca3af;
    margin-right: 8px;
}

.item-price ins {
    text-decoration: none;
    font-weight: 600;
    color: #dc2626;
}

/* Quantity Controls */
.item-quantity {
    display: flex;
}

.quantity-controls {
    display: flex;
    align-items: center;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    overflow: hidden;
}

.qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: #f9fafb;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.qty-btn:hover:not(:disabled) {
    background: #f3f4f6;
    color: #374151;
}

.qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.qty-input {
    width: 50px;
    height: 32px;
    border: none;
    text-align: center;
    font-weight: 500;
    background: white;
    color: #1f2937;
    font-size: 14px;
}

.qty-input:focus {
    outline: none;
    background: #f9fafb;
}

/* Item Actions */
.item-actions {
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.remove-item:hover {
    background: #fecaca;
    transform: scale(1.05);
}

/* Summary Styling */
.summary-rows {
    display: flex;
    flex-direction: column;
}

.summary-row.coupon-row {
    color: #059669;
    font-weight: 500;
}

.remove-coupon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 8px;
    padding: 0;
    border: none;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s;
    vertical-align: middle;
}

.remove-coupon-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.remove-coupon-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.summary-divider {
    height: 1px;
    background: #e5e7eb;
}

/* Checkout Actions */
.checkout-actions {
    margin-bottom: 24px;
}

.checkout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s;
}

.checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Coupon Section */
.coupon-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
}

.coupon-section h5 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #374151;
}

.coupon-input-group {
    display: flex;
    gap: 8px;
}

.coupon-input-group input {
    flex: 1;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

.coupon-input-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.apply-coupon-btn {
    padding: 12px 16px;
    white-space: nowrap;
    min-width: 80px;
}

/* Hide WooCommerce default empty cart message when items are present */
.woocommerce .cart-empty {
    display: none !important;
}

/* Cart Actions */
.cart-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.continue-shopping-btn,
.update-cart-btn {
    flex: 1;
    min-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

/* Recommendations */
.recommended-products {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.recommendation-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    transition: all 0.2s;
}

.recommendation-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.recommendation-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.recommendation-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recommendation-details h6 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.recommendation-details h6 a {
    color: #1f2937;
    text-decoration: none;
}

.recommendation-details h6 a:hover {
    color: #3b82f6;
}

.recommendation-details .price {
    font-size: 14px;
    font-weight: 600;
    color: #dc2626;
}

.recommendation-details .btn {
    align-self: flex-start;
    font-size: 12px;
    padding: 6px 12px;
}

/* Notifications */
.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    display: none;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cart-notification.success {
    background: #10b981;
}

.cart-notification.error {
    background: #ef4444;
}

.cart-notification.warning {
    background: #f59e0b;
}

.cart-notification.info {
    background: #3b82f6;
}

.cart-notification i {
    margin-right: 8px;
}

/* Mobile Responsive */
/* Cart Content Wrapper - Two Column Layout */
.cart-content-wrapper {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
    align-items: start;
}

@media (max-width: 768px) {

    .cart-content-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Tablet: Keep 3-column layout but adjust sizes */
    .cart-item {
        grid-template-columns: 100px 1fr auto;
        gap: 5px;
        padding: 5px;
    }

    .item-name {
        font-size: 15px;
    }

    .item-price {
        font-size: 13px;
    }
    
    .item-actions {
        grid-column: 3;
        grid-row: 2;
        justify-self: end;
        margin-top: 10px;
    }

    .continue-shopping-btn,
    .update-cart-btn {
        font-size: 12px;
    }

    .coupon-input-group {
        flex-direction: column;
    }

    .apply-coupon-btn {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 480px) {

    /* Mobile: Clean vertical layout with large image */
    .cart-item {
        grid-template-columns: 100px 1fr;
        gap: 5px;
        padding: 5px;
        position: relative;
    }

    .item-details {
        grid-column: 2;
        grid-row: 1;
    }

    .item-name {
        font-size: 10px;
        line-height: 1.4;
    }

    .item-price {
        font-size: 12px;
    }

    .deal-badge {
        font-size: 9px;
        padding: 2px 5px;
    }

    /* Quantity controls below name/price on second row */
    .quantity-controls {
        width: auto;
        max-width: none;
    }

    .qty-btn {
        width: 36px;
        height: 36px;
    }

    .qty-input {
        width: 50px;
        height: 36px;
        font-size: 15px;
    }

    /* Total price - top right */
    .item-total {
        font-weight: 700;
        color: var(--brand-primary, #0066cc);
    }

    /* Remove button - bottom right */
    .item-actions {
        position: absolute;
        bottom: 16px;
        right: 16px;
    }

    .remove-item {
        width: 32px;
        height: 32px;
    }
}