/**
 * Imob Chat IA — widget de chat flutuante.
 * Variáveis próprias (não depende de --at-* do tema, plugin autocontido).
 */
#ica-chat-root {
    --ica-accent: #c8841a;
    --ica-accent-dark: #a06612;
    --ica-ink: #1a1611;
    --ica-paper: #faf8f4;
    --ica-surface: #ffffff;
    --ica-border: #e6ddd0;
    --ica-bot-bubble: #f3ede1;
    --ica-lead-bubble: #c8841a;
    all: initial;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    position: fixed;
    z-index: 999999;
    right: 20px;
    bottom: 20px;
    display: block;
}

#ica-chat-root * {
    box-sizing: border-box;
}

/*
 * .ica-panel/.ica-teaser abaixo também definem `display` (flex/block) com a
 * mesma especificidade do `[hidden]` do user-agent stylesheet — sem essa
 * regra, minha própria declaração de display vence por ordem de origem e o
 * atributo `hidden` (usado pelo JS pra abrir/fechar) não tem efeito nenhum.
 * !important garante que hidden sempre vence, seja qual for a origem.
 */
#ica-chat-root [hidden] {
    display: none !important;
}

.ica-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--ica-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    transition: transform .15s ease;
}
.ica-bubble:hover {
    transform: scale(1.06);
    background: var(--ica-accent-dark);
}
.ica-bubble img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.ica-teaser {
    position: absolute;
    bottom: 72px;
    right: 0;
    max-width: 220px;
    background: var(--ica-surface);
    color: var(--ica-ink);
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    font-size: 13px;
    line-height: 1.4;
}

.ica-panel {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 340px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 140px);
    background: var(--ica-paper);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ica-panel__header {
    background: var(--ica-ink);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ica-panel__header img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
}
.ica-panel__header-text strong {
    display: block;
    font-size: 14px;
}
.ica-panel__header-text span {
    font-size: 11px;
    opacity: .75;
}
.ica-panel__close {
    margin-left: auto;
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    opacity: .8;
}
.ica-panel__close:hover {
    opacity: 1;
}

.ica-panel__messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ica-msg {
    max-width: 80%;
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}
.ica-msg--bot {
    align-self: flex-start;
    background: var(--ica-bot-bubble);
    color: var(--ica-ink);
    border-bottom-left-radius: 4px;
}
.ica-msg--lead {
    align-self: flex-end;
    background: var(--ica-lead-bubble);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.ica-msg a {
    color: inherit;
    text-decoration: underline;
}

.ica-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 10px 12px;
    background: var(--ica-bot-bubble);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}
.ica-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9a8f7a;
    animation: ica-blink 1.2s infinite ease-in-out;
}
.ica-typing span:nth-child(2) { animation-delay: .2s; }
.ica-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ica-blink {
    0%, 80%, 100% { opacity: .3; }
    40% { opacity: 1; }
}

.ica-identify {
    border: 1px solid var(--ica-border);
    border-radius: 12px;
    padding: 10px;
    background: var(--ica-surface);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ica-identify input {
    padding: 8px 10px;
    border: 1px solid var(--ica-border);
    border-radius: 8px;
    font-size: 13px;
}
.ica-identify button {
    background: var(--ica-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
}
.ica-identify__skip {
    background: none !important;
    color: #8a8272 !important;
    text-decoration: underline;
    font-size: 12px !important;
    padding: 2px !important;
}

.ica-panel__whatsapp {
    text-align: center;
    padding: 6px;
    font-size: 12px;
    background: var(--ica-surface);
    border-top: 1px solid var(--ica-border);
}
.ica-panel__whatsapp a {
    color: #1f7a3d;
    text-decoration: none;
    font-weight: 600;
}
.ica-panel__whatsapp a:hover {
    text-decoration: underline;
}

.ica-panel__form {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--ica-border);
    background: var(--ica-surface);
}
.ica-panel__form textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--ica-border);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    max-height: 70px;
}
.ica-panel__form button {
    background: var(--ica-accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0 14px;
    cursor: pointer;
    font-size: 16px;
}
.ica-panel__form button:disabled {
    opacity: .5;
    cursor: default;
}

@media (max-width: 480px) {
    #ica-chat-root {
        right: 12px;
        bottom: 12px;
    }
    .ica-panel {
        width: calc(100vw - 24px);
        right: -8px;
    }
}
