body {
    background-color: #f8fafc;
    overflow-x: hidden;
    margin: 0;
    /* Importante reset */
}

/* ================= PRELOADER 3D CORREGIDO ================= */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;

    /* IMPORTANTE: Esto crea la profundidad para que el giro se vea 3D real */
    perspective: 1000px;
}

/* --- 1. FONDO NEURONAL (Visible ahora) --- */
.neural-bg-flash {
    position: absolute;
    inset: 0;
    z-index: 1;
    /* Nivel 1: Fondo */
    opacity: 1;
    /* Controlamos la opacidad en los colores del gradiente abajo */

    background-image:
        /* He subido la opacidad de 0.15 a 0.25/0.30 para que SE VEA */
        radial-gradient(circle at 30% 40%, rgba(30, 64, 175, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(59, 130, 246, 0.25) 0%, transparent 50%),
        radial-gradient(circle at center, rgba(30, 64, 175, 0.20) 0%, transparent 70%);

    background-size: 140% 140%;
    animation: neuralPulse 3s ease-in-out infinite alternate;
}

/* --- 2. CONTENEDOR 3D (La moneda que gira) --- */
.spinner-3d-wrapper {
    position: relative;
    z-index: 10;
    /* Nivel 10: Encima del fondo */
    width: 120px;
    height: 120px;

    /* Configuración 3D */
    transform-style: preserve-3d;
    animation: spin3D 3s infinite linear;
    /* Giro infinito */
}

/* --- 3. LA IMAGEN DENTRO (Sin bordes feos) --- */
.spinner-3d-img {
    width: 200%;
    /* ZOOM: Lo agrandamos para ocultar los espacios vacíos del PNG */
    height: 200%;
    object-fit: contain;

    /* Centramos la imagen agrandada */
    position: absolute;
    top: -50%;
    left: -50%;

    /* Filtro opcional: Sombra azul brillante que gira con el logo */
    filter: drop-shadow(0 0 15px rgba(30, 64, 175, 0.4));
}

/* --- ANIMACIONES --- */

/* Giro 3D sobre el eje Y (Como una moneda) */
@keyframes spin3D {
    0% {
        transform: rotateY(0deg);
    }

    100% {
        transform: rotateY(360deg);
    }
}

/* El fondo respira */
@keyframes neuralPulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* --- CHATBOT WIDGET --- */
#chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 50;
    font-family: 'Inter', sans-serif;
}

.chat-trigger {
    width: 60px;
    height: 60px;
    background: #1e40af;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(30, 64, 175, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-trigger:hover {
    transform: scale(1.1);
}

.chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 360px;
    height: 550px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-header {
    background: linear-gradient(135deg, #1e40af, #173289);
    padding: 15px 20px;
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    padding: 10px 14px;
    border-radius: 14px;
    max-width: 85%;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.message.agent {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.message.user {
    background: #1e40af;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    box-shadow: 0 4px 10px rgba(30, 64, 175, 0.2);
}

.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
}

.chat-chip {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-chip:hover {
    background: #1e40af;
    color: white;
    border-color: #1e40af;
}

.chat-footer {
    padding: 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
}

/* --- CHAT OVERLAY --- */
#chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: 49;
    display: none;
}

/* --- OTROS ESTILOS --- */
.glass-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: #1e40af;
    transition: width 0.3s;
}

.nav-link:hover::after {
    width: 100%;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: #1e40af;
}

.badge-wip {
    background-color: #fffbeb;
    color: #b45309;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
    border: 1px solid #fcd34d;
}

.card-disabled {
    background: #fcfcfc;
    border: 1px dashed #cbd5e1;
}

.card-disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: #94a3b8;
}

/* --- ESTILOS PARA LA DEMO DEL CHAT FLOW --- */
.chat-flow-container {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
    background-color: #f3f4f6;
    background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
    background-size: 20px 20px;
}

.chat-flow-messages {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    animation: chatFlowScroll 12s linear infinite;
}

.flow-msg {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    opacity: 0;
    animation: msgAppear 0.5s forwards;
}

.flow-msg.user {
    align-self: flex-end;
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 2px;
}

.flow-msg.bot {
    align-self: flex-start;
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 2px;
}

.flow-msg img {
    max-width: 100%;
    border-radius: 10px;
    margin-top: 5px;
    border: 1px solid #e2e8f0;
}

.flow-msg:nth-child(1) {
    animation-delay: 1s;
}

.flow-msg:nth-child(2) {
    animation-delay: 3s;
}

.flow-msg:nth-child(3) {
    animation-delay: 6s;
}

.flow-msg:nth-child(4) {
    animation-delay: 9s;
}

@keyframes msgAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes chatFlowScroll {
    0% {
        transform: translateY(100%);
    }

    15% {
        transform: translateY(60%);
    }

    35% {
        transform: translateY(30%);
    }

    60% {
        transform: translateY(0%);
    }

    90% {
        transform: translateY(-20%);
    }

    100% {
        transform: translateY(-150%);
    }
}

.typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #a0aec0;
    margin-right: 3px;
    animation: typing 1s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* --- OPCIÓN B: TRUCO DE ZOOM Y RECORTE --- */

/* 1. La "Ventana" redonda y pequeña */
.logo-cropper {
    width: 45px;
    /* Tamaño final que quieres en la web */
    height: 45px;
    overflow: hidden;
    /* Oculta todo lo que se salga del círculo */
    border-radius: 50%;
    /* Lo hace perfectamente redondo */
    background: white;
    /* Fondo blanco para que resalte el azul */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    /* Sombra suave */

    /* Centrado Flex para asegurar que el logo quede al medio */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    /* Evita que se aplaste si falta espacio */
}

/* 2. La Imagen con Zoom (para ocultar el espacio vacío) */
.logo-cropper .nav-logo-3d {
    width: 100%;
    /* AUMENTA este número si aún se ve espacio vacío */
    height: 100%;
    /* "Hacemos zoom" a la imagen */
    max-width: none;
    /* Importante para permitir que crezca más que la caja */
    object-fit: contain;

    /* Mantenemos tu animación original */
    animation: spinY 8s infinite linear;
}

/* Definición de la animación (por si no la tienes arriba) */
@keyframes spinY {
    from {
        transform: rotateY(0deg);
    }

    to {
        transform: rotateY(360deg);
    }
}

/* Estilo del Texto (por si acaso) */
.nav-logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
    text-decoration: none;
    cursor: pointer;
}