/* Loading states */
.loading-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-left: 8px;
}

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

.button-loading .loading-spinner {
    display: inline-block;
}

.button-loading {
    pointer-events: none;
    opacity: 0.8;
}

/* Cart Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.cart-item {
    animation: slideIn 0.3s ease-out forwards;
}

.modal {
    animation: fadeIn 0.2s ease-out forwards;
}

.modal-content {
    animation: scaleIn 0.3s ease-out forwards;
}

/* Cart actions feedback */
@keyframes addedToCart {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.count-badge.updating {
    animation: addedToCart 0.3s ease-out;
}

.action-error {
    animation: shake 0.3s ease-in-out;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.toast {
    background: var(--white);
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    max-width: 300px;
}

.toast.success {
    border-left: 4px solid var(--primary-color);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast i {
    font-size: 18px;
}

.toast.success i {
    color: var(--primary-color);
}

.toast.error i {
    color: var(--danger);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Loading States and Visual Feedback */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--card-bg-overlay, rgba(255, 255, 255, 0.8));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--primary-900);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

/* Input Loading States */
.input-loading {
    background-image: linear-gradient(90deg, 
        var(--surface-light, rgba(0,0,0,0.04)) 0px, 
        var(--white) 40px, 
        var(--surface-light, rgba(0,0,0,0.04)) 80px
    );
    background-size: 600px;
    animation: shine 1.6s infinite linear;
}

@keyframes shine {
    0% { background-position: -100px; }
    100% { background-position: 140px; }
}

/* Disabled State */
.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Active/Processing State */
.processing {
    position: relative;
    pointer-events: none;
}

.processing::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--accent-color),
        transparent
    );
    animation: processing 1.5s ease infinite;
}

/* Empty states */
.empty-cart {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

.empty-cart i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-cart p {
    margin-bottom: 20px;
}

.continue-shopping {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.continue-shopping:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
}