﻿/* 
 * Archivo: wwwroot/css/loading-screen.css
 * Descripción: Estilos responsive para la pantalla de carga con soporte para temas
 * Compatible con Blazor Bootstrap Theme Switcher
 */

/* ========================================
   Variables CSS para temas
   ======================================== */
:root {
    /* Tema claro (default) */
    --loading-bg-gradient-start: #f0f2f5;
    --loading-bg-gradient-end: #e3e6ea;
    --phone-frame-bg: linear-gradient(145deg, #ffffff, #f0f2f5);
    --phone-frame-border: #dee2e6;
    --phone-screen-bg: #ffffff;
    --phone-components: #6c757d;
    --wave-gradient-start: #0d6efd;
    --wave-gradient-end: #6610f2;
    --particle-color: rgba(13, 110, 253, 0.3);
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --progress-bg: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.15);
}

/* Tema oscuro */
[data-bs-theme="dark"] {
    --loading-bg-gradient-start: #1a1a2e;
    --loading-bg-gradient-end: #0f0f1e;
    --phone-frame-bg: linear-gradient(145deg, #1a202c, #2d3748);
    --phone-frame-border: #2d3748;
    --phone-screen-bg: #000000;
    --phone-components: #4a5568;
    --wave-gradient-start: #667eea;
    --wave-gradient-end: #764ba2;
    --particle-color: rgba(102, 126, 234, 0.5);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --progress-bg: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.6);
}

/* ========================================
   Estilos base
   ======================================== */
#app {
    position: relative;
    width: 100%;
    min-height: 100vh;
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, var(--loading-bg-gradient-start) 0%, var(--loading-bg-gradient-end) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    overflow: hidden;
    transition: background 0.3s ease;
}

/* ========================================
   Partículas animadas
   ======================================== */
.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--particle-color);
    border-radius: 50%;
    animation: float 15s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100vh) translateX(100px);
        opacity: 0;
    }
}

/* ========================================
   Contenedor del teléfono
   ======================================== */
.phone-wrapper {
    position: relative;
    z-index: 10;
    padding: 20px;
}

.phone-container {
    position: relative;
    width: 240px;
    height: 480px;
    transform: perspective(1000px) rotateY(0deg);
    animation: phoneRotate 8s ease-in-out infinite;
}

@keyframes phoneRotate {
    0%, 100% {
        transform: perspective(1000px) rotateY(0deg) scale(1);
    }

    50% {
        transform: perspective(1000px) rotateY(5deg) scale(1.02);
    }
}

/* Marco del teléfono */
.phone-frame {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid var(--phone-frame-border);
    border-radius: 35px;
    background: var(--phone-frame-bg);
    box-shadow: 0 30px 60px var(--shadow-color), inset 0 0 20px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: scale(0.8);
    animation: fadeInScale 0.6s ease-out forwards;
    transition: all 0.3s ease;
}

@keyframes fadeInScale {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Pantalla del teléfono */
.phone-screen {
    position: absolute;
    top: 60px;
    left: 20px;
    right: 20px;
    height: 360px;
    background: var(--phone-screen-bg);
    border-radius: 15px;
    overflow: hidden;
    opacity: 0;
    animation: screenAppear 0.5s ease-out 0.3s forwards;
    transition: background 0.3s ease;
}

@keyframes screenAppear {
    to {
        opacity: 1;
    }
}

/* Efecto de brillo */
.screen-shine {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient( 45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70% );
    animation: shine 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%);
    }

    100% {
        transform: translateX(100%) translateY(100%);
    }
}

/* Componentes del teléfono */
.phone-camera {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 6px;
    background: var(--phone-components);
    border-radius: 3px;
    opacity: 0;
    animation: fadeIn 0.3s ease-out 0.6s forwards;
    transition: background 0.3s ease;
    s ease-out 0.6s forwards;
    transition: background 0.3s ease;
}

.phone-button {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    height: 45px;
    border: 3px solid var(--phone-components);
    border-radius: 50%;
    opacity: 0;
    animation: fadeIn 0.3s ease-out 0.9s forwards;
    transition: border-color 0.3s ease;
}

.side-buttons {
    position: absolute;
    right: -8px;
    top: 120px;
    opacity: 0;
    animation: slideInRight 0.3s ease-out 1.2s forwards;
}

.side-button {
    width: 4px;
    height: 50px;
    background: var(--phone-components);
    margin-bottom: 15px;
    border-radius: 0 2px 2px 0;
    transition: background 0.3s ease;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    to {
        opacity: 1;
        right: -4px;
    }
}

