/* ========================================
   MODERN CART ANIMATIONS & INTERACTIONS
   ======================================== */

/* Floating Cart Button - Works on both mobile and desktop */
.floating-cart-btn {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-radius: 50%;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(76, 175, 80, 0.4);
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(0);
    opacity: 0;
    /* Same functionality on mobile and desktop */
    touch-action: manipulation;
}

.floating-cart-btn.show {
    transform: scale(1);
    opacity: 1;
}

.floating-cart-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(76, 175, 80, 0.5);
}

.floating-cart-btn i {
    font-size: 24px;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #FF5722;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Modern Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    border-left: 4px solid #4CAF50;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-left-color: #4CAF50;
}

.toast.error {
    border-left-color: #F44336;
}

.toast.info {
    border-left-color: #2196F3;
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
}

.toast.success .toast-icon {
    background: #4CAF50;
}

.toast.error .toast-icon {
    background: #F44336;
}

.toast.info .toast-icon {
    background: #2196F3;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
    font-size: 14px;
}

.toast-message {
    color: #666;
    margin: 0;
    font-size: 13px;
}

.toast-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.toast-close:hover {
    background: #f0f0f0;
}

/* Product to Cart Animation - Works on both mobile and desktop */
.product-to-cart-animation {
    position: fixed;
    pointer-events: none;
    z-index: 10001;
    width: 40px;
    height: 40px;
    background: #4CAF50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    animation: flyToCart 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    /* Same animation on mobile and desktop */
    will-change: transform, opacity;
}

@keyframes flyToCart {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.5) rotate(360deg);
        opacity: 0;
    }
}

/* Modern Cart Drawer */
.cart-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    z-index: 10002;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.cart-drawer.open {
    right: 0;
}

.cart-drawer-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-drawer-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.cart-drawer-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.cart-drawer-close:hover {
    background: #f0f0f0;
}

.cart-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-drawer-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.cart-drawer-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.cart-drawer-total-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.cart-drawer-total-amount {
    font-size: 20px;
    font-weight: 700;
    color: #2E7D32;
}

.cart-drawer-checkout {
    width: 100%;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.cart-drawer-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

/* Cart Drawer Summary */
.cart-drawer-summary {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
    color: #666;
}

.cart-summary-row.total {
    font-weight: 700;
    font-size: 16px;
    color: #333;
    border-top: 1px solid #ddd;
    padding-top: 12px;
    margin-top: 8px;
}

/* Cart Drawer Actions */
.cart-drawer-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.cart-drawer-clear,
.cart-drawer-continue {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-drawer-clear {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.cart-drawer-clear:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.cart-drawer-continue {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.cart-drawer-continue:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Enhanced Cart Drawer Item */
.cart-drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.cart-drawer-item:last-child {
    border-bottom: none;
}

.cart-drawer-item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.cart-drawer-item-details {
    flex: 1;
    min-width: 0;
}

.cart-drawer-item-name {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-drawer-item-sku {
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 4px;
}

.cart-drawer-item-price {
    font-size: 13px;
    color: #059669;
    font-weight: 600;
}

.cart-drawer-item-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.cart-drawer-quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.cart-drawer-quantity-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.cart-drawer-quantity-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: scale(1.05);
}

.cart-drawer-quantity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cart-drawer-quantity-input {
    width: 40px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    background: white;
    color: #333 !important;
    outline: none;
    transition: border-color 0.2s ease;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

/* Remove spinner arrows for webkit browsers */
.cart-drawer-quantity-input::-webkit-outer-spin-button,
.cart-drawer-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Ensure quantity input is always visible - same as main cart */
.cart-drawer-quantity-input {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #333 !important;
    background-color: white !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-align: center !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    padding: 0.25rem !important;
    min-height: 28px !important;
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
}

/* Force visibility for all floating cart quantity inputs */
input[type="number"].cart-drawer-quantity-input {
    color: #333 !important;
    background-color: white !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-align: center !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.cart-drawer-quantity-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.cart-drawer-quantity-display {
    min-width: 20px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.cart-drawer-item-buttons {
    display: flex;
    gap: 4px;
}

.cart-drawer-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cart-drawer-action-btn.btn-wishlist {
    background: #3b82f6;
    color: white;
}

.cart-drawer-action-btn.btn-wishlist:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.cart-drawer-action-btn.btn-remove {
    background: #ef4444;
    color: white;
}

.cart-drawer-action-btn.btn-remove:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.cart-drawer-item-total {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin-top: 4px;
}

.stock-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-top: 2px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border: 1px solid #fbbf24;
}

/* Cart Overlay */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cart-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   MOBILE RESPONSIVE CART STYLES
   ======================================== */

/* Mobile Cart Drawer - Same functionality as desktop */
@media (max-width: 768px) {
    .cart-drawer {
        width: 100vw;
        right: -100vw;
        /* Same animation and functionality as desktop */
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .cart-drawer.open {
        right: 0;
    }
    
    .floating-cart-btn {
        bottom: 120px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
    
    .floating-cart-btn i {
        font-size: 20px;
    }
    
    .cart-badge {
        width: 20px;
        height: 20px;
        font-size: 10px;
        top: -6px;
        right: -6px;
    }
    
    .toast {
        min-width: calc(100vw - 40px);
        margin: 0 20px;
        right: 0;
    }
    
    .toast-container {
        right: 0;
        left: 0;
        top: 80px;
    }
    
    .product-to-cart-animation {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .cart-drawer-header {
        padding: 16px;
    }
    
    .cart-drawer-title {
        font-size: 18px;
    }
    
    .cart-drawer-content {
        padding: 16px;
    }
    
    .cart-drawer-footer {
        padding: 16px;
    }
    
    .cart-drawer-checkout {
        padding: 14px;
        font-size: 16px;
    }

    .cart-drawer-summary {
        padding: 12px 16px;
    }

    .cart-summary-row {
        font-size: 13px;
        padding: 4px 0;
    }

    .cart-summary-row.total {
        font-size: 15px;
    }
}
