/* Sistema de Pantallas de Carga Modernas */

/* Overlay principal */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Container del contenido de carga */
.loading-content {
    background: transparent;
    border-radius: 20px;
    padding: 0;
    text-align: center;
    box-shadow: none;
    max-width: 400px;
    width: 90%;
    transform: scale(0.8);
    transition: transform 0.3s ease-in-out;
}

/* Cuando hay texto, restauramos el fondo para legibilidad */
.loading-overlay.active:has(.loading-text:not([style*="display: none"])) .loading-content {
    background: white;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.loading-overlay.active .loading-content {
    transform: scale(1);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    position: relative;
}

.loading-spinner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Spinner alternativo con puntos */
.loading-dots {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.loading-dots div {
    position: absolute;
    top: 33px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #0d6efd;
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loading-dots div:nth-child(1) {
    left: 8px;
    animation: dots1 0.6s infinite;
}

.loading-dots div:nth-child(2) {
    left: 8px;
    animation: dots2 0.6s infinite;
}

.loading-dots div:nth-child(3) {
    left: 32px;
    animation: dots2 0.6s infinite;
}

.loading-dots div:nth-child(4) {
    left: 56px;
    animation: dots3 0.6s infinite;
}

@keyframes dots1 {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

@keyframes dots3 {
    0% { transform: scale(1); }
    100% { transform: scale(0); }
}

@keyframes dots2 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(24px, 0); }
}

/* Texto de carga */
.loading-text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.loading-subtext {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* Barra de progreso */
.loading-progress {
    width: 100%;
    height: 4px;
    background: #e3e3e3;
    border-radius: 2px;
    margin-top: 20px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: #0d6efd;
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Variantes de color */
.loading-overlay.success .loading-content {
    border-top: 4px solid #28a745;
}

.loading-overlay.success .loading-spinner::before {
    border-top-color: #28a745;
}

.loading-overlay.success .loading-dots div {
    background: #28a745;
}

.loading-overlay.warning .loading-content {
    border-top: 4px solid #ffc107;
}

.loading-overlay.warning .loading-spinner::before {
    border-top-color: #ffc107;
}

.loading-overlay.warning .loading-dots div {
    background: #ffc107;
}

.loading-overlay.error .loading-content {
    border-top: 4px solid #dc3545;
}

.loading-overlay.error .loading-spinner::before {
    border-top-color: #dc3545;
}

.loading-overlay.error .loading-dots div {
    background: #dc3545;
}

/* Responsive */
@media (max-width: 768px) {
    .loading-content {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .loading-text {
        font-size: 16px;
    }
    
    .loading-subtext {
        font-size: 13px;
    }
}

/* Animación de entrada suave */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.loading-overlay.active .loading-content {
    animation: fadeInScale 0.3s ease-out;
}