*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    /* Prevenir FOUC */
    visibility: hidden;
}

html.css-loaded {
    visibility: visible;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #f9f9ff;
    background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.4), rgba(15, 23, 42, 0.98));
    overflow-x: hidden;
    position: relative;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Ocultar contenido inicialmente hasta que el intro termine */
body.intro-loading:not(.content-visible) .navbar,
body.intro-loading:not(.content-visible) .hero,
body.intro-loading:not(.content-visible) .section,
body.intro-loading:not(.content-visible) .footer,
body.intro-loading:not(.content-visible) .page-gradient {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0s !important;
    visibility: hidden !important;
}

/* Forzar mostrar contenido cuando se marca como visible */
body.content-visible .navbar,
body.content-visible .hero,
body.content-visible .section,
body.content-visible .footer,
body.content-visible .page-gradient {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: block !important;
}

/* Asegurar que el body sea visible cuando el contenido está visible */
body.content-visible {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Si no tiene intro-loading, mostrar contenido siempre */
body:not(.intro-loading) .navbar,
body:not(.intro-loading) .hero,
body:not(.intro-loading) .section,
body:not(.intro-loading) .footer,
body:not(.intro-loading) .page-gradient {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* El theme-toggle y chat-toggle deben estar siempre disponibles */
body.intro-loading .theme-toggle,
body.intro-loading .chat-toggle {
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

/* Asegurar que el texto blanco sea visible */
.brand-white {
    color: white !important;
}

.hero-title {
    color: #f9f9ff !important;
}

.hero-subtitle {
    color: #e2e8f0 !important;
}

/* Intro overlay - oculto por defecto, solo se muestra si el intro se carga correctamente */
.intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgb(15, 23, 42);
    z-index: 10000;
    pointer-events: auto; /* Permitir interacción durante el intro */
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* Mostrar el overlay cuando el body tiene intro-loading (incluso sin intro-active) */
body.intro-loading .intro-overlay {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Ocultar intro-overlay cuando el body no tenga intro-loading */
body:not(.intro-loading) .intro-overlay {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    display: none !important;
}

/* Asegurar que el contenido esté visible cuando no hay intro-loading */
body:not(.intro-loading) .navbar,
body:not(.intro-loading) .hero,
body:not(.intro-loading) .section,
body:not(.intro-loading) .footer,
body:not(.intro-loading) .page-gradient {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Mensaje del intro */
.three-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 700;
    text-align: center;
    z-index: 10001;
    pointer-events: none;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 60px rgba(255, 255, 255, 0.5);
    opacity: 0;
    transition: opacity 0.8s ease;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    white-space: nowrap;
}

/* Asegurar que el contenido esté por encima de las animaciones y del canvas de Three.js */
.hero,
.section,
.footer,
.navbar,
.chat-toggle,
.chat-widget,
.theme-toggle {
    position: relative;
    z-index: 10;
    transition: opacity 1s ease;
}

/* Canvas de Three.js debe estar detrás durante el intro */
.intro-overlay canvas {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    z-index: 1001 !important;
    pointer-events: none !important;
}

/* Animaciones del neural-card en el fondo del sitio */
body::before {
    display: none !important;
}

body::after {
    display: none !important;
}

/* Asegurar que el contenido esté por encima de las animaciones y del canvas de Three.js */
.hero,
.section,
.footer,
.navbar,
.chat-toggle,
.chat-widget,
.theme-toggle {
    position: relative;
    z-index: 10;
}

/* Canvas de Three.js debe estar detrás */
canvas#background-canvas {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    z-index: 0 !important;
    pointer-events: none !important;
}

.page-gradient {
    display: none;
    /* Ocultar completamente el gradiente de fondo */
}

.page-gradient::before,
.page-gradient::after {
    display: none;
    /* Ocultar los efectos de blob animados */
}

.hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem 2rem;
    padding-top: 6rem;
    /* Espacio para la navbar fija */
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: center;
    position: relative;
}

/* Barra de navegación superior con logo centrado */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;

    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: padding 0.3s ease, border-bottom-width 0.3s ease;
}

/* Navbar pequeña cuando se hace scroll */
.navbar.scrolled {
    padding: 0.5rem 0;
    border-bottom-width: 1px;
}

.navbar .logo-container {
    margin: 0;
    padding: 0;
    transition: transform 0.3s ease;
}

/* Logo más pequeño en la navbar */
.navbar .site-logo {
    max-width: 200px;
    min-width: 150px;
    transition: max-width 0.3s ease, min-width 0.3s ease;
}

/* Logo aún más pequeño cuando se hace scroll */
.navbar.scrolled .site-logo {
    max-width: 120px;
    min-width: 100px;
}

/* hero-content sin padding extra ya que el logo está en la navbar */
.hero-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 0;
    /* Sin padding extra */
}

