/* ══════════════════════════════════════════════════════════
   CHAT WIDGET — SmartData Consultoria
   Arquivo: assets/chat.css
   Descrição: Estilos do badge, botão FAB, painel, mensagens
              e área de input do chat embutido no site.
   ══════════════════════════════════════════════════════════ */

/* ── Botão FAB (flutuante) ── */
#sd-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a855f7, #06b6d4);
    border: none;
    cursor: pointer;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(168,85,247,.5);
    animation: sdPulse 3s ease-in-out infinite;
    transition: transform .2s;
}
#sd-fab:hover { transform: scale(1.1); animation: none; }

@keyframes sdPulse {
    0%,100% { box-shadow: 0 8px 32px rgba(168,85,247,.5), 0 0 0 0 rgba(168,85,247,.3); }
    50%      { box-shadow: 0 8px 32px rgba(168,85,247,.5), 0 0 0 14px rgba(168,85,247,0); }
}

#sd-fab svg { width: 26px; height: 26px; fill: white; }
#sd-fab .ic-close { display: none; }
#sd-fab.open .ic-chat { display: none; }
#sd-fab.open .ic-close { display: block; }
#sd-fab.open { animation: none; }

/* ── Badge de chamada ── */
#sd-badge {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: 99999;
    background: linear-gradient(135deg, #a855f7, #06b6d4);
    color: white;
    font-size: .78rem;
    font-weight: 700;
    padding: .4rem .9rem;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(168,85,247,.4);
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    animation: sdBadgeIn .5s cubic-bezier(.34,1.56,.64,1) 2s both;
    white-space: nowrap;
}

@keyframes sdBadgeIn {
    from { opacity: 0; transform: translateY(8px) scale(.85); }
    to   { opacity: 1; transform: none; }
}

#sd-badge.gone { display: none; }

/* ── Painel do chat ── */
#sd-panel {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 370px;
    height: 0;
    max-height: 560px;
    border-radius: 20px;
    background: #111827;
    border: 1px solid rgba(168,85,247,.25);
    box-shadow: 0 24px 80px rgba(0,0,0,.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(.88) translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: transform .32s cubic-bezier(.34,1.26,.64,1),
                opacity .28s ease,
                height .32s cubic-bezier(.34,1.26,.64,1);
    z-index: 99998;
    font-family: 'Outfit', sans-serif;
}
#sd-panel.open {
    height: 560px;
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ── Responsivo mobile ── */
@media (max-width: 430px) {
    #sd-panel  { width: calc(100vw - 16px); right: 8px; bottom: 88px; }
    #sd-fab,
    #sd-badge  { right: 14px; }
    #sd-badge  { bottom: 88px; }
    #sd-fab    { bottom: 16px; }
}

