/* ==========================================================================
   rca-chat.css - Widget WhatsApp Simulator com IA para RCA Advocacia
   ========================================================================== */

:root {
    --wa-green: #00A884;
    --wa-green-dark: #075E54;
    --wa-green-light: #25D366;
    --wa-bg-chat: #EFEAE2;
    --wa-bubble-bot: #FFFFFF;
    --wa-bubble-user: #D9FDD3;
    --wa-text-main: #111B21;
    --wa-text-muted: #667781;
    --wa-check-blue: #53BDEB;
    --wa-border: #E9EDEF;
    --rca-navy: #0E1E38;
    --rca-gold: #C5A880;
}

/* ── Botão Flutuante e Teaser ── */
.rca-wa-launcher-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Balão Teaser de Notificação */
.rca-wa-teaser {
    background: #FFFFFF;
    color: var(--wa-text-main);
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.16);
    max-width: 280px;
    cursor: pointer;
    font-size: 13.5px;
    line-height: 1.4;
    position: relative;
    border: 1px solid rgba(0,0,0,0.06);
    animation: rcaFadeSlideUp 0.4s ease forwards;
    transition: transform 0.2s ease;
}

.rca-wa-teaser:hover {
    transform: translateY(-2px);
}

.rca-wa-teaser-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-weight: 700;
    font-size: 12.5px;
    color: var(--wa-green-dark);
}

.rca-wa-teaser-dot {
    width: 8px;
    height: 8px;
    background: var(--wa-green-light);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px var(--wa-green-light);
    animation: rcaPulse 2s infinite;
}

.rca-wa-teaser-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    font-size: 15px;
    color: #999;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
}

.rca-wa-teaser-close:hover {
    color: #333;
}

/* Botão Redondo do WhatsApp */
.rca-wa-btn-launcher {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: #25D366;
    color: #FFFFFF;
    border: none;
    outline: none;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.rca-wa-btn-launcher:hover {
    transform: scale(1.08);
    background: #20BA5A;
}

.rca-wa-btn-launcher svg {
    width: 34px;
    height: 34px;
    fill: currentColor;
    transition: transform 0.3s ease;
}

/* Badge de Notificação */
.rca-wa-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #E53935;
    color: #FFF;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #FFF;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* ── Janela do Chat (WhatsApp Window) ── */
.rca-wa-chat-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 48px);
    background: var(--wa-bg-chat);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transform-origin: bottom right;
    animation: rcaWindowOpen 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.rca-wa-chat-window.rca-hidden {
    display: none !important;
}

/* Header do WhatsApp */
.rca-wa-header {
    background: var(--wa-green-dark);
    color: #FFFFFF;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    flex-shrink: 0;
}

.rca-wa-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rca-wa-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.rca-wa-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #E0E0E0;
    border: 2px solid rgba(255, 255, 255, 0.6);
}

.rca-wa-status-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 11px;
    height: 11px;
    background: #25D366;
    border: 2px solid var(--wa-green-dark);
    border-radius: 50%;
}

.rca-wa-header-info {
    display: flex;
    flex-direction: column;
}

.rca-wa-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rca-wa-subtitle {
    font-size: 11.5px;
    opacity: 0.9;
    color: #D1E7DD;
    margin-top: 2px;
}

.rca-wa-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rca-wa-action-btn {
    background: none;
    border: none;
    color: #FFFFFF;
    opacity: 0.85;
    padding: 6px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.rca-wa-action-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

/* Área de Mensagens */
.rca-wa-messages-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: var(--wa-bg-chat);
    background-image: radial-gradient(#d3cabd 1px, transparent 1px);
    background-size: 16px 16px;
    scroll-behavior: smooth;
}

/* Aviso de Criptografia / OAB */
.rca-wa-security-notice {
    align-self: center;
    background: #FFF3CD;
    color: #664D03;
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    max-width: 90%;
    margin-bottom: 6px;
    border: 1px solid #FFE69C;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Balões de Mensagem */
.rca-wa-msg {
    max-width: 82%;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(0,0,0,0.13);
    animation: rcaMsgPop 0.25s ease-out;
}

.rca-wa-msg-bot {
    align-self: flex-start;
    background: var(--wa-bubble-bot);
    color: var(--wa-text-main);
    border-top-left-radius: 0;
}

.rca-wa-msg-user {
    align-self: flex-end;
    background: var(--wa-bubble-user);
    color: var(--wa-text-main);
    border-top-right-radius: 0;
}

.rca-wa-msg-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    font-size: 10.5px;
    color: var(--wa-text-muted);
    margin-top: 4px;
    margin-left: 8px;
    float: right;
}

.rca-wa-checks {
    color: var(--wa-check-blue);
    font-size: 13px;
    line-height: 1;
}

/* Digitando Indicator */
.rca-wa-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: #FFFFFF;
    border-radius: 12px;
    border-top-left-radius: 0;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    align-self: flex-start;
    animation: rcaMsgPop 0.2s ease-out;
}

.rca-wa-typing-dot {
    width: 6px;
    height: 6px;
    background: #90A4AE;
    border-radius: 50%;
    animation: rcaTyping 1.4s infinite ease-in-out both;
}

.rca-wa-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.rca-wa-typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* Quick Reply Chips */
.rca-wa-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    align-self: flex-start;
    max-width: 95%;
}

.rca-wa-chip-btn {
    background: #FFFFFF;
    color: var(--wa-green-dark);
    border: 1px solid var(--wa-green);
    border-radius: 16px;
    padding: 7px 12px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
    text-align: left;
}

.rca-wa-chip-btn:hover {
    background: var(--wa-green);
    color: #FFFFFF;
    transform: translateY(-1px);
}

.rca-wa-chip-btn.rca-chip-cta {
    background: #25D366;
    color: #FFFFFF;
    border-color: #25D366;
    font-size: 13px;
    padding: 10px 16px;
    width: 100%;
    text-align: center;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

.rca-wa-chip-btn.rca-chip-cta:hover {
    background: #1FB355;
    transform: scale(1.02);
}

/* Barra de Digitação (Footer) */
.rca-wa-footer {
    background: #F0F2F5;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--wa-border);
    flex-shrink: 0;
}

.rca-wa-input-wrap {
    flex: 1;
    background: #FFFFFF;
    border-radius: 20px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.rca-wa-input {
    width: 100%;
    border: none;
    outline: none;
    padding: 10px 0;
    font-size: 14px;
    color: var(--wa-text-main);
    background: transparent;
    font-family: inherit;
}

.rca-wa-input::placeholder {
    color: #8696A0;
}

.rca-wa-btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--wa-green-dark);
    color: #FFFFFF;
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.rca-wa-btn-send:hover {
    background: var(--wa-green);
    transform: scale(1.05);
}

.rca-wa-btn-send svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    margin-left: 2px;
}

/* ── Animações ── */
@keyframes rcaFadeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes rcaWindowOpen {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes rcaMsgPop {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes rcaPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(37, 211, 102, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

@keyframes rcaTyping {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ── Responsividade Mobile ── */
@media (max-width: 480px) {
    .rca-wa-launcher-container {
        bottom: 16px;
        right: 16px;
    }

    .rca-wa-chat-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .rca-wa-header {
        border-radius: 0;
        padding: 14px 16px;
    }
}