/* Ocultar el logo dentro de hero-content ya que está en la navbar */
.hero-content .logo-container {
    display: none;
}

/* hero-visual normal */
.hero-visual {
    position: relative;
    display: grid;
    gap: 2.5rem;
    isolation: isolate;
    align-items: start;
    padding-top: 0;
}

.logo-container {
    margin: 0 auto;
    padding: 0;
    /* Sin padding ya que no hay background */
    background: none;
    /* Sin background */
    border-radius: 0;
    /* Sin border-radius */
    display: block;
    backdrop-filter: none;
    width: fit-content;
}

.site-logo {
    max-width: 350px;
    min-width: 250px;
    width: auto;
    height: auto;
    display: block;
    filter: brightness(1.1) contrast(1.1);
    transition: transform 0.2s ease;
}

.site-logo:hover {
    transform: scale(1.03);
}

body.light-theme .logo-container {
    background: none;
    /* Sin background en modo claro también */
    border: none;
    /* Sin borde */
    box-shadow: none;
    /* Sin sombra */
}

body.light-theme .navbar {
    background: #ffffff;
    /* Fondo blanco para navbar en modo claro */
    border-bottom-color: #e5e7eb;
    /* Borde más visible en modo claro */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    /* Sombra sutil */
}

body.light-theme .site-logo {
    filter: brightness(0.95) contrast(1.15);
}

body.light-theme .neural-card {
    background: #ffffff !important;
    /* Fondo blanco sólido en modo claro - forzado con !important */
    background-color: #ffffff !important;
    /* Forzar también background-color */
    background-image: none !important;
    /* Sin gradientes */
    border-color: #e5e7eb !important;
    /* Borde claro */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
    /* Sombra suave */
}

body.light-theme .neural-card p {
    color: #1f2937;
    /* Texto oscuro en modo claro */
}

body.light-theme .video-frame {
    border-color: #d1d5db;
    /* Borde más claro */
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
    /* Sombra más suave */
}

body.light-theme .card-cta {
    background: rgba(59, 130, 246, 0.1);
    /* Fondo más claro para el botón */
    color: #1e40af;
    /* Texto azul oscuro */
}

body.light-theme .precio-desde {
    color: #2563eb;
    /* Azul más claro en modo claro */
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.6);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hero-title {
    font-size: clamp(2.8rem, 6vw, 4.5rem);
    line-height: 1.05;
    margin: 1rem 0 0.5rem;
    color: #f9f9ff !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.brand-white {
    color: #ffffff !important;
    text-shadow: 0 0 25px rgba(59, 130, 246, 0.65);
}

.brand-gradient {
    color: #ffffff;
    text-shadow: 0 0 25px rgba(59, 130, 246, 0.65);
}

.hero-subtitle {
    max-width: 36rem;
    color: #e5e7eb !important;
    font-size: 1rem;
    opacity: 1 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    line-height: 1.6;
}

.hero-subtitle strong {
    color: #ffffff !important;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.5rem;
    opacity: 1 !important;
    /* Asegurar que siempre sea visible */
    transform: none !important;
    /* Limpiar cualquier transform de GSAP */
    visibility: visible !important;
}

.btn {
    border-radius: 999px;
    padding: 0.7rem 1.4rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    opacity: 1 !important;
    /* Asegurar que los botones siempre sean visibles */
    visibility: visible !important;
    transform: none !important;
    /* Limpiar cualquier transform de GSAP */
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(120deg, #4f46e5, #0ea5e9);
    color: white;
    box-shadow: 0 18px 45px rgba(37, 99, 235, 0.45);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    opacity: 1 !important;
}

.btn-primary:hover {
    transform: translateY(-1px) translateZ(0);
    filter: brightness(1.07);
    box-shadow: 0 25px 60px rgba(37, 99, 235, 0.6);
}

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.6);
    color: #e5e7eb;
}

.btn-ghost {
    background: rgba(15, 23, 42, 1);
    border: 1px solid rgba(148, 163, 184, 0.7);
    color: #e5e7eb;
    opacity: 1 !important;
}