/* ── Cabeçalho do painel ── */
.sd-head {
    background: linear-gradient(135deg, #1a0a2e, #0f172a);
    border-bottom: 1px solid rgba(168,85,247,.2);
    padding: 13px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.sd-head-av {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a855f7, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 0 14px rgba(168,85,247,.35);
}
.sd-head-info { flex: 1; }
.sd-head-info b { display: block; font-size: .88rem; font-weight: 700; color: #f1f5f9; }
.sd-head-info small {
    font-size: .7rem;
    color: #34d399;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sd-head-info small::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
    flex-shrink: 0;
    animation: sdBlink 2s ease-in-out infinite;
}
@keyframes sdBlink { 0%,100%{ opacity:1 } 50%{ opacity:.25 } }

.sd-head-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #475569;
    padding: 4px;
    border-radius: 6px;
    transition: color .2s;
    display: flex;
}
.sd-head-close:hover { color: #f1f5f9; }

/* ── Área de mensagens ── */
.sd-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.sd-msgs::-webkit-scrollbar { width: 3px; }
.sd-msgs::-webkit-scrollbar-thumb { background: rgba(168,85,247,.3); border-radius: 2px; }

/* ── Linhas de mensagem ── */
.sd-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    animation: sdMsgIn .28s ease;
}
@keyframes sdMsgIn {
    from { opacity: 0; transform: translateY(7px); }
    to   { opacity: 1; transform: none; }
}
.sd-row.user { flex-direction: row-reverse; }

/* ── Avatar pequeno ── */
.sd-av-sm {
    width: 27px;
    height: 27px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(135deg, #a855f7, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
}
.sd-row.user .sd-av-sm {
    background: rgba(168,85,247,.18);
    border: 1px solid rgba(168,85,247,.3);
    color: #a855f7;
    font-size: .7rem;
}

/* ── Bolhas de mensagem ── */
.sd-bbl {
    max-width: 78%;
    padding: 9px 13px;
    border-radius: 15px;
    font-size: .83rem;
    line-height: 1.55;
}
.sd-row.bot .sd-bbl {
    background: #1e293b;
    border: 1px solid rgba(168,85,247,.15);
    color: #e2e8f0;
    border-bottom-left-radius: 3px;
}
.sd-row.user .sd-bbl {
    background: linear-gradient(135deg, rgba(168,85,247,.22), rgba(6,182,212,.15));
    border: 1px solid rgba(168,85,247,.3);
    color: #f1f5f9;
    border-bottom-right-radius: 3px;
}

/* ── Indicador de digitação ── */
.sd-typing { display: flex; gap: 4px; padding: 3px 0; }
.sd-typing i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #a855f7;
    display: block;
    font-style: normal;
    animation: sdTypB 1.2s ease-in-out infinite;
}
.sd-typing i:nth-child(2) { animation-delay: .18s; }
.sd-typing i:nth-child(3) { animation-delay: .36s; }

@keyframes sdTypB {
    0%,80%,100% { transform: translateY(0);  opacity: .35; }
    40%         { transform: translateY(-6px); opacity: 1; }
}

/* ── Opções clicáveis ── */
.sd-opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.sd-opt {
    padding: 7px 13px;
    background: transparent;
    border: 1px solid rgba(168,85,247,.35);
    border-radius: 20px;
    color: #c4b5fd;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: all .18s;
    white-space: nowrap;
}
.sd-opt:hover {
    background: rgba(168,85,247,.15);
    border-color: #a855f7;
    color: #f1f5f9;
    transform: translateY(-1px);
}
.sd-opt.cta {
    background: linear-gradient(135deg, #a855f7, #06b6d4);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 14px rgba(168,85,247,.35);
}
.sd-opt.cta:hover { box-shadow: 0 6px 20px rgba(168,85,247,.5); }
.sd-opt:disabled  { opacity: .4; pointer-events: none; }

/* ── Área de input ── */
.sd-input-row {
    border-top: 1px solid rgba(168,85,247,.15);
    padding: 9px 11px 10px;
    display: flex;
    gap: 8px;
    align-items: center;
    background: #0f172a;
    flex-shrink: 0;
}
#sd-txt {
    flex: 1;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(168,85,247,.2);
    border-radius: 20px;
    padding: 8px 13px;
    color: #f1f5f9;
    font-size: .82rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
    resize: none;
    transition: border-color .2s;
    line-height: 1.4;
}
#sd-txt:focus       { border-color: rgba(168,85,247,.5); }
#sd-txt::placeholder{ color: #475569; }

#sd-send {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(135deg, #a855f7, #06b6d4);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(168,85,247,.35);
    transition: transform .18s;
}
#sd-send:hover { transform: scale(1.1); }
#sd-send svg   { width: 15px; height: 15px; fill: white; margin-left: 2px; }

/* ── Rodapé do painel ── */
.sd-footer {
    text-align: center;
    font-size: .6rem;
    color: #334155;
    padding: 3px 0 5px;
    background: #0f172a;
    flex-shrink: 0;
    letter-spacing: .05em;
}
