/* ============================================================
   RedenTech - Assistente Virtual Theo
   Usa as variáveis definidas em style.css
   ============================================================ */


/* ============================================================
   BOTÃO FLUTUANTE
   ============================================================ */

.ia-launcher {
    position: fixed;
    bottom: 30px;
    right: 100px;

    width: 60px;
    height: 60px;

    border: none;
    border-radius: 50%;

    background: var(--gradiente-principal);

    color: var(--branco);

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: var(--sombra-media);

    transition: var(--transicao);

    z-index: 1001;

    padding: 0;
    overflow: visible;
}


.ia-launcher:hover {
    transform: translateY(-3px);
    box-shadow: var(--sombra-forte);
}


.ia-launcher:focus-visible,
.ia-fechar:focus-visible,
.ia-form button:focus-visible,
.ia-sugestoes button:focus-visible {
    outline: 3px solid var(--azul-claro);
    outline-offset: 2px;
}


/* Foto do Theo no botão flutuante */

.ia-launcher-avatar {
    width: 56px;
    height: 56px;

    object-fit: cover;
    object-position: center top;

    border-radius: 50%;

    display: block;

    background: transparent;

    transition: var(--transicao);
}


/* Ícone de fechar */

.ia-icon-close {
    display: none;
    font-size: 25px;
}


.ia-launcher.aberto .ia-launcher-avatar {
    display: none;
}


.ia-launcher.aberto .ia-icon-close {
    display: inline;
}


/* ============================================================
   BALÃO DE CONVITE
   ============================================================ */

.ia-dica {
    position: absolute;

    right: 72px;
    top: 50%;

    transform: translateY(-50%);

    background: var(--branco);
    color: var(--azul-marinho);

    font-size: 13px;
    font-weight: 500;

    white-space: nowrap;

    padding: 8px 14px;

    border-radius: 20px;

    box-shadow: var(--sombra-suave);

    pointer-events: none;
}


.ia-launcher.aberto .ia-dica,
.ia-launcher.ia-visto .ia-dica {
    display: none;
}


/* ============================================================
   JANELA DO CHAT
   ============================================================ */

.ia-panel {
    position: fixed;

    bottom: 105px;
    right: 30px;

    width: 370px;

    height: min(
        540px,
        calc(100vh - 140px)
    );

    background: var(--branco);

    border-radius: var(--radius);

    box-shadow: var(--sombra-forte);

    display: flex;
    flex-direction: column;

    overflow: hidden;

    z-index: 1001;

    animation: iaEntrada 0.25s ease;
}


.ia-panel[hidden] {
    display: none;
}