.hero-tags {
    margin-top: 1.4rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #9ca3af;
}

.hero-tags span {
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(75, 85, 99, 0.7);
}

.hero-visual {
    position: relative;
    display: grid;
    gap: 2.5rem;
    /* Aumentado gap para separar más el cuadro del video */
    isolation: isolate;
    align-items: start;
    /* Alinear el neural-card arriba */
    padding-top: 0;
    /* Sin padding superior para que quede alineado con el logo */
}

.hero-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 1.8rem;
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.18), transparent 65%),
        radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.25), transparent 60%);
    mix-blend-mode: soft-light;
    opacity: 0.0;
    pointer-events: none;
    z-index: -1;
    animation: hero-sweep 18s ease-in-out infinite;
}

.neural-card {
    /* Fondo completamente opaco, igual que logo-container */
    position: relative !important;
    padding: 1.5rem 1.8rem !important;
    min-height: 120px !important;
    border-radius: 1.2rem !important;
    /* Fondo 100% opaco para que no se vea el gradiente de fondo */
    background: rgb(15, 23, 42) !important;
    background-color: rgb(15, 23, 42) !important;
    background-image: none !important;
    /* Sin backdrop-filter para que sea completamente opaco */
    backdrop-filter: none !important;
    border: 1px solid rgba(148, 163, 184, 0.3) !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    gap: 1.2rem !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    z-index: 10 !important;
    isolation: isolate !important;
}

.neural-orbit {
    position: absolute;
    inset: -30%;
    border-radius: 50%;
    border: 1px dashed rgba(129, 140, 248, 0.4);
    animation: spin 24s linear infinite;
}

.neural-core {
    width: 64px;
    height: 64px;
    border-radius: 1.25rem;
    background: radial-gradient(circle at 30% 20%, #eff6ff, #0ea5e9);
    box-shadow:
        0 0 25px rgba(56, 189, 248, 0.8),
        0 0 55px rgba(59, 130, 246, 0.9);
    flex-shrink: 0;
    animation: core-pulse 5s ease-in-out infinite;
}

.neural-card p {
    margin: 0;
    font-size: 0.9rem;
    color: #e5e7eb;
    text-align: left;
}

.neural-typing {
    position: relative;
    white-space: nowrap;
}

.neural-typing-active::after {
    content: "";
    position: absolute;
    right: -0.35rem;
    top: 0.1rem;
    width: 2px;
    height: 1.1em;
    background: rgba(248, 250, 252, 0.9);
    border-radius: 999px;
    animation: caret-blink 0.9s steps(2, start) infinite;
}

.video-frame {
    border-radius: 1.5rem;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.6);
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.9);
    aspect-ratio: 16 / 9;
    transform: translateY(0);
    animation: float 8s ease-in-out infinite;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.video-frame iframe {
    width: 100%;
    height: 100%;
}

.section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem 0;
}

.section-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
}

.section-header p {
    margin-top: 0;
    color: #d1d5db;
}

.cards-grid {
    margin-top: 1.8rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.card {
    position: relative;
    padding: 1.4rem 1.3rem;
    border-radius: 1.2rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(55, 65, 81, 0.9);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
    transform: translateY(0);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.95);
    border-color: rgba(129, 140, 248, 0.9);
}

.servicio-card h3 {
    margin-top: 0;
}

.servicio-card {
    display: flex;
    flex-direction: column;
}

.servicio-card p {
    flex-grow: 1;
}

.precio-desde {
    margin-top: 0.75rem;
    color: #a5b4fc;
}

.card-cta {
    margin-top: 0.75rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: none;
    background: rgba(37, 99, 235, 0.2);
    color: #e5e7eb;
    cursor: pointer;
    font-size: 0.85rem;
}

.proyecto-card .tag {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a5b4fc;
}

.card-link {
    display: inline-flex;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #93c5fd;
    text-decoration: none;
}

.chat-window {
    flex: 1;
    min-height: 200px;
    max-height: 300px;
    padding: 1rem;
    border-radius: 1.2rem;
    background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.4), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(55, 65, 81, 0.9);
    overflow-y: auto;
}

