/* --- MOTOR 3D BASE --- */
.pfc-3d-active {
    margin: 0;
    /* Permitimos scroll por defecto para evitar bloqueos */
    overflow-y: auto !important; 
    overflow-x: hidden;
}

div[data-pfc3d-scene] {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    outline: none;
}

div[data-pfc3d-scene] canvas {
    display: block;
}

/* --- REGLAS ESPECÍFICAS POR ESCENA --- */

/* 1. LA TIERRA (Inicio) */
/* Usamos una clase que inyectaremos con JS, mucho más seguro que :has() */
body.scene-type-earth-pacamazu {
    background-color: #000000 !important; /* Fondo Negro */
    overflow: hidden !important; /* Bloqueamos scroll SOLO AQUÍ */
}

/* La Tierra va al frente */
body.scene-type-earth-pacamazu div[data-pfc3d-scene] {
    z-index: 9999 !important;
    pointer-events: auto;
    background: black;
}



/* ==========================================================================
   PFC 3D PRELOADER (PANTALLA DE CARGA)
   ========================================================================== */
#pfc-3d-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000000; /* Fondo negro profundo espacial */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999999; /* Por encima de TODO */
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.8s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Spinner estilo Anillo Orbital */
.pfc-orbital-spinner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #2ddc64; /* Verde Pacamazu */
    border-bottom-color: #2980B9; /* Azul Pacamazu */
    animation: pfc-spin 1.5s linear infinite;
    position: relative;
    margin-bottom: 20px;
}

.pfc-orbital-spinner::before {
    content: '';
    position: absolute;
    top: 5px; left: 5px; right: 5px; bottom: 5px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-left-color: #E67E22; /* Naranja */
    animation: pfc-spin-reverse 1s linear infinite;
}

.pfc-loader-text {
    color: #ffffff;
    font-size: 14px;
    letter-spacing: 3px;
    text-transform: uppercase;
    animation: pfc-pulse 2s ease-in-out infinite;
}

/* Animaciones */
@keyframes pfc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes pfc-spin-reverse {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}
@keyframes pfc-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; text-shadow: 0 0 10px rgba(45, 220, 100, 0.5); }
}

/* Clase para ocultarlo suavemente */
#pfc-3d-loader.is-loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}



/* ==========================================================================
   MODO 3D ACTIVO (GLASSMORPHISM Y TRANSPARENCIAS)
   ========================================================================== */

/* 1. Hacemos transparentes los fondos principales para que se vea el Canvas */
body.pfc-mode-3d,
body.pfc-mode-3d #pfc-identity-wrapper,
body.pfc-mode-3d #pfc-docs-wrapper,
body.pfc-mode-3d .pfc-dashboard-main,
body.pfc-mode-3d .pfc-trust-center {
    background: transparent !important;
}

/* 2. El Canvas Global que estará siempre de fondo */
#pfc-global-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1; /* Por debajo de todo */
    pointer-events: none; /* Que no bloquee los clics de la web */
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

/* 3. Tarjetas y Contenedores con efecto "Cristal Esmerilado" (Glassmorphism) */
/* Mantenemos el texto legible sobre tarjetas blancas semitransparentes */
body.pfc-mode-3d .pfc-visual-card,
body.pfc-mode-3d .pfc-step-card,
body.pfc-mode-3d .pfc-trust-content,
body.pfc-mode-3d .pfc-trust-sidebar,
body.pfc-mode-3d .pfc-platform-nav {
    background: rgba(255, 255, 255, 0.75) !important; /* 75% blanco */
    backdrop-filter: blur(12px) !important; /* Desenfoca lo que hay detrás */
    -webkit-backdrop-filter: blur(12px) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1) !important;
}

/* ==========================================================================
   WIDGET FLOTANTE (BOTÓN SWITCH 2D / 3D)
   ========================================================================== */
#pfc-mode-widget {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 999999;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 30px;
    display: flex;
    padding: 5px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

#pfc-mode-widget:hover {
    transform: translateY(-3px);
}

.pfc-mode-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pfc-mode-btn.active {
    background: #2563eb; /* Azul Pacamazu */
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

/* Opciones de escena (Selector de Constelación, Partículas, Fluido) */
#pfc-scene-selector {
    position: fixed;
    bottom: 85px;
    left: 30px;
    z-index: 999998;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px;
    flex-direction: column;
    gap: 5px;
    
    /* Modificado para que esté oculto y aparezca con animación */
    display: none; 
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transform-origin: bottom left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Solo se muestra cuando tiene la clase is-open */
#pfc-scene-selector.is-open {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.pfc-scene-option {
    background: transparent;
    border: none;
    color: #e2e8f0;
    padding: 8px 12px;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
.pfc-scene-option:hover { background: rgba(255,255,255,0.1); }
.pfc-scene-option.active { color: #2ddc64; font-weight: bold; } /* Verde Pacamazu */

/* Ocultar el botón de ajustes en 2D */
#btn-settings-3d { display: none; }
body.pfc-mode-3d #btn-settings-3d { display: flex; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}



/* ==========================================================================
   EXCEPCIONES DE LA PÁGINA PRINCIPAL (TIERRA)
   ========================================================================== */
/* Ocultar el widget 2D/3D y su menú en la escena de la Tierra obligatoriamente */
body.scene-type-earth-pacamazu #pfc-mode-widget,
body.scene-type-earth-pacamazu #pfc-scene-selector {
    display: none !important;
}



