/* Shopping Cart Styles */

/* Cart Badge */
.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e53e3e;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    line-height: 1;
    z-index: 10;
    animation: cartBounce 0.3s ease;
}

@keyframes cartBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Cart Notification */
.cart-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1000;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease;
}

.notification-content {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-icon {
    width: 24px;
    height: 24px;
    background: #48bb78;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.notification-text {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.notification-close:hover {
    background: var(--gray-100);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Right-side Cart Drawer */
.cart-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.cart-modal.open {
    pointer-events: all;
}

.cart-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-modal.open .cart-backdrop {
    opacity: 1;
}

.cart-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: white;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.cart-modal.open .cart-drawer {
    transform: translateX(0);
}

.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    z-index: 1;
}

.cart-header h2 {
    margin: 0;
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.close-cart {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.close-cart:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.cart-items {
    padding: 0;
}

.cart-item {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    gap: 1rem;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.placeholder-image {
    font-size: 2rem;
    color: var(--text-muted);
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-details h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.item-brand {
    margin: 0 0 0.25rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.item-variant {
    margin: 0 0 0.25rem 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.item-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.item-price {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.item-total {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
}

.cart-item-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.quantity-controls {
    display: flex;
    align-items: center;
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-size: 1rem;
}

.qty-btn:hover {
    background: var(--accent);
    color: white;
}

.qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-display {
    min-width: 24px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0 4px;
}

.cart-quantity-input {
    width: 50px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.cart-quantity-input:focus {
    outline: none;
}

.remove-item {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
    padding: 2px 4px;
}

.remove-item:hover {
    color: #e53e3e;
}

.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    background: white;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.total-label {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.total-amount {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

.tax-note {
    margin: 0 0 1.5rem 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.checkout-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: 2px solid var(--primary);
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.checkout-btn:hover {
    background: var(--secondary);
    border-color: var(--secondary);
}

/* Empty Cart */
.empty-cart {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.empty-cart-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

.empty-cart h3 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-primary);
}

.empty-cart p {
    margin: 0 0 2rem 0;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .cart-drawer {
        width: 100vw;
    }
    
    .cart-item {
        padding: 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .cart-item-image {
        width: 60px;
        height: 60px;
        align-self: flex-start;
    }
    
    .cart-item-controls {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .cart-header {
        padding: 1rem 1.5rem;
    }
    
    .cart-header h2 {
        font-size: 1.125rem;
    }
    
    .cart-footer {
        padding: 1rem 1.5rem;
    }
    
    .total-amount {
        font-size: 1.125rem;
    }
    
    .cart-notification {
        right: 10px;
        left: 10px;
        top: 80px;
        width: auto;
    }
    
    .notification-content {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    
    .notification-text {
        font-size: 0.875rem;
    }
    
    .quantity-controls {
        padding: 0.125rem;
    }
    
    .qty-btn {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }
    
    .cart-quantity-input {
        width: 40px;
        font-size: 0.85rem;
    }
}

/* Loading states */
.cart-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.cart-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.cart-loading::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

/* Error states */
.cart-error {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 2rem;
    text-align: center;
}

/* Success states */
.cart-success {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #38a169;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 2rem;
    text-align: center;
}

/* Accessibility improvements */
.cart-modal-content:focus {
    outline: none;
}

.qty-btn:focus,
.remove-item:focus,
.close-cart:focus,
.checkout-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .cart-badge {
        border: 2px solid white;
    }
    
    .cart-item {
        border-bottom-width: 2px;
    }
    
    .quantity-controls {
        border-width: 2px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cart-notification,
    .cart-modal,
    .cart-drawer,
    .cart-backdrop,
    .cartBounce {
        animation: none;
        transition: none;
    }
    
    .cart-loading::after {
        animation: none;
        border: 2px solid var(--accent);
    }
    
    .qty-btn,
    .remove-item,
    .close-cart,
    .checkout-btn {
        transition: none;
    }
}

/* Print styles */
@media print {
    .cart-modal,
    .cart-notification,
    .cart-badge {
        display: none;
    }
}