.chat-message {
    max-width: 80%;
    padding: 0.65rem 0.9rem;
    border-radius: 0.8rem;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.chat-message.bot {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(75, 85, 99, 0.9);
}

.chat-message.user {
    margin-left: auto;
    background: linear-gradient(120deg, #4f46e5, #0ea5e9);
}

.chat-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.chat-form input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
}

.status-text {
    font-size: 0.85rem;
    color: #a5b4fc;
    min-height: 1.4rem;
}

.footer {
    margin-top: 3rem;
    padding: 1.8rem 1.5rem 2rem;
    text-align: center;
    font-size: 0.85rem;
    color: #9ca3af;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-link {
    color: #60a5fa;
    text-decoration: none;
    transition: color 0.2s ease;
    font-size: 0.85rem;
}

.footer-link:hover {
    color: #3b82f6;
    text-decoration: underline;
}

.footer-separator {
    color: #6b7280;
}

/* Páginas de políticas */
.policy-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 6rem 1.5rem 3rem;
    min-height: 100vh;
}

.policy-container {
    background: rgba(15, 23, 42, 0.9);
    border-radius: 1.5rem;
    padding: 2.5rem;
    border: 1px solid rgba(55, 65, 81, 0.9);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.9);
}

.policy-container h1 {
    color: #f9f9ff;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.policy-date {
    color: #9ca3af;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.policy-container section {
    margin-bottom: 2.5rem;
}

