/* ============================================================================
   SPINNER DE CARGA GLOBAL
   ============================================================================ */

/* Overlay del loader - Menos invasivo */
#global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    backdrop-filter: blur(3px);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#global-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Contenedor del spinner - Modal compacto */
.loader-container {
    background: rgba(10, 17, 40, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 350px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Spinner bonito estilo bíblico - Más pequeño */
.bible-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
}

.bible-book {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 45px;
    background: linear-gradient(135deg, #7209B7, #4361EE);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(114, 9, 183, 0.4);
    animation: bookFloat 2s ease-in-out infinite;
}

.bible-book::before {
    content: '✝';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.bible-book::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 15%;
    right: 15%;
    bottom: 10%;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 4px;
}

.bible-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border: 2px solid transparent;
    border-top: 2px solid #4CC9F0;
    border-right: 2px solid #F72585;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.bible-verses {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
}

.verse-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #4CC9F0;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(76, 201, 240, 0.8);
}

.verse-dot:nth-child(1) {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    animation: verseFloat 2s ease-in-out infinite 0s;
}

.verse-dot:nth-child(2) {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    animation: verseFloat 2s ease-in-out infinite 0.5s;
}

.verse-dot:nth-child(3) {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    animation: verseFloat 2s ease-in-out infinite 1s;
}

.verse-dot:nth-child(4) {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    animation: verseFloat 2s ease-in-out infinite 1.5s;
}

/* Animaciones */
@keyframes bookFloat {
    0%, 100% {
        transform: translate(-50%, -50%) translateY(0px) rotateY(0deg);
    }
    50% {
        transform: translate(-50%, -50%) translateY(-10px) rotateY(5deg);
    }
}

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

@keyframes verseFloat {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Spinner con efecto de libro bíblico */
.loader-bible {
    position: relative;
    width: 60px;
    height: 80px;
}

.loader-bible::before,
.loader-bible::after {
    content: '';
    position: absolute;
    width: 50%;
    height: 100%;
    background: white;
    border-radius: 5px;
    animation: flipBook 1.5s ease-in-out infinite;
}

.loader-bible::before {
    left: 0;
    transform-origin: right;
}

.loader-bible::after {
    right: 0;
    transform-origin: left;
    animation-delay: 0.75s;
}

/* Texto de carga - Más compacto */
.loader-text {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.loader-subtext {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-top: 10px;
    text-align: center;
}

/* Versículo motivacional - Oculto en modal compacto */
.loader-verse {
    display: none; /* Ocultar para hacer menos invasivo */
}

.loader-verse-text {
    margin-bottom: 0.5rem;
}

.loader-verse-ref {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Puntos animados */
.loader-dots {
    display: inline-flex;
    gap: 5px;
}

.loader-dots span {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.loader-dots span:nth-child(1) { animation-delay: 0s; }
.loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.loader-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Versículo motivacional */
.loader-verse {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 600px;
    padding: 20px;
    color: white;
    text-align: center;
    font-style: italic;
    opacity: 0.9;
    animation: fadeIn 1s ease-in-out;
}

.loader-verse-text {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 10px;
}

.loader-verse-ref {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.8;
}

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

@keyframes flipBook {
    0%, 100% { transform: perspective(500px) rotateY(0deg); }
    50% { transform: perspective(500px) rotateY(-180deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { 
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to { 
        opacity: 0.9;
        transform: translateX(-50%) translateY(0);
    }
}

/* Progreso de carga */
.loader-progress {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 20px;
}

.loader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0.6));
    border-radius: 10px;
    animation: loadProgress 2s ease-in-out infinite;
}

@keyframes loadProgress {
    0% { 
        width: 0%;
        transform: translateX(0);
    }
    50% { 
        width: 70%;
        transform: translateX(0);
    }
    100% { 
        width: 100%;
        transform: translateX(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .bible-spinner {
        width: 100px;
        height: 100px;
    }
    
    .bible-book {
        width: 60px;
        height: 45px;
    }
    
    .bible-book::before {
        font-size: 1.5rem;
    }
    
    .bible-glow {
        width: 100px;
        height: 100px;
    }
    
    .bible-verses {
        width: 140px;
        height: 140px;
    }
    
    .loader-text {
        font-size: 1.2rem;
    }
    
    .loader-verse {
        max-width: 90%;
        padding: 15px;
        font-size: 0.9rem;
    }
    
    .loader-progress {
        width: 80%;
    }
}

/* Estilo alternativo: Cross (Cruz) */
.loader-cross {
    width: 60px;
    height: 60px;
    position: relative;
}

.loader-cross::before,
.loader-cross::after {
    content: '';
    position: absolute;
    background: white;
    border-radius: 3px;
}

.loader-cross::before {
    width: 10px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
    animation: crossVertical 1.5s ease-in-out infinite;
}

.loader-cross::after {
    width: 100%;
    height: 10px;
    top: 30%;
    animation: crossHorizontal 1.5s ease-in-out infinite;
}

@keyframes crossVertical {
    0%, 100% { opacity: 0.3; transform: translateX(-50%) scaleY(0.5); }
    50% { opacity: 1; transform: translateX(-50%) scaleY(1); }
}

@keyframes crossHorizontal {
    0%, 100% { opacity: 0.3; transform: scaleX(0.5); }
    50% { opacity: 1; transform: scaleX(1); }
}

/* Responsive - Modal compacto */
@media (max-width: 768px) {
    .loader-container {
        padding: 20px;
        max-width: 280px;
        margin: 0 15px;
    }
    
    .bible-spinner {
        width: 70px;
        height: 70px;
    }
    
    .bible-book {
        width: 50px;
        height: 38px;
    }
    
    .bible-book::before {
        font-size: 1.2rem;
    }
    
    .bible-glow {
        width: 70px;
        height: 70px;
    }
    
    .bible-verses {
        width: 100px;
        height: 100px;
    }
    
    .verse-dot {
        width: 5px;
        height: 5px;
    }
    
    .loader-text {
        font-size: 1rem;
    }
}
