/**
 * Custom Styles & Animations
 * 
 * Enhanced UX for cart operations and options modal
 */

/* ========================================
   Button Success Flash Animation
   ======================================== */

.btn-success-flash {
    animation: successFlash 0.6s ease;
}

@keyframes successFlash {
    0%, 100% { 
        background-color: inherit; 
        color: inherit;
        transform: scale(1);
    }
    50% { 
        background-color: #28a745; 
        color: white;
        transform: scale(1.05);
        box-shadow: 0 0 0.9375rem rgba(40, 167, 69, 0.5);
    }
}

/* ========================================
   Cart Badge Pulse Animation
   ======================================== */

.cart-badge-pulse {
    animation: badgePulse 0.5s ease;
}

@keyframes badgePulse {
    0%, 100% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.4);
        box-shadow: 0 0 0.625rem rgba(220, 53, 69, 0.5);
    }
}

/* ========================================
   Smooth Cart Item Remove Animation
   ======================================== */

.cart-item-removing {
    animation: fadeOutSlideUp 0.1s ease forwards;
}

@keyframes fadeOutSlideUp {
    to {
        opacity: 0;
        transform: translateY(-1.25rem);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 0;
        border: none;
    }
}

/* ========================================
   Quantity Selector Styling
   ======================================== */

.quantity-selector {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-selector .btn {
    width: 2rem;
    height: 2rem;
    padding: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   Options Modal Enhancements
   ======================================== */

.option-group {
    transition: all 0.3s ease;
}

/* ========================================
   Form Check Enhancements
   ======================================== */

.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check-label {
    cursor: pointer;
    user-select: none;
}

/* ========================================
   Options Modal Layout
   ======================================== */

#optionsContainer {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.625rem;
}

#optionsContainer::-webkit-scrollbar {
    width: 0.5rem;
}

#optionsContainer::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0.25rem;
}

#optionsContainer::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 0.25rem;
}

#optionsContainer::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================
   Mobile Responsive Adjustments
   ======================================== */

@media (max-width: 48rem) {
    .quantity-selector {
        gap: 0.25rem;
    }
    
    .quantity-selector .btn {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.875rem;
    }
    
    #optionsContainer {
        max-height: 50vh;
    }
}

/* ========================================
   Loading States
   ======================================== */

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 0.125rem solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

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

/* ========================================
   SweetAlert2 Custom Theme
   ======================================== */

.swal2-popup {
    font-family: inherit;
}

.swal2-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.swal2-html-container {
    font-size: 1rem;
}

/* ========================================
   Utility Classes
   ======================================== */

.text-decoration-line-through {
    text-decoration: line-through;
}
