/**
 * HTMX Loading Indicators CSS
 * Global styles for consistent loading state indicators across the application
 */

/* Base HTMX loading indicator styles */
.htmx-indicator {
    opacity: 0;
    display: none;
    transition: opacity 0.2s ease-in-out;
}

/* Show indicators when HTMX request is active */
.htmx-request .htmx-indicator {
    opacity: 1 !important;
    display: inline-block !important;
}

/* Loading spinner animations */
.loading-spinner {
    animation: spin 1s linear infinite;
}

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

/* Size variants for loading indicators */
.htmx-indicator .loading-xs {
    width: 1rem;
    height: 1rem;
}

.htmx-indicator .loading-sm {
    width: 1.25rem;
    height: 1.25rem;
}

.htmx-indicator .loading-md {
    width: 1.5rem;
    height: 1.5rem;
}

.htmx-indicator .loading-lg {
    width: 2rem;
    height: 2rem;
}

/* Button loading state enhancements */
.btn.htmx-request {
    cursor: not-allowed;
    opacity: 0.8;
}

/* Disabled state for form elements during HTMX requests */
.htmx-request input[type="submit"],
.htmx-request button[type="submit"] {
    pointer-events: none;
}

/* Smooth transitions for loading states */
.htmx-indicator,
.htmx-indicator * {
    transition: opacity 0.2s ease-in-out;
}

/* Loading overlay for long operations */
.htmx-loading-overlay {
    position: relative;
}

.htmx-loading-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

.htmx-request.htmx-loading-overlay::after {
    opacity: 1;
    pointer-events: all;
}

/* Custom loading states for specific components */
.tab.htmx-request {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Accessibility improvements */
.htmx-indicator[aria-hidden="true"] {
    visibility: hidden;
}

.htmx-request .htmx-indicator[aria-hidden="true"] {
    visibility: visible;
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
    .htmx-indicator .loading-sm {
        width: 1rem;
        height: 1rem;
    }
    
    .htmx-indicator .loading-md {
        width: 1.25rem;
        height: 1.25rem;
    }
}