/* =====================================================================
   GIDEON CHAT — Sección "Inicia la conversación"
   Chat estilo Gemini/ChatGPT con input luxury (vidrio esmerilado),
   inspirado en el hero de autom8os.ai.
   ===================================================================== */

.gd-chat {
    --gd-neon: #5997ff;
    --gd-blue: #1b4ef5;
    position: relative;
    max-width: 720px;
    margin: 0 auto;
    text-align: left;
}

/* Halo sutil detrás del chat para que "flote" sobre el fondo negro */
.gd-chat::before {
    content: "";
    position: absolute;
    inset: -8% -12%;
    background: radial-gradient(
        ellipse at center,
        rgba(27, 78, 245, 0.16) 0%,
        rgba(89, 151, 255, 0.06) 40%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
    filter: blur(6px);
}

/* ---------- Ventana de mensajes ---------- */
.gd-chat-window {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 380px;
    overflow-y: auto;
    padding: 10px 6px 18px;
    scrollbar-width: thin;
    scrollbar-color: var(--gd-blue) transparent;
    scroll-behavior: smooth;
}
.gd-chat-window::-webkit-scrollbar {
    width: 4px;
}
.gd-chat-window::-webkit-scrollbar-thumb {
    background: var(--gd-blue);
    border-radius: 4px;
}

/* ---------- Mensajes ---------- */
.gd-msg {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    animation: gd-rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.gd-msg-user {
    flex-direction: row-reverse;
}

.gd-avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--gd-blue) 0%, #192e8f 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-size: 17px;
    line-height: 1;
    box-shadow:
        0 0 0 1px rgba(89, 151, 255, 0.12),
        0 0 22px rgba(27, 78, 245, 0.45);
}
.gd-avatar .icon {
    font-size: 17px;
    width: 17px;
}
.gd-msg-user .gd-avatar {
    display: none;
}

.gd-bubble {
    max-width: 78%;
    padding: 13px 17px;
    border-radius: 20px;
    border-bottom-left-radius: 6px;
    background: rgba(20, 20, 21, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text-2, #f4f7f5);
    font-size: 15px;
    line-height: 1.6;
    letter-spacing: -0.1px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.gd-msg-user .gd-bubble {
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 6px;
    border-color: rgba(89, 151, 255, 0.28);
    background: linear-gradient(
        0deg,
        rgba(27, 78, 245, 0.16),
        rgba(20, 20, 21, 0.82)
    );
}

.gd-sender {
    display: block;
    font-family: "Mono", monospace;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gd-neon);
    margin-bottom: 4px;
}

.gd-text {
    display: block;
    white-space: pre-line;
}
.gd-text a {
    color: var(--gd-neon);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- Indicador de escritura ---------- */
.gd-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    padding: 15px 19px;
    border-radius: 20px;
    border-bottom-left-radius: 6px;
    background: rgba(20, 20, 21, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-left: 48px;
}
.gd-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gd-neon);
    animation: gd-blink 1.2s infinite ease-in-out;
}
.gd-typing span:nth-child(2) {
    animation-delay: 0.15s;
}
.gd-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

/* ---------- Sugerencias rápidas ---------- */
.gd-suggest {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
    animation: gd-rise 0.5s ease 0.2s both;
}
.gd-chip {
    font-family: "Grotesk", sans-serif;
    font-size: 13px;
    color: var(--text-2, #f4f7f5);
    background: rgba(20, 20, 21, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 9px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.gd-chip:hover {
    border-color: var(--gd-neon);
    color: #ffffff;
    background: rgba(89, 151, 255, 0.14);
    transform: translateY(-1px);
}

/* ---------- Input luxury (form-ask heredado de la plantilla) ---------- */
.gd-chat-form {
    position: relative;
    z-index: 1;
    transition:
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}
.gd-chat-form:focus-within {
    border-color: rgba(89, 151, 255, 0.45);
    box-shadow:
        0 0 0 1px rgba(89, 151, 255, 0.12),
        0 10px 40px rgba(27, 78, 245, 0.22);
}

.gd-chat-form .form-content .gd-input {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text-2, #f4f7f5);
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: -0.1px;
    padding: 14px 6px 20px;
    resize: none;
    outline: none;
    max-height: 150px;
    overflow-y: auto;
}
.gd-chat-form .form-content .gd-input::placeholder {
    color: var(--text-3, #f4f7f552);
}

/* Botón de envío: apagado (gris) hasta que hay texto, azul cuando se puede enviar
   — el mismo affordance de Gemini/ChatGPT. */
.gd-send,
.gd-send:hover {
    color: var(--text-3, #f4f7f552);
    background: rgba(20, 20, 21, 0.82);
    border-color: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}
.gd-chat-form.has-text .gd-send,
.gd-chat-form.has-text .gd-send:hover {
    color: #ffffff;
    background: linear-gradient(135deg, #1b4ef5 0%, #5997ff 100%);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow:
        0px 1px 1px 0px rgba(255, 255, 255, 0.22) inset,
        0 0 20px rgba(27, 78, 245, 0.55);
}

/* Chip de modelo GIDEON */
.gd-model {
    font-family: "Grotesk", sans-serif;
    font-weight: 500;
}

/* ---------- Animaciones ---------- */
@keyframes gd-rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes gd-blink {
    0%,
    80%,
    100% {
        opacity: 0.2;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 575px) {
    .gd-chat-window {
        max-height: 320px;
        padding: 6px 2px 12px;
    }
    .gd-bubble {
        max-width: 88%;
        font-size: 14px;
        padding: 11px 14px;
    }
    .gd-typing {
        margin-left: 40px;
    }
    .gd-chat-form .form-content .gd-input {
        font-size: 15px;
        padding: 12px 4px 16px;
    }
    .gd-model {
        display: none;
    }
}

/* Chips con scroll horizontal en móvil/tablet */
@media (max-width: 991px) {
    .gd-suggest {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* scrollbar oculta pero el scroll sigue funcionando */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
        padding-bottom: 8px;
    }
    .gd-suggest::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
    .gd-chip {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}
