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

.loading-spinner.primary {
    border: 3px solid rgba(13, 110, 253, 0.3);
    border-top-color: #0d6efd;
}

.loading-spinner.success {
    border: 3px solid rgba(25, 135, 84, 0.3);
    border-top-color: #198754;
}

.loading-spinner.warning {
    border: 3px solid rgba(255, 193, 7, 0.3);
    border-top-color: #ffc107;
}

.loading-spinner.danger {
    border: 3px solid rgba(220, 53, 69, 0.3);
    border-top-color: #dc3545;
}

.loading-spinner.dark {
    border: 3px solid rgba(33, 37, 41, 0.3);
    border-top-color: #212529;
}

.loading-spinner.large {
    width: 32px;
    height: 32px;
    border-width: 4px;
}

.loading-spinner.small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

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

/* Button loading states */
.btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn.loading .btn-text {
    opacity: 0.7;
}

/* Form loading overlay */
.form-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 0.375rem;
}

.form-loading-overlay.dark {
    background: rgba(0, 0, 0, 0.1);
}

.form-container {
    position: relative;
}

/* Loading text styles */
.loading-text {
    margin-left: 8px;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Hide elements when loading */
.loading .btn-icon:not(.loading-spinner) {
    display: none;
}

/* Pulse animation for loading buttons */
.btn.loading {
    animation: buttonPulse 2s infinite;
}

@keyframes buttonPulse {
    0% { opacity: 0.8; }
    50% { opacity: 0.6; }
    100% { opacity: 0.8; }
}

/* Loading skeleton for forms */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-skeleton 1.5s infinite;
}

@keyframes loading-skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Disabled state improvements */
.btn:disabled,
.btn.loading {
    cursor: not-allowed;
}

/* Loading for specific components */
.card.loading {
    position: relative;
}

.card.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
    border-radius: inherit;
}

.card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 4px solid rgba(13, 110, 253, 0.3);
    border-radius: 50%;
    border-top-color: #0d6efd;
    animation: spin 1s ease-in-out infinite;
    z-index: 11;
}

/* Loading states for file uploads */
.file-upload-loading {
    position: relative;
    pointer-events: none;
}

.file-upload-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
    border-radius: 0.375rem;
}

.file-upload-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(13, 110, 253, 0.3);
    border-radius: 50%;
    border-top-color: #0d6efd;
    animation: spin 1s ease-in-out infinite;
    z-index: 11;
}

/* Loading for image previews */
.image-preview-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 0.375rem;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .loading-spinner {
        width: 18px;
        height: 18px;
        border-width: 2px;
    }

    .loading-text {
        font-size: 0.8rem;
    }
}