/* style.css */
:root {
    --bg-color: #0a0a0a;
    --primary-color: #00ffcc;
    /* Un cian neón muy hacker/IA */
    --text-color: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace;
    /* Fuente de terminal */
    overflow-x: hidden;
}

/* Contenedor del Hero */
.hero {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* El Canvas de fondo */
#neural-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* El contenido central */
.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    pointer-events: auto;
    width: 100%;
    padding: 0 20px;
    /* Evita que el texto toque los bordes en móvil */
    max-width: 800px;
    /* Evita que se estire demasiado en pantallas ultra anchas */
}

h1 {
    /* clamp(MÍNIMO, VALOR PREFERIDO, MÁXIMO) */
    font-size: clamp(1.6rem, 6vw, 3rem);
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
    min-height: 4rem;
    margin-bottom: 1rem;
    word-break: break-word;
    /* Permite partir la palabra si la pantalla es enana */
}

/* Cursor parpadeante para el efecto máquina de escribir */
h1::after {
    content: '_';
    animation: blink 1s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.2rem);
    color: #888;
    margin-bottom: 2rem;
}

/* Botón CTA minimalista */
.cta-button {
    display: inline-block;
    padding: 12px 24px;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    background: transparent;
}

.cta-button:hover {
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: 0 0 15px var(--primary-color);
}

/* Ocultar elementos al principio para mostrarlos con JS */
.fade-in {
    opacity: 0;
    transition: opacity 2s ease-in;
}

/* ==========================================
   ESTILOS DE LA TERMINAL MODAL
   ========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    /* Desenfoque elegante del fondo */
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.terminal-window {
    width: 90%;
    max-width: 700px;
    height: 60vh;
    background-color: #1a1b26;
    /* Fondo oscuro editor */
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 255, 204, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.terminal-header {
    background-color: #24283b;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--primary-color);
}

.terminal-title {
    color: #a9b1d6;
    font-size: 0.9rem;
}

#close-terminal {
    background: transparent;
    border: none;
    color: #f7768e;
    /* Rojo suave */
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2rem;
    transition: transform 0.2s;
}

#close-terminal:hover {
    transform: scale(1.2);
}

.terminal-body {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.5;
}

.terminal-input-line {
    display: flex;
    padding: 0 20px 20px 20px;
    align-items: flex-start;
    /* Mantiene el texto del prompt arriba cuando crece el textarea */
}

#terminal-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    margin-left: 10px;
    resize: none;
    line-height: 1.5;
    min-height: 1.5rem;
    /* Altura base */

    /* --- LA MAGIA DEL SCROLL --- */
    max-height: 150px;
    /* Límite de crecimiento (aprox 6 líneas) */
    overflow-y: auto;
    /* Si supera el límite, añade barra de scroll */
}

/* Opcional: Estilizar la barrita de scroll para que quede hacker */
#terminal-input::-webkit-scrollbar {
    width: 6px;
}

#terminal-input::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 3px;
}

/* Colores de consola */
.cmd-prompt {
    color: var(--primary-color);
}

.cmd-user {
    color: #ffffff;
}

.cmd-system {
    color: #a9b1d6;
}

.cmd-success {
    color: #9ece6a;
}

.cmd-error {
    color: #f7768e;
}

.cmd-ask {
    color: #bb9af7;
}

/* Morado para las preguntas */


/* Reglas especficas para pantallas mviles (menos de 768px de ancho) */
@media (max-width: 768px) {
    h1 {
        min-height: 6rem;
        /* Damos ms espacio por si el texto salta a 2 lneas al escribirse */
    }

    .cta-button {
        padding: 10px 20px;
        font-size: 0.9rem;
        /* Un pelín ms pequeño para que encaje mejor */
    }

    /* Comportamiento del input en móviles */
    .terminal-input-line {
        flex-direction: column;
        /* Apilamos la pregunta arriba y el texto abajo */
        align-items: flex-start;
    }

    #terminal-input {
        margin-left: 0;
        margin-top: 8px;
        /* Pequeño salto de línea desde el prompt */
        width: 100%;
        /* Ahora tienes TODO el ancho del móvil para escribir */
    }
}


/* ==========================================
   NODO DE ACCESO (LOGIN)
   ========================================== */
/* ==========================================
   BOTÓN FLOTANTE Y LOGIN MODAL
   ========================================== */

/* Botón fijado arriba a la derecha */
.floating-login {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 900;
    /* Alto, pero por debajo de las modales */
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    border-radius: 4px;
}

.floating-login:hover {
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.6);
}

/* Ajuste del botón de cerrar dentro del auth-panel */
.close-auth-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #f7768e;
    /* Rojo suave para peligro/cerrar */
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.close-auth-btn:hover {
    transform: scale(1.2);
}

/* En móviles, hacemos el botón flotante un poco más pequeño */
@media (max-width: 768px) {
    .floating-login {
        top: 15px;
        right: 15px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

.auth-panel {
    background: #121212;
    border: 1px solid #333;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Esquinas cibernéticas (Decoración) */
.auth-panel::before,
.auth-panel::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    transition: all 0.3s;
}

.auth-panel::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.auth-panel::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

.auth-panel:hover::before,
.auth-panel:hover::after {
    width: 40px;
    height: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px dashed #333;
    padding-bottom: 15px;
}

.auth-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.auth-header p {
    color: #666;
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-top: 5px;
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    color: #888;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    background: #0a0a0a;
    border: 1px solid #333;
    padding: 12px 15px;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: inset 0 0 5px rgba(0, 255, 204, 0.2);
}

.auth-button {
    width: 100%;
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 15px;
    font-family: inherit;
    font-size: 1rem;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.3s;
}

.auth-button:hover {
    background: var(--primary-color);
    color: #000;
    font-weight: bold;
}

/* ==========================================
   CHECKBOX ESTILO TERMINAL
   ========================================== */
.input-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    cursor: pointer;
}

.input-checkbox input[type="checkbox"] {
    display: none;
    /* Ocultamos el checkbox feo del navegador */
}

.input-checkbox label {
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.3s;
    user-select: none;
}

/* El estado desmarcado [ ] */
.input-checkbox label::before {
    content: '[ ]';
    color: var(--primary-color);
    margin-right: 10px;
    font-family: inherit;
    font-size: 1rem;
    width: 30px;
    display: inline-block;
}

/* El estado marcado [x] */
.input-checkbox input[type="checkbox"]:checked+label::before {
    content: '[x]';
    color: #fff;
    text-shadow: 0 0 5px var(--primary-color);
}

.input-checkbox input[type="checkbox"]:checked+label {
    color: #fff;
}

/* ==========================================
   SISTEMA DE NOTIFICACIONES (TOASTS)
   ========================================== */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    /* Por encima de todo */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cyber-toast {
    background: rgba(10, 10, 10, 0.85);
    border-left: 4px solid #f7768e;
    /* Rojo neón para errores */
    color: #fff;
    padding: 15px 25px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    box-shadow: 0 0 15px rgba(247, 118, 142, 0.3);
    backdrop-filter: blur(5px);

    /* Preparación para la animación */
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    /* Efecto rebote suave */
}

/* Clase que JS añadirá para mostrarlo */
.cyber-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.cyber-toast .toast-title {
    color: #f7768e;
    font-weight: bold;
    margin-bottom: 8px;
    display: block;
    letter-spacing: 1px;
}

/* Variante por si en el futuro quieres mandar mensajes de éxito (color cian) */
.cyber-toast.success {
    border-left-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.3);
}

.cyber-toast.success .toast-title {
    color: var(--primary-color);
}