/* Iris Chat Widget — AchouMudou
 * Adaptado de self-chat/assets/chat.css.
 * Alterações: cores ajustadas para a identidade visual do portal (âmbar #fcb344).
 */

:root {
    --selfchat-brand:      #fcb344;
    --selfchat-brand-dark: #e09520;
    --selfchat-brand-light:#fff4e0;
    --selfchat-green:      #25d366;
    --selfchat-white:      #ffffff;
    --selfchat-text:       #1a1a2e;
    --selfchat-muted:      #7a7a8a;
    --selfchat-border:     #e0e0ec;
    --selfchat-shadow:     0 8px 40px rgba(30,40,80,.18), 0 2px 8px rgba(30,40,80,.10);
    --selfchat-radius:     18px;
    --selfchat-font-body:  system-ui, -apple-system, sans-serif;
    --selfchat-w:          360px;
    --selfchat-h:          520px;
    --selfchat-bottom:     28px;
    --selfchat-right:      28px;
}

/* ── Container ── */
#selfchat-widget {
    position: fixed;
    bottom: var(--selfchat-bottom);
    right:  var(--selfchat-right);
    z-index: 99999;
    font-family: var(--selfchat-font-body);
    font-size: 14px;
    line-height: 1.5;
}

/* ── Panel ── */
#selfchat-panel {
    position: fixed;
    bottom: var(--selfchat-bottom);
    right: var(--selfchat-right);
    width: var(--selfchat-w);
    max-height: var(--selfchat-h);
    background: var(--selfchat-white);
    border-radius: var(--selfchat-radius);
    box-shadow: var(--selfchat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: selfchat-open .25s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes selfchat-open {
    from { opacity: 0; transform: scale(.85) translateY(12px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}
#selfchat-panel[hidden] { display: none !important; }

/* ── Header — gradiente âmbar ── */
#selfchat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--selfchat-brand) 0%, var(--selfchat-brand-dark) 100%);
    color: #1a1a2e;
    flex-shrink: 0;
}
.selfchat-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255,255,255,.25);
    display: flex; align-items: center; justify-content: center;
}
.selfchat-avatar svg { width: 38px; height: 38px; }
.selfchat-avatar img { width: 38px; height: 38px; object-fit: cover; border-radius: 50%; display: block; }
.selfchat-header-info {
    display: flex; flex-direction: column; flex: 1;
}
.selfchat-name {
    font-size: 17px; font-weight: 600;
    letter-spacing: .3px;
    color: #1a1a2e;
}
.selfchat-status {
    font-size: 11px; opacity: .75;
    display: flex; align-items: center; gap: 5px;
    color: #1a1a2e;
}
.selfchat-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #2d7a2d;
    animation: selfchat-blink 2s ease-in-out infinite;
}
@keyframes selfchat-blink {
    0%,100% { opacity: 1; } 50% { opacity: .4; }
}
#selfchat-minimize {
    background: none; border: none; color: rgba(26,26,46,.5);
    cursor: pointer; padding: 4px; display: flex;
    transition: color .15s;
}
#selfchat-minimize:hover { color: #1a1a2e; }
#selfchat-minimize svg {
    width: 18px; height: 18px;
    transition: transform .25s ease;
    transform: rotate(180deg);
}
#selfchat-panel.is-minimized #selfchat-minimize svg {
    transform: rotate(0deg);
}

/* ── Estado minimizado ── */
#selfchat-panel {
    transition: height .25s ease;
}
#selfchat-panel.is-minimized #selfchat-messages,
#selfchat-panel.is-minimized #selfchat-footer,
#selfchat-panel.is-minimized #selfchat-wpp {
    display: none;
}

/* ── Messages ── */
#selfchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    background: #f8f9fc;
}
#selfchat-messages::-webkit-scrollbar { width: 4px; }
#selfchat-messages::-webkit-scrollbar-thumb { background: var(--selfchat-border); border-radius: 2px; }

.selfchat-msg {
    max-width: 82%;
    animation: selfchat-msg-in .2s ease both;
}
@keyframes selfchat-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.selfchat-msg p {
    margin: 0;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.55;
}
.selfchat-msg p strong,
.selfchat-msg p b      { font-weight: 700; }
.selfchat-msg p em,
.selfchat-msg p i      { font-style: italic; }

.selfchat-msg--bot { align-self: flex-start; }
.selfchat-msg--bot p {
    background: var(--selfchat-white);
    color: var(--selfchat-text);
    border: 1px solid var(--selfchat-border);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
/* Balão do usuário — gradiente âmbar; texto escuro para contraste */
.selfchat-msg--user { align-self: flex-end; }
.selfchat-msg--user p {
    background: linear-gradient(135deg, var(--selfchat-brand) 0%, var(--selfchat-brand-dark) 100%);
    color: #7a4a00;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.selfchat-typing p {
    display: flex; align-items: center; gap: 4px;
    padding: 12px 16px;
}
.selfchat-typing span {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--selfchat-muted);
    animation: selfchat-bounce .9s ease-in-out infinite;
}
.selfchat-typing span:nth-child(2) { animation-delay: .15s; }
.selfchat-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes selfchat-bounce {
    0%,80%,100% { transform: translateY(0); opacity:.4; }
    40%          { transform: translateY(-5px); opacity:1; }
}

/* ── Footer ── */
#selfchat-footer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--selfchat-border);
    background: var(--selfchat-white);
    flex-shrink: 0;
}
#selfchat-input {
    flex: 1;
    border: 1.5px solid var(--selfchat-border);
    border-radius: 12px;
    padding: 9px 12px;
    font-family: var(--selfchat-font-body);
    font-size: 13.5px;
    color: var(--selfchat-text);
    resize: none;
    outline: none;
    max-height: 96px;
    overflow-y: auto;
    transition: border-color .15s;
    background: #f8f9fc;
    line-height: 1.5;
    margin: 0px;
}
#selfchat-input:focus { border-color: var(--selfchat-brand); }
#selfchat-input::placeholder { color: var(--selfchat-muted); }
#selfchat-send {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--selfchat-brand) 0%, var(--selfchat-brand-dark) 100%);
    color: #1a1a2e;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: transform .15s, opacity .15s;
}
#selfchat-send:hover { transform: scale(1.08); }
#selfchat-send:disabled { opacity: .45; cursor: default; transform: none; }
#selfchat-send svg { width: 16px; height: 16px; }

/* ── WhatsApp ── */
#selfchat-wpp {
    display: none;
    padding: 8px 12px 12px;
    background: var(--selfchat-white);
    flex-shrink: 0;
}
#selfchat-wpp.is-visible {
    display: block;
}
#selfchat-wpp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 9px;
    border-radius: 10px;
    background: #25d366;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: filter .15s;
}
#selfchat-wpp-btn:hover { filter: brightness(1.08); }

/* ── Mobile ── */
@media (max-width: 480px) {
    :root {
        --selfchat-w: calc(100vw - 24px);
        --selfchat-bottom: 16px;
        --selfchat-right: 12px;
    }
    #selfchat-panel {
        max-height: 75vh;
    }
}
