/* Loading Alerts Enhancement Styles */

/* Custom loading spinner animation */
@keyframes loading-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Enhanced SweetAlert loading styles */
.swal2-container .swal2-popup {
    border-radius: 12px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    transition: background-color 0.3s, color 0.3s !important;
}

.swal2-container .swal2-title {
    font-weight: 600 !important;
    font-size: 1.125rem !important;
}

.swal2-container .swal2-content {
    font-size: 0.875rem !important;
    color: #6b7280 !important;
}

.swal2-container.swal2-backdrop-show {
    backdrop-filter: blur(4px) !important;
}

/* Dark mode enhancements - auto detect */
.dark .swal2-container .swal2-popup {
    background: #111827 !important;
    color: #e5e7eb !important;
}

.dark .swal2-container .swal2-title {
    color: #f3f4f6 !important;
}

.dark .swal2-container .swal2-content,
.dark .swal2-container .swal2-html-container {
    color: #9ca3af !important;
}

.dark .swal2-container .swal2-loader {
    border-color: #60a5fa transparent #60a5fa transparent !important;
}

/* Custom loading spinner */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s ease-in-out infinite;
}

.dark .loading-spinner {
    border-color: #374151;
    border-top-color: #60a5fa;
}

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

/* Loading spinner enhancement */
.swal2-loader {
    border-color: #3b82f6 transparent #3b82f6 transparent !important;
    animation: spin 1s linear infinite !important;
}

/* Toast notifications positioning */
.swal2-toast-container {
    z-index: 9999 !important;
}

/* Filter button loading states */
.filter-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.filter-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: swal2-rotate 1s linear infinite;
}

/* Form loading overlay */
.form-loading {
    position: relative;
    overflow: hidden;
}

.form-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    animation: loading-shimmer 1.5s infinite;
    z-index: 1;
}

@keyframes loading-shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Navigation loading states */
.nav-item.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.nav-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 12px;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border: 1px solid transparent;
    border-top: 1px solid currentColor;
    border-radius: 50%;
    animation: swal2-rotate 1s linear infinite;
}

/* Pagination loading states */
.pagination-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.pagination-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border: 1px solid transparent;
    border-top: 1px solid currentColor;
    border-radius: 50%;
    animation: swal2-rotate 1s linear infinite;
}

/* Export button loading enhancement */
.export-loading {
    background: linear-gradient(45deg, #10b981, #059669) !important;
    position: relative;
    overflow: hidden;
}

.export-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: loading-shimmer 1s infinite;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .swal2-container .swal2-popup {
        width: 90% !important;
        margin: 0 auto !important;
    }
    
    .swal2-container .swal2-title {
        font-size: 1rem !important;
    }
    
    .swal2-container .swal2-content {
        font-size: 0.8rem !important;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .swal2-loader,
    .filter-loading::after,
    .nav-item.loading::after,
    .pagination-loading::after {
        animation: none !important;
    }
    
    .form-loading::before,
    .export-loading::before {
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .swal2-container .swal2-popup {
        border: 2px solid currentColor !important;
    }
    
    .swal2-loader {
        border-color: currentColor transparent currentColor transparent !important;
    }
}