/* IV Painel — Chat flutuante de WhatsApp (frontend público).
   Adaptado do widget da SEMADI (prefixo swc- → ivw-). Verde WhatsApp. */

.ivw { --ivw-cor: #25d366; --ivw-cor-d: #1da851;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.ivw *, .ivw *::before, .ivw *::after { box-sizing: border-box; }

/* ── Launcher ── */
.ivw-launcher {
    position: fixed; bottom: 24px; right: 24px; z-index: 99999;
    width: 60px; height: 60px; border-radius: 50% !important;
    background: var(--ivw-cor) !important; border: none !important; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 24px rgba(37,211,102,0.45);
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s;
    animation: ivwPulse 2.6s infinite;
}
.ivw-launcher:hover { transform: scale(1.08); box-shadow: 0 10px 32px rgba(37,211,102,0.55); }
.ivw-launcher svg { width: 32px; height: 32px; fill: #fff !important; }
@keyframes ivwPulse { 0%{box-shadow:0 6px 24px rgba(37,211,102,0.45),0 0 0 0 rgba(37,211,102,0.5)} 70%{box-shadow:0 6px 24px rgba(37,211,102,0.45),0 0 0 16px rgba(37,211,102,0)} 100%{box-shadow:0 6px 24px rgba(37,211,102,0.45),0 0 0 0 rgba(37,211,102,0)} }
.ivw-launcher__badge {
    position: absolute; top: -2px; right: -2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #ef4444; color: #fff; font-size: 11px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}
.ivw.is-open .ivw-launcher { animation: none; }

/* ── Painel ── */
.ivw-panel {
    position: fixed; bottom: 96px; right: 24px; z-index: 99999;
    width: 360px; max-width: calc(100vw - 32px);
    background: #fff; border-radius: 18px; overflow: hidden;
    box-shadow: 0 18px 60px rgba(0,0,0,0.28);
    opacity: 0; transform: translateY(20px) scale(0.96);
    pointer-events: none; transition: all 0.3s cubic-bezier(0.34,1.4,0.64,1);
}
.ivw.is-open .ivw-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }

/* Header */
.ivw-head {
    background: linear-gradient(135deg, #075E54, #128C7E) !important;
    padding: 18px 18px 16px; display: flex; align-items: center; gap: 12px; position: relative;
}
.ivw-head__bg { position: absolute; inset: 0; opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M20 20m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0' fill='%23fff'/%3E%3C/svg%3E"); }
.ivw-head__avatar {
    width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
    background: rgba(255,255,255,0.2); overflow: hidden; position: relative; z-index: 1;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.ivw-head__avatar img { width: 100%; height: 100%; object-fit: cover; }
.ivw-head__info { flex: 1; min-width: 0; position: relative; z-index: 1; }
.ivw-head__name { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.ivw-head__sub { font-size: 12px; color: rgba(255,255,255,0.8); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.ivw-head__dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; display: inline-block; }
.ivw-head__close {
    background: rgba(255,255,255,0.15) !important; border: none !important; cursor: pointer; color: #fff !important;
    width: 30px; height: 30px; border-radius: 50% !important; font-size: 16px; position: relative; z-index: 1;
    display: flex; align-items: center; justify-content: center; transition: background 0.2s; flex-shrink: 0;
}
.ivw-head__close:hover { background: rgba(255,255,255,0.28) !important; }

/* Body */
.ivw-body {
    background: #e5ddd5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cg fill='%23d9d0c5' fill-opacity='0.4'%3E%3Ccircle cx='30' cy='30' r='1.5'/%3E%3C/g%3E%3C/svg%3E");
    padding: 18px 16px; max-height: 380px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 10px;
}
.ivw-bubble {
    max-width: 85%; padding: 9px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.5;
    box-shadow: 0 1px 1px rgba(0,0,0,0.08); animation: ivwBubbleIn 0.3s both; word-wrap: break-word;
}
@keyframes ivwBubbleIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }
.ivw-bubble--bot  { background: #fff !important; color: #303030 !important; align-self: flex-start; border-top-left-radius: 3px; }
.ivw-bubble--user { background: #dcf8c6 !important; color: #303030 !important; align-self: flex-end; border-top-right-radius: 3px; }
.ivw-bubble__time { display: block; font-size: 10px; color: #8696a0; text-align: right; margin-top: 3px; }

/* Quick replies */
.ivw-quick { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; align-self: flex-start; max-width: 90%; }
.ivw-quick__btn {
    background: #fff !important; border: 1.5px solid var(--ivw-cor) !important; color: var(--ivw-cor) !important;
    border-radius: 18px !important; padding: 8px 14px; font-size: 13px; font-weight: 600;
    cursor: pointer; text-align: left; transition: all 0.2s; font-family: inherit;
}
.ivw-quick__btn:hover { background: var(--ivw-cor) !important; color: #fff !important; }

/* CTA WhatsApp */
.ivw-cta {
    display: inline-flex; align-items: center; gap: 8px; align-self: center;
    background: var(--ivw-cor) !important; color: #fff !important; text-decoration: none !important;
    padding: 11px 22px; border-radius: 24px !important; font-size: 13.5px; font-weight: 700;
    margin-top: 6px; box-shadow: 0 4px 14px rgba(37,211,102,0.4); transition: all 0.2s;
    animation: ivwBubbleIn 0.3s both;
}
.ivw-cta:hover { background: var(--ivw-cor-d) !important; transform: translateY(-2px); color: #fff !important; }
.ivw-cta svg { width: 18px; height: 18px; fill: #fff !important; }

/* Footer input */
.ivw-foot { background: #f0f0f0; padding: 10px 12px; display: flex; gap: 8px; align-items: center; }
.ivw-foot__input {
    flex: 1; border: none !important; border-radius: 22px !important; padding: 10px 16px; font-size: 13.5px;
    background: #fff !important; outline: none; font-family: inherit; color: #303030 !important;
}
.ivw-foot__send {
    width: 42px; height: 42px; border-radius: 50% !important; background: var(--ivw-cor) !important; border: none !important;
    cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.2s;
}
.ivw-foot__send:hover { background: var(--ivw-cor-d) !important; }
.ivw-foot__send svg { width: 20px; height: 20px; fill: #fff !important; }

.ivw-powered { text-align: center; font-size: 10px; color: #8696a0; padding: 6px; background: #f0f0f0; }

@media (max-width: 480px) {
    .ivw-panel { width: calc(100vw - 24px); right: 12px; bottom: 90px; }
    .ivw-launcher { bottom: 18px; right: 18px; }
}