@keyframes iaEntrada {

    from {
        opacity: 0;

        transform:
            translateY(12px)
            scale(0.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}


/* ============================================================
   CABEÇALHO
   ============================================================ */

.ia-header {
    display: flex;

    align-items: center;

    gap: 12px;

    padding: 12px 16px;

    background: var(--gradiente-principal);

    color: var(--branco);

    min-height: 72px;
}


/* Avatar do Theo */

.ia-avatar {
    width: 48px;
    height: 48px;

    flex-shrink: 0;

    border-radius: 50%;

    background:
        rgba(
            255,
            255,
            255,
            0.18
        );

    display: flex;

    align-items: center;
    justify-content: center;

    overflow: hidden;

    border:
        2px solid
        rgba(
            255,
            255,
            255,
            0.3
        );
}


.ia-avatar img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    object-position: center top;

    display: block;
}


/* Informações do Theo */

.ia-header-info {
    flex: 1;

    min-width: 0;

    line-height: 1.2;
}


.ia-header-info strong {
    display: block;

    font-size: 16px;

    font-weight: 700;

    margin-bottom: 2px;
}


.ia-funcao {
    display: block;

    font-size: 11px !important;

    opacity: 0.88;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


.ia-status {
    display: flex;

    align-items: center;

    gap: 4px;

    font-size: 11px !important;

    margin-top: 4px;

    opacity: 0.95;
}


/* Bolinha online */

.ia-online {
    display: inline-block;

    width: 8px;
    height: 8px;

    flex-shrink: 0;

    border-radius: 50%;

    background: #25D366;

    box-shadow:
        0 0 0 2px
        rgba(
            37,
            211,
            102,
            0.15
        );
}


/* Botão fechar */

.ia-fechar {
    background: none;

    border: none;

    color: var(--branco);

    font-size: 18px;

    cursor: pointer;

    padding: 7px;

    border-radius: 6px;

    opacity: 0.85;

    flex-shrink: 0;

    transition: var(--transicao);
}


.ia-fechar:hover {
    opacity: 1;

    background:
        rgba(
            255,
            255,
            255,
            0.15
        );
}


/* ============================================================
   ÁREA DE MENSAGENS
   ============================================================ */

.ia-mensagens {
    flex: 1;

    overflow-y: auto;

    padding: 16px 14px;

    background: var(--cinza-claro);

    display: flex;

    flex-direction: column;

    gap: 12px;

    scroll-behavior: smooth;
}


/* Scroll */

.ia-mensagens::-webkit-scrollbar {
    width: 6px;
}


.ia-mensagens::-webkit-scrollbar-track {
    background: transparent;
}


.ia-mensagens::-webkit-scrollbar-thumb {
    background:
        rgba(
            0,
            0,
            0,
            0.25
        );

    border-radius: 10px;
}


/* ============================================================
   LINHA DA MENSAGEM
   ============================================================ */

.ia-msg {
    display: flex;

    align-items: flex-end;

    gap: 8px;

    width: 100%;
}


.ia-msg.ia-user {
    justify-content: flex-end;
}


.ia-msg.ia-bot {
    justify-content: flex-start;
}


/* ============================================================
   AVATAR NAS MENSAGENS
   ============================================================ */

.ia-msg-avatar {
    width: 32px;
    height: 32px;

    flex-shrink: 0;

    border-radius: 50%;

    overflow: hidden;

    background: var(--branco);

    box-shadow: var(--sombra-suave);

    border:
        1px solid
        rgba(
            0,
            0,
            0,
            0.05
        );
}


.ia-msg-avatar img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    object-position: center top;

    display: block;
}


/* ============================================================
   BOLHAS
   ============================================================ */

.ia-bolha {
    max-width: 82%;

    padding: 10px 14px;

    border-radius: 14px;

    font-size: 14px;

    line-height: 1.5;

    word-wrap: break-word;

    overflow-wrap: anywhere;
}


/* Mensagem do Theo */

.ia-bot .ia-bolha {
    max-width:
        calc(
            85% - 38px
        );

    background: var(--branco);

    color: var(--texto);

    border-bottom-left-radius: 4px;

    box-shadow: var(--sombra-suave);
}


/* Mensagem do usuário */

.ia-user .ia-bolha {
    background: var(--azul-vibrante);

    color: var(--branco);

    border-bottom-right-radius: 4px;
}


/* Erro */

.ia-bot.ia-erro .ia-bolha {
    background: #FDECEC;

    color: #8A1F1F;
}


/* Formatação interna */

.ia-bolha p {
    margin: 0;
}


.ia-bolha p + p {
    margin-top: 6px;
}


.ia-bolha ul {
    margin:
        6px
        0
        0
        18px;

    list-style: disc;
}


.ia-bolha li {
    margin-bottom: 2px;
}


.ia-bolha a {
    color: var(--azul-vibrante);

    text-decoration: underline;
}


.ia-user .ia-bolha a {
    color: var(--branco);
}


/* ============================================================
   THEO ESTÁ DIGITANDO
   ============================================================ */

.ia-digitando {
    align-items: flex-end;
}


.ia-digitando-conteudo {
    display: flex;

    flex-direction: column;

    align-items: flex-start;

    gap: 4px;
}


.ia-digitando-nome {
    font-size: 11px;

    color: var(--texto-suave);

    margin-left: 3px;
}


/* Bolha dos pontinhos */

.ia-digitando .ia-bolha {
    display: flex;

    align-items: center;

    gap: 4px;

    width: fit-content;

    min-width: 52px;

    padding: 13px 15px;
}


.ia-digitando .ia-bolha span {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--texto-suave);

    animation:
        iaPonto
        1.2s
        infinite
        ease-in-out;
}


.ia-digitando
.ia-bolha
span:nth-child(2) {
    animation-delay: 0.15s;
}


.ia-digitando
.ia-bolha
span:nth-child(3) {
    animation-delay: 0.3s;
}


@keyframes iaPonto {

    0%,
    60%,
    100% {
        opacity: 0.3;

        transform:
            translateY(0);
    }

    30% {
        opacity: 1;

        transform:
            translateY(-4px);
    }
}


/* ============================================================
   SUGESTÕES
   ============================================================ */

.ia-sugestoes {
    display: flex;

    flex-wrap: wrap;

    gap: 8px;

    padding:
        10px
        16px;

    background: var(--cinza-claro);
}


.ia-sugestoes[hidden] {
    display: none;
}


.ia-sugestoes button {
    font-family: inherit;

    font-size: 12.5px;

    color: var(--azul-marinho);

    background: var(--branco);

    border:
        1px solid
        var(--cinza-medio);

    border-radius: 18px;

    padding:
        6px
        12px;

    cursor: pointer;

    transition: var(--transicao);
}


.ia-sugestoes button:hover {
    border-color: var(--azul-vibrante);

    color: var(--azul-vibrante);

    transform: translateY(-1px);
}