.policy-container h2 {
    color: #e5e7eb;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.policy-container p {
    color: #d1d5db;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.policy-container ul {
    color: #d1d5db;
    line-height: 1.8;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.policy-container li {
    margin-bottom: 0.5rem;
}

.policy-container a {
    color: #60a5fa;
    text-decoration: none;
}

.policy-container a:hover {
    color: #3b82f6;
    text-decoration: underline;
}

.policy-back {
    margin-top: 3rem;
    text-align: center;
}

body.light-theme .policy-container {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 16px 35px rgba(15, 23, 42, 0.08);
}

body.light-theme .policy-container h1,
body.light-theme .policy-container h2 {
    color: #111827;
}

body.light-theme .policy-container p,
body.light-theme .policy-container li {
    color: #4b5563;
}

body.light-theme .policy-date {
    color: #6b7280;
}

@media (max-width: 900px) {
    .policy-page {
        padding: 5rem 1rem 2rem;
    }

    .policy-container {
        padding: 1.5rem;
    }

    .policy-container h1 {
        font-size: 2rem;
    }

    .policy-container h2 {
        font-size: 1.25rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    .footer-separator {
        display: none;
    }
}

/* Toggle de tema claro/oscuro */

.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1.5rem;
    z-index: 10001 !important;
    /* Asegurar que esté por encima de todo */
    /* Por encima de la navbar */
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.85);
    color: #e5e7eb;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(10px);
    pointer-events: auto !important;
    /* Asegurar que pueda recibir clicks */
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

body.light-theme {
    color: #020617;
    background: radial-gradient(circle at top left, rgba(191, 219, 254, 0.7), #eef2ff) !important;
    /* Fondo claro para modo claro */
}

/* Animaciones también en modo claro pero más sutiles */
body.light-theme::before {
    border-color: rgba(59, 130, 246, 0.2);
    /* Borde más sutil en modo claro */
}

body.light-theme::after {
    background: radial-gradient(circle at 30% 20%, rgba(219, 234, 254, 0.5), rgba(59, 130, 246, 0.4));
    box-shadow:
        0 0 30px rgba(59, 130, 246, 0.4),
        0 0 60px rgba(37, 99, 235, 0.3);
}

body.light-theme .page-gradient {
    display: none;
    /* Ocultar también en modo claro */
}

body.light-theme .card {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 16px 35px rgba(15, 23, 42, 0.08);
}

body.light-theme .card-cta {
    background: rgba(59, 130, 246, 0.08);
    color: #1f2937;
}

body.light-theme .badge {
    background: rgba(255, 255, 255, 0.8);
    border-color: #e5e7eb;
    color: #0f172a;
}

body.light-theme .hero-subtitle,
body.light-theme .section-header p {
    color: #4b5563;
}

body.light-theme .hero-tags span {
    background: #f1f5f9;
    border-color: #e5e7eb;
    color: #475569;
}

body.light-theme .btn-primary {
    background: linear-gradient(120deg, #2563eb, #0ea5e9);
    color: #f9fafb;
    opacity: 1 !important;
}

body.light-theme .btn-ghost {
    background: rgba(255, 255, 255, 1);
    border-color: #e5e7eb;
    color: #111827;
    opacity: 1 !important;
}

body.light-theme .btn-secondary {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #111827;
}

body.light-theme .chat-widget {
    background: #f9fafb;
    border-color: #e5e7eb;
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.18);
}

body.light-theme {
    background: radial-gradient(circle at top left, rgba(191, 219, 254, 0.7), #eef2ff) !important;
}

body.light-theme .chat-window {
    background: radial-gradient(circle at top left, rgba(191, 219, 254, 0.7), #eef2ff);
    border-color: #e5e7eb;
}

body.light-theme .chat-header {
    border-bottom-color: #e5e7eb;
    /* Borde claro en modo claro */
}

body.light-theme .chat-title {
    color: #111827;
    /* Texto oscuro en modo claro */
}

body.light-theme .chat-close {
    border-color: #d1d5db;
    /* Borde claro */
    color: #4b5563;
    /* Color oscuro para contraste */
}

body.light-theme .chat-close:hover {
    background: #f3f4f6;
    /* Fondo claro al hover */
}

body.light-theme .chat-subtitle {
    color: #6b7280;
    /* Color más claro */
}

body.light-theme .chat-message.bot {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #111827;
}

body.light-theme .chat-message.user {
    color: #f9fafb;
}

body.light-theme .chat-form input {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #111827;
}

body.light-theme .status-text {
    color: #2563eb;
    /* Azul más claro en modo claro */
}

body.light-theme .footer {
    color: #6b7280;
}

body.light-theme .theme-toggle {
    background: rgba(255, 255, 255, 0.9);
    color: #0f172a;
    border-color: #e5e7eb;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Animación de rotación 3D solo en eje Z */
@keyframes spin-3d {
    0% {
        transform: translate(-50%, -50%) rotateZ(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotateZ(360deg);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes bg-pan {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
        opacity: 0.75;
    }

    50% {
        transform: translate3d(-2%, -1%, 0) scale(1.02);
        opacity: 0.9;
    }

    100% {
        transform: translate3d(2%, 1%, 0) scale(1.03);
        opacity: 0.85;
    }
}

@keyframes hero-sweep {

    0%,
    15% {
        opacity: 0;
        transform: translateX(-20%);
    }

    30%,
    70% {
        opacity: 0.45;
        transform: translateX(0);
    }

    100% {
        opacity: 0;
        transform: translateX(20%);
    }
}

@keyframes blob-move-1 {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
        opacity: 0.4;
    }

    40% {
        transform: translate3d(60px, 40px, 0) scale(1.08);
        opacity: 0.7;
    }

    100% {
        transform: translate3d(120px, 80px, 0) scale(1.12);
        opacity: 0.5;
    }
}

@keyframes blob-move-2 {
    0% {
        transform: translate3d(0, 0, 0) scale(1.05);
        opacity: 0.45;
    }

    50% {
        transform: translate3d(-80px, -40px, 0) scale(1.15);
        opacity: 0.8;
    }

    100% {
        transform: translate3d(-140px, -90px, 0) scale(1.05);
        opacity: 0.55;
    }
}

@keyframes caret-blink {

    0%,
    50% {
        opacity: 1;
    }

    50.01%,
    100% {
        opacity: 0;
    }
}

@keyframes core-pulse {

    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
        box-shadow:
            0 0 20px rgba(56, 189, 248, 0.8),
            0 0 45px rgba(37, 99, 235, 0.7);
    }

    50% {
        transform: translate3d(0, -2px, 0) scale(1.04);
        box-shadow:
            0 0 28px rgba(56, 189, 248, 1),
            0 0 70px rgba(59, 130, 246, 0.95);
    }
}

/* Widget flotante de chat */

.chat-toggle {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 40;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.1rem;
    border-radius: 999px;
    background: linear-gradient(120deg, #4f46e5, #0ea5e9);
    color: white;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
    pointer-events: auto !important;
    /* Asegurar que pueda recibir clicks */
    opacity: 1 !important;
    /* Asegurar que sea visible */
    visibility: visible !important;
}

.chat-widget {
    position: fixed;
    right: 1.5rem;
    bottom: 5.5rem;
    /* Más espacio desde abajo */
    width: 320px;
    max-height: calc(100vh - 7rem);
    /* Asegurar que no se salga de la pantalla */
    background: rgba(15, 23, 42, 0.98);
    border-radius: 1.3rem;
    border: 1px solid rgba(51, 65, 85, 0.95);
    box-shadow: 0 26px 70px rgba(15, 23, 42, 0.98);
    display: flex;
    flex-direction: column;
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease;
    z-index: 50;
}

.chat-widget.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.chat-header {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.95);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.chat-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.chat-subtitle {
    margin: 0.1rem 0 0;
    font-size: 0.75rem;
    color: #9ca3af;
}

.chat-close {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid rgba(75, 85, 99, 0.9);
    background: transparent;
    color: #e5e7eb;
    cursor: pointer;
}

.chat-window {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
}

.chat-form {
    padding: 0.6rem 0.7rem 0.8rem;
}

.status-text {
    padding: 0 0.9rem 0.7rem;
}

/* Sección de ideas */
.ideas-section {
    padding-bottom: 4rem;
}

.ideas-form-container {
    margin-top: 2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1.5rem;
}

.ideas-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    padding: 2rem;
    border-radius: 1.5rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(55, 65, 81, 0.9);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field-group.full-width {
    grid-column: 1 / -1;
}

.field-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #e5e7eb;
}

.field-group input,
.field-group textarea {
    padding: 0.75rem 1rem;
    border-radius: 0.7rem;
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: rgba(15, 23, 42, 0.95);
    color: #e5e7eb;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field-group input:focus,
.field-group textarea:focus {
    outline: none;
    border-color: rgba(129, 140, 248, 0.9);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.field-group textarea {
    resize: vertical;
    min-height: 140px;
}

.ideas-submit {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
    padding: 0.85rem 1.6rem;
    font-size: 1rem;
}

body.light-theme .ideas-form {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 16px 35px rgba(15, 23, 42, 0.08);
}

body.light-theme .field-group label {
    color: #111827;
}

body.light-theme .field-group input,
body.light-theme .field-group textarea {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #111827;
}

body.light-theme .field-group input:focus,
body.light-theme .field-group textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Asegurar que todos los elementos con backgrounds oscuros tengan estilos claros */
body.light-theme .hero-title {
    color: #111827;
    /* Texto oscuro en modo claro */
}

body.light-theme .hero-subtitle {
    color: #4b5563;
    /* Ya está pero por si acaso */
}

body.light-theme .section-header h2 {
    color: #111827;
    /* Títulos oscuros en modo claro */
}

/* Asegurar que todos los textos y elementos tengan colores apropiados en modo claro */
body.light-theme .proyecto-card .tag {
    color: #2563eb;
    /* Azul más claro en modo claro */
}

body.light-theme .card-link {
    color: #2563eb;
    /* Enlaces azules en modo claro */
}

body.light-theme .card-link:hover {
    color: #1d4ed8;
    /* Azul más oscuro al hover */
}

@media (max-width: 900px) {

    html,
    body {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .hero {
        grid-template-columns: minmax(0, 1fr);
        padding-top: 2.2rem;
        width: 100%;
        max-width: 100vw;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .hero-visual {
        order: -1;
        width: 100%;
        max-width: 100%;
    }

    .hero-content {
        width: 100%;
        max-width: 100%;
    }

    .chat-widget {
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
        bottom: 5.5rem !important;
        /* Asegurar posición en móvil */
        max-height: calc(100vh - 7rem) !important;
    }

    .chat-toggle {
        right: 0.75rem;
        bottom: 0.75rem;
    }

    .section {
        width: 100%;
        max-width: 100vw;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .theme-toggle {
        right: 0.75rem;
        top: 0.75rem;
    }

    /* Formulario de ideas responsive */
    .ideas-form-container {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 0 1rem;
    }

    .ideas-form {
        grid-template-columns: 1fr !important;
        /* Una sola columna en móvil */
        gap: 1rem;
        padding: 1.5rem;
        border-radius: 1rem;
    }

    .field-group {
        width: 100%;
    }

    .field-group.full-width {
        grid-column: 1;
        /* Asegurar que ocupe toda la columna */
    }

    .field-group input,
    .field-group textarea {
        width: 100%;
        padding: 0.7rem 0.9rem;
        font-size: 16px;
        /* Evitar zoom automático en iOS */
        box-sizing: border-box;
    }

    .field-group textarea {
        min-height: 120px;
    }

    .ideas-submit {
        grid-column: 1;
        width: 100%;
        padding: 0.9rem 1.4rem;
        font-size: 1rem;
    }
}