/* ========================================
   Contenido de carga
   ======================================== */
.loading-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Ondas de carga */
.loading-waves {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
}

.wave {
    width: 8px;
    height: 40px;
    background: linear-gradient(180deg, var(--wave-gradient-start), var(--wave-gradient-end));
    border-radius: 4px;
    animation: wave 1.2s ease-in-out infinite;
}

    .wave:nth-child(1) {
        animation-delay: 0s;
    }

    .wave:nth-child(2) {
        animation-delay: 0.1s;
    }

    .wave:nth-child(3) {
        animation-delay: 0.2s;
    }

    .wave:nth-child(4) {
        animation-delay: 0.3s;
    }

    .wave:nth-child(5) {
        animation-delay: 0.4s;
    }

@keyframes wave {
    0%, 100% {
        transform: scaleY(0.5);
        opacity: 0.5;
    }

    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Texto de carga */
.loading-text {
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 1.5s forwards;
    transition: color 0.3s ease;
}

/* Barra de progreso */
.progress-container {
    width: 160px;
    height: 4px;
    background: var(--progress-bg);
    border-radius: 2px;
    margin-top: 20px;
    overflow: hidden;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 1.8s forwards;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--wave-gradient-start), var(--wave-gradient-end));
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

/* Porcentaje */
.loading-percentage {
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    margin-top: 15px;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 2s forwards;
    transition: color 0.3s ease;
}

/* Puntos de componentes */
.component-dots {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.dot {
    width: 8px;
    height: 8px;
    background: var(--particle-color);
    border-radius: 50%;
    animation: dotPulse 1.5s ease-in-out infinite;
}

    .dot:nth-child(1) {
        animation-delay: 0s;
    }

    .dot:nth-child(2) {
        animation-delay: 0.2s;
    }

    .dot:nth-child(3) {
        animation-delay: 0.4s;
    }

@keyframes dotPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.5);
        opacity: 1;
    }
}

/* Texto inferior */
.bottom-text {
    position: absolute;
    bottom: 30px;
    text-align: center;
    color: var(--text-secondary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    animation: fadeIn 1s ease-out 2.5s forwards;
    opacity: 0;
    padding: 0 20px;
    transition: color 0.3s ease;
}

/* ========================================
   Media Queries - Responsive Design
   ======================================== */

/* Tablets y pantallas medianas */
@media (max-width: 768px) {
    .phone-container {
        width: 200px;
        height: 400px;
    }

    .phone-screen {
        top: 50px;
        left: 15px;
        right: 15px;
        height: 300px;
    }

    .loading-waves {
        gap: 6px;
    }

    .wave {
        width: 6px;
        height: 30px;
    }

    .loading-text {
        font-size: 12px;
    }

    .progress-container {
        width: 140px;
    }
}

/* Móviles grandes */
@media (max-width: 576px) {
    .phone-container {
        width: 180px;
        height: 360px;
    }

    .phone-frame {
        border-width: 3px;
        border-radius: 28px;
    }

    .phone-screen {
        top: 45px;
        left: 12px;
        right: 12px;
        height: 270px;
        border-radius: 12px;
    }

    .phone-camera {
        width: 60px;
        height: 4px;
        top: 20px;
    }

    .phone-button {
        width: 35px;
        height: 35px;
        bottom: 15px;
    }

    .side-buttons {
        top: 100px;
    }

    .side-button {
        width: 3px;
        height: 35px;
        margin-bottom: 10px;
    }

    .loading-text {
        font-size: 11px;
        letter-spacing: 1px;
    }

    .progress-container {
        width: 120px;
        height: 3px;
    }

    .component-dots {
        bottom: 60px;
    }
}

/* Móviles pequeños */
@media (max-width: 400px) {
    .phone-container {
        width: 160px;
        height: 320px;
    }

    .phone-screen {
        top: 40px;
        height: 240px;
    }

    .loading-waves {
        gap: 4px;
        margin-bottom: 20px;
    }

    .wave {
        width: 5px;
        height: 25px;
    }

    .bottom-text {
        font-size: 11px;
        bottom: 20px;
    }
}

/* Modo landscape en móviles */
@media (max-height: 500px) and (orientation: landscape) {
    .phone-container {
        width: 140px;
        height: 280px;
    }

    .phone-screen {
        height: 200px;
    }

    .loading-waves {
        margin-bottom: 15px;
    }

    .wave {
        height: 20px;
    }

    .bottom-text {
        display: none;
    }
}

/* Animación de transición suave al cambiar de tema */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