/* ============================================================
   FORMULÁRIO
   ============================================================ */

.ia-form {
    display: flex;

    gap: 8px;

    padding:
        12px
        16px
        6px;

    background: var(--branco);

    border-top:
        1px solid
        var(--cinza-medio);
}


/* Campo */

.ia-form input {
    flex: 1;

    min-width: 0;

    font-family: inherit;

    font-size: 14px;

    padding:
        10px
        14px;

    border:
        1px solid
        var(--cinza-medio);

    border-radius: 22px;

    outline: none;

    transition: var(--transicao);

    background: var(--branco);

    color: var(--texto);
}


.ia-form input::placeholder {
    color: var(--texto-suave);
}


.ia-form input:focus {
    border-color: var(--azul-vibrante);

    box-shadow:
        0 0 0 2px
        rgba(
            33,
            150,
            243,
            0.08
        );
}


/* Botão enviar */

.ia-form button {
    width: 42px;
    height: 42px;

    flex-shrink: 0;

    border: none;

    border-radius: 50%;

    background: var(--azul-vibrante);

    color: var(--branco);

    cursor: pointer;

    transition: var(--transicao);

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 15px;
}


.ia-form button:hover:not(:disabled) {
    background: var(--azul-marinho);

    transform: translateY(-1px);
}


.ia-form button:disabled,
.ia-form input:disabled {
    opacity: 0.6;

    cursor: not-allowed;
}


/* ============================================================
   AVISO
   ============================================================ */

.ia-aviso {
    margin: 0;

    padding:
        0
        16px
        10px;

    background: var(--branco);

    font-size: 11px;

    color: var(--texto-suave);

    text-align: center;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 600px) {

    .ia-launcher {
        right: 92px;
        bottom: 20px;

        width: 54px;
        height: 54px;
    }


    .ia-launcher-avatar {
        width: 50px;
        height: 50px;
    }


    .ia-dica {
        display: none;
    }


    .ia-panel {
        top: 10px;
        right: 10px;
        bottom: 10px;
        left: 10px;

        width: auto;
        height: auto;

        border-radius: 14px;
    }


    .ia-header {
        padding: 11px 14px;

        min-height: 68px;
    }


    .ia-avatar {
        width: 44px;
        height: 44px;
    }


    .ia-header-info strong {
        font-size: 15px;
    }


    .ia-funcao {
        font-size: 10.5px !important;
    }


    .ia-status {
        font-size: 10.5px !important;
    }


    .ia-mensagens {
        padding: 14px 12px;
    }


    .ia-msg-avatar {
        width: 29px;
        height: 29px;
    }


    .ia-bolha {
        font-size: 13.5px;

        max-width: 84%;
    }


    .ia-bot .ia-bolha {
        max-width:
            calc(
                87% - 35px
            );
    }


    .ia-form {
        padding:
            10px
            12px
            6px;
    }


    .ia-form input {
        font-size: 14px;
    }


    .ia-sugestoes {
        padding:
            8px
            12px;
    }


    .ia-sugestoes button {
        font-size: 12px;
    }
}


/* ============================================================
   ACESSIBILIDADE / MENOS ANIMAÇÕES
   ============================================================ */

@media (
    prefers-reduced-motion:
    reduce
) {

    .ia-panel,
    .ia-digitando .ia-bolha span {
        animation: none;
    }


    .ia-launcher,
    .ia-form button,
    .ia-sugestoes button {
        transition: none;
    }
}

.ia-suporte-texto {
    position: absolute;

    bottom: 68px;
    left: 50%;

    transform: translateX(-50%);

    background: var(--branco);
    color: var(--azul-marinho);

    font-size: 12px;
    font-weight: 600;

    white-space: nowrap;

    padding: 7px 11px;

    border-radius: 16px;

    box-shadow: var(--sombra-suave);

    pointer-events: none;
}

.ia-suporte-texto::after {
    content: '';

    position: absolute;

    left: 50%;
    bottom: -5px;

    transform: translateX(-50%);

    width: 0;
    height: 0;

    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--branco);
}

.ia-launcher.aberto .ia-suporte-texto {
    display: none;
}

.ia-digitando {
    align-items: flex-end;
}

.ia-digitando-conteudo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.ia-digitando-nome {
    font-size: 11px;
    color: var(--texto-suave);
    margin-left: 3px;
    font-weight: 500;
}

.ia-bolha-digitando {
    display: flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    min-width: 52px;
    padding: 13px 15px;
}

.ia-bolha-digitando span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--texto-suave);
    animation: iaPonto 1.2s infinite ease-in-out;
}

.ia-bolha-digitando span:nth-child(2) {
    animation-delay: 0.15s;
}

.ia-bolha-digitando span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes iaPonto {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}