/* =========================================================
   Chat UI — WhatsApp Premium
   Fonte maior (público 40+), animações cinematográficas,
   sombras ricas, sensação de app nativo de alta qualidade.
   Mantém todas as classes originais.
========================================================= */

/* ---------- Tokens ---------- */

:root {
    --bg:            #ddd5ca;
    --chat:          #ece5db;
    --line:          #cfc8be;
    --wpp-header:    #075e54;
    --wpp-accent:    #25D366;
    --wpp-dark:      #1aaa50;
    --bubble-in:     #ffffff;
    --bubble-out:    #d9f7be;
    --text:          #0d1a14;
    --muted:         #607068;
    --shadow:        0 1px 2px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.05);
    --shadow-up:     0 4px 18px rgba(0,0,0,.12), 0 1px 4px rgba(0,0,0,.07);
    --radius-bubble: 18px;
}

/* ---------- Reset / Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { /* scroll-behavior removido — interfere com scroll programático no mobile */ }

body {
    margin: 0;
    font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 17px;
    color: var(--text);
    background:
        radial-gradient(ellipse 900px 600px at 110% -10%, rgba(37,211,102,.06), transparent 55%),
        radial-gradient(ellipse 800px 700px at -10% 110%, rgba(7,94,84,.07),    transparent 50%),
        var(--bg);
}

/* ---------- App shell ---------- */

.app {
    height: 100vh;
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: var(--chat);
    position: relative;
    box-shadow:
        0 0 0 1px rgba(0,0,0,.06),
        0 8px 40px rgba(0,0,0,.18),
        0 2px 8px rgba(0,0,0,.10);
    border-radius: 24px;
    overflow: hidden;
}

/* ---------- Header ---------- */

.wpp-header {
    height: 68px;
    background:
        linear-gradient(108deg, rgba(255,255,255,.07) 0%, transparent 45%),
        linear-gradient(180deg, #0b7a6a 0%, #054f44 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow:
        0 1px 0 rgba(255,255,255,.08) inset,
        0 6px 28px rgba(5,79,68,.45),
        0 2px 8px rgba(0,0,0,.18);
    backdrop-filter: saturate(1.6) blur(14px);
}

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

.wpp-header .back {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    transition: background .15s, transform .12s;
    opacity: .9;
}
.wpp-header .back:hover  { background: rgba(255,255,255,.14); opacity: 1; }
.wpp-header .back:active { transform: scale(.93); }

/* Avatar com anel verde pulsante */
.wpp-header .avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow:
        0 0 0 2.5px rgba(87,255,156,.65),
        0 0 0 5px   rgba(87,255,156,.14),
        0 4px 14px  rgba(0,0,0,.30);
    animation: avatarRing 3.2s ease-in-out infinite;
    transition: transform .2s ease;
    cursor: pointer;
}
.wpp-header .avatar:hover { transform: scale(1.07); }

/* box-shadow animado substituído por opacity — composite only, zero repaint */
@keyframes avatarRing {
    0%, 100% { opacity: 1; }
    50%       { opacity: .75; }
}

/* Nome + status */
.wpp-header .meta {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    line-height: 1.1;
}

.wpp-header .meta .name,
.wpp-header #contact-name {
    display: block !important;
    color: #fff !important;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: .1px;
    margin: 0 0 2px;
    text-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.wpp-header .meta .status,
.wpp-header #status {
    display: block !important;
    color: rgba(220,255,238,.92) !important;
    font-size: 12.5px;
    margin: 0 !important;
    position: relative;
    padding-left: 13px;
    letter-spacing: .2px;
}

.wpp-header #status::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6dffb0;
    animation: statusGlow 2.2s ease-in-out infinite;
}

@keyframes statusGlow {
    0%, 100% { opacity: 1; }
    50%       { opacity: .5; }
}

/* Ícones da direita */
.wpp-header .right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    appearance: none;
    background: transparent;
    border: none;
    padding: 7px;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: #fff;
    border-radius: 12px;
    opacity: .88;
    transition: opacity .15s, transform .12s, background .15s;
}
.icon-btn svg { width: 22px; height: 22px; display: block; fill: currentColor; }
.icon-btn:hover  { opacity: 1; background: rgba(255,255,255,.13); }
.icon-btn:active { transform: scale(.93); }

/* ---------- Área de mensagens ---------- */

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 22px 20px 130px;
    /* scroll-behavior: smooth removido — causa jank no scroll programático mobile */
}

.messages::-webkit-scrollbar       { width: 5px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #a8d4b8, #6db890);
    border-radius: 10px;
}
.messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #7fc4a0, #3fa870);
}

/* Banner oculto */
.banner { display: none !important; }

/* ---------- Rows ---------- */

.row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin: 6px 0;
    animation: rowIn .3s cubic-bezier(.22,.9,.36,1) both;
    contain: layout style; /* isola reflow — impede que bolhas novas recalculem layout inteiro */
}

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

.row.left  { justify-content: flex-start; }
.row.right { justify-content: flex-end; }

.row .thumb {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 36px;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.row .thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Bolhas ---------- */

.bubble {
    max-width: min(72vw, 680px);
    background: var(--bubble-in);
    border: 1px solid rgba(0,0,0,.05);
    border-radius: var(--radius-bubble);
    padding: 12px 15px 9px;
    position: relative;
    box-shadow: var(--shadow);
    font-size: 17px;
    line-height: 1.55;
    letter-spacing: .1px;
    transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s;
}

/* Durante digitação: desativa transition e will-change */
.bubble.typing-text {
    transition: none;
    will-change: contents;
}

.bubble:hover {
    will-change: transform;
    transform: translateY(-2px) scale(1.006);
    box-shadow: var(--shadow-up);
}

.right .bubble {
    background: var(--bubble-out);
    color: #0c2218;
    border-color: rgba(26,170,80,.18);
}

/* Caudas — sem filter (pesado, força repaint) */
.left .bubble::before {
    content: "";
    position: absolute;
    left: -7px; top: 10px;
    width: 0; height: 0;
    border: 8px solid transparent;
    border-right-color: var(--bubble-in);
}

.right .bubble::after {
    content: "";
    position: absolute;
    right: -7px; top: 10px;
    width: 0; height: 0;
    border: 8px solid transparent;
    border-left-color: var(--bubble-out);
}

/* Entrada das bolhas */
.row.left  .bubble.enter { animation: msgInLeft  .34s cubic-bezier(.22,.9,.36,1) both; }
.row.right .bubble.enter { animation: msgInRight .28s cubic-bezier(.22,.9,.36,1) both; }

@keyframes msgInLeft {
    from { transform: translateX(-16px) translateY(4px) scale(.95); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
@keyframes msgInRight {
    from { transform: translateX(16px) translateY(4px) scale(.95); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

/* ---------- Meta (horário + checks) ---------- */

.meta {
    display: flex;
    gap: 7px;
    align-items: center;
    color: var(--muted);
    font-size: 12.5px;
    margin-top: 5px;
}
.row.right .meta  { justify-content: flex-end; }
.time             { opacity: .85; }
.checks           { opacity: .9; transition: color .3s; }
.meta .checks.seen { color: #34b7f1; }

/* ---------- Card de áudio ---------- */

.audio {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 260px;
}

.play {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(145deg, #1bc47d, #075e54);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 14px rgba(7,94,84,.35), 0 2px 4px rgba(0,0,0,.10);
    transition: transform .15s, filter .15s, box-shadow .15s;
}
.play:hover  { filter: brightness(1.08); box-shadow: 0 6px 20px rgba(7,94,84,.45); }
.play:active { transform: scale(.93); }
.play .ic    { width: 18px; height: 18px; display: block; }

.tline {
    flex: 1;
    height: 4px;
    background: rgba(0,0,0,.1);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}
.tline i {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, #34b7f1, #25D366);
    border-radius: 4px;
    transition: width .1s linear;
}

.aud-time {
    font-size: 12.5px;
    color: var(--muted);
    min-width: 72px;
    text-align: right;
}

/* ---------- Card de vídeo MP4 ---------- */

.video-card {
    width: min(320px, 72vw);
    max-width: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    background: #000;
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
}

.chat-video {
    width: 100%;
    max-height: 480px;
    display: block;
    object-fit: cover;
    background: #000;
    border-radius: 14px;
}

.chat-video::-webkit-media-controls,
.chat-video::-webkit-media-controls-panel,
.chat-video::-webkit-media-controls-play-button,
.chat-video::-webkit-media-controls-timeline,
.chat-video::-webkit-media-controls-current-time-display,
.chat-video::-webkit-media-controls-time-remaining-display,
.chat-video::-webkit-media-controls-mute-button,
.chat-video::-webkit-media-controls-toggle-closed-captions-button,
.chat-video::-webkit-media-controls-volume-slider,
.chat-video::-webkit-media-controls-fullscreen-button {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.video-replay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(.92);
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    background: linear-gradient(145deg, #1bc47d, #075e54);
    color: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease, filter .15s ease;
}

.video-replay.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.video-replay:hover { filter: brightness(1.08); }
.video-replay:active { transform: translate(-50%, -50%) scale(.94); }
.video-replay .ic { width: 24px; height: 24px; display: block; }

/* ---------- Barra de input ---------- */

.inputbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background:
        linear-gradient(180deg,
            rgba(236,229,219,0)    0%,
            rgba(236,229,219,.96) 28%,
            rgba(236,229,219,1)   100%);
    border-top: 1px solid rgba(0,0,0,.07);
    backdrop-filter: saturate(1.2) blur(16px);
}

.inputbar input {
    flex: 1 1 880px;
    min-width: 0;
    max-width: 1100px;
    height: 52px;
    border-radius: 30px;
    border: 1.5px solid #d2cec8;
    background: #fff;
    padding: 0 20px;
    font-size: 17px;
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0,0,0,.06) inset;
    transition: border-color .2s, box-shadow .2s;
}
.inputbar input::placeholder { color: #9aada5; font-size: 16px; }
.inputbar input:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 3.5px rgba(37,211,102,.18), 0 2px 10px rgba(37,211,102,.08) inset;
}

/* Botão enviar */
.inputbar button {
    flex: 0 0 56px;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    border: none !important;
    position: relative !important;
    display: inline-block !important;
    cursor: pointer !important;
    background: linear-gradient(145deg, #2de870, #0ea84a) !important;
    box-shadow: 0 8px 22px rgba(37,211,102,.38), inset 0 1px 0 rgba(255,255,255,.2) !important;
    color: transparent !important;
    transition: transform .13s, filter .13s, box-shadow .13s !important;
}
.inputbar button:hover {
    filter: brightness(1.08) !important;
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 14px 34px rgba(37,211,102,.48), inset 0 1px 0 rgba(255,255,255,.2) !important;
}
.inputbar button:active {
    transform: scale(.93) !important;
    filter: brightness(.96) !important;
}

.inputbar button::before {
    content: "";
    position: absolute;
    left: 50%; top: 50%;
    width: 24px; height: 24px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="white" d="M3 11.3 20.2 3.6c.8-.4 1.7.4 1.3 1.2L14.8 21.1c-.3.8-1.5.8-1.8 0l-2.4-6.1-6.1-2.4c-.8-.3-.8-1.5 0-1.8z"/></svg>') center/contain no-repeat !important;
}

/* ---------- CTA ---------- */

.cta { margin-top: 10px; }

.cta a {
    display: inline-block;
    background: linear-gradient(135deg, #31e876, #0fc453);
    color: #032b18;
    text-decoration: none;
    padding: 13px 22px;
    border-radius: 22px;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: .2px;
    border: 1px solid rgba(37,211,102,.25);
    box-shadow:
        0 0 0 0 rgba(37,211,102,.4),
        0 6px 22px rgba(37,211,102,.28),
        inset 0 1px 0 rgba(255,255,255,.3);
    animation: ctaPulse 2.4s ease-in-out infinite;
    transition: transform .14s, filter .14s, box-shadow .14s;
    position: relative;
    overflow: hidden;
}

.cta a::before {
    content: "";
    position: absolute;
    top: -80%; left: -50%;
    width: 55%; height: 240%;
    background: linear-gradient(110deg, rgba(255,255,255,.22) 0%, rgba(255,255,255,0) 65%);
    transform: skewX(-18deg);
    transition: left .45s ease;
    pointer-events: none;
}
.cta a:hover::before { left: 120%; }

.cta a:hover {
    filter: brightness(1.06);
    transform: translateY(-2px) scale(1.025);
    box-shadow:
        0 0 0 7px rgba(37,211,102,.16),
        0 12px 32px rgba(37,211,102,.36),
        inset 0 1px 0 rgba(255,255,255,.3);
    animation: none;
}
.cta a:active { transform: scale(.97); }

@keyframes ctaPulse {
    0%, 100% {
        box-shadow:
            0 0 0 0   rgba(37,211,102,.4),
            0 6px 22px rgba(37,211,102,.28),
            inset 0 1px 0 rgba(255,255,255,.3);
    }
    50% {
        box-shadow:
            0 0 0 10px rgba(37,211,102,0),
            0 8px 28px rgba(37,211,102,.34),
            inset 0 1px 0 rgba(255,255,255,.3);
    }
}

/* ---------- Chips ---------- */

.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.chip {
    background: #fff;
    border: 1.5px solid #c4e4ce;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 8px rgba(7,94,84,.08);
    transition: transform .16s cubic-bezier(.2,.9,.4,1), background .15s, border-color .15s, box-shadow .15s;
    position: relative;
    overflow: hidden;
}
.chip::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(37,211,102,.12), transparent);
    opacity: 0;
    transition: opacity .15s;
    border-radius: inherit;
}
.chip:hover {
    background: #ebf9f1;
    border-color: #25D366;
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 6px 20px rgba(37,211,102,.2);
}
.chip:hover::after { opacity: 1; }
.chip:active       { transform: scale(.96); }

/* ---------- Typing indicator ---------- */

.typing-wrap .bubble { background: var(--bubble-in); padding: 14px 18px; }

.typing {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.typing .dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #aac4b8;
    animation: typingBounce 1.4s cubic-bezier(.4,0,.6,1) infinite;
}
.typing .dot:nth-child(2) { animation-delay: .18s; }
.typing .dot:nth-child(3) { animation-delay: .36s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0) scale(1);      opacity: .4; }
    30%            { transform: translateY(-7px) scale(1.2); opacity: 1;  }
}

/* ---------- Recording badge ---------- */

.recording-wrap .bubble {
    background: var(--bubble-in);
    border: 1px solid #c6e8d4;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
}

.recording.pro {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 8px 14px;
    border-radius: 999px;
    color: #2a4438;
    font-size: 15px;
    line-height: 1;
    white-space: nowrap;
}

.recording.pro .mic {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #edfaf3;
    border: 1px solid #b8e8cc;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 0 3px rgba(191,233,207,.2);
}
.recording.pro .mic svg {
    width: 20px; height: 20px;
    fill: #075e54;
    animation: micBreath 2.2s ease-in-out infinite;
}
.recording.pro .mic::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    animation: micPulse 1.7s ease-out infinite;
}
.recording.pro .label { letter-spacing: .2px; color: #2a4438; }

.recording.pro .eq {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    height: 16px;
}
.recording.pro .eq i {
    display: block;
    width: 3px; height: 30%;
    background: #0b5e4f;
    border-radius: 2px;
    transform-origin: center bottom;
    animation: eqBeat 1s ease-in-out infinite;
    opacity: .85;
}
.recording.pro .eq i:nth-child(1) { animation-delay: .00s; }
.recording.pro .eq i:nth-child(2) { animation-delay: .15s; }
.recording.pro .eq i:nth-child(3) { animation-delay: .30s; }
.recording.pro .eq i:nth-child(4) { animation-delay: .45s; }

@keyframes micPulse {
    0%   { box-shadow: 0 0 0 0    rgba(37,211,102,.38); }
    70%  { box-shadow: 0 0 0 14px rgba(37,211,102,0);   }
    100% { box-shadow: 0 0 0 0    rgba(37,211,102,0);   }
}
@keyframes micBreath {
    0%, 100% { transform: scale(1);   }
    50%       { transform: scale(1.1); }
}
@keyframes eqBeat {
    0%, 100% { transform: scaleY(.3); }
    50%       { transform: scaleY(1); }
}

/* ---------- Utilitários ---------- */

.small { font-size: 13px; color: var(--muted); }

/* ---------- Responsivo ---------- */

@media (max-width: 640px) {
    .app {
        border-radius: 0;
        height: 100dvh;
        box-shadow: none;
    }
    .wpp-header {
        height: 62px;
        padding: 0 12px;
    }
    .messages {
        padding: 16px 12px 110px;
    }
    .bubble {
        max-width: 86vw;
        font-size: 17px;
        padding: 10px 13px 8px;
    }
    .wpp-header .meta .name,
    .wpp-header #contact-name { font-size: 16px; }
    .inputbar {
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        gap: 10px;
    }
    .inputbar input {
        height: 50px;
        font-size: 16px;
    }
}

@media (max-width: 740px) {
    .inputbar {
        align-items: center;
        padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    }
    .inputbar input {
        flex: 1 1 auto;
        min-width: 0;
        height: 50px;
        font-size: 16px;
        border-radius: 26px;
    }
    .inputbar button {
        flex: 0 0 58px !important;
        width: 58px !important;
        height: 58px !important;
    }
    .inputbar button::before { width: 23px !important; height: 23px !important; }
}

/* ---------- Acessibilidade ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* ---------- Input pulsante — aguardando nome ---------- */

.inputbar.waiting-name {
    background:
        linear-gradient(180deg,
            rgba(236,229,219,0)    0%,
            rgba(230,248,237,.97) 28%,
            rgba(225,245,232,1)   100%);
}

.inputbar.waiting-name input {
    border-color: #25D366;
    background: #f4fdf7;
    box-shadow:
        0 0 0 0 rgba(37,211,102,.5),
        0 0 0 3.5px rgba(37,211,102,.2);
    animation: inputPulse 1.8s ease-in-out infinite;
}

.inputbar.waiting-name input::placeholder {
    color: #1aaa50;
    font-weight: 600;
}

@keyframes inputPulse {
    0%, 100% {
        box-shadow:
            0 0 0 0    rgba(37,211,102,.5),
            0 0 0 3.5px rgba(37,211,102,.2);
        border-color: #25D366;
    }
    50% {
        box-shadow:
            0 0 0 10px rgba(37,211,102,0),
            0 0 0 3.5px rgba(37,211,102,.4);
        border-color: #0fc453;
    }
}


/* ---------- Ajuste final: vídeo termina sem replay e sem blur ---------- */
.video-card.is-ended:not(.will-blur),
.video-card.is-ended:not(.will-blur) .chat-video {
    filter: none !important;
    opacity: 1 !important;
    transform: none !important;
}

.video-card.is-ended .chat-video {
    pointer-events: none !important;
}

.video-card.is-ended::before,
.video-card.is-ended::after {
    display: none !important;
    content: none !important;
}

.video-replay {
    display: none !important;
}


/* ---------- Ajuste: typewriter sem cursor verde piscante ---------- */
.bubble.typing-text::after {
    content: none !important;
    display: none !important;
}

/* ======================================================
   VIDEOCHAMADA — ícone pulsante + overlay completo
====================================================== */

/* --- Ícone de vídeo pulsante quando disponível --- */

.icon-btn.video-call-active {
    animation: videoBtnPulse 1.8s ease-in-out infinite;
    position: relative;
}
.icon-btn.video-call-active svg {
    filter: drop-shadow(0 0 6px rgba(37,211,102,.9));
}
.icon-btn.video-call-active::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 14px;
    border: 2px solid rgba(37,211,102,.7);
    animation: videoBtnRing 1.8s ease-in-out infinite;
    pointer-events: none;
}
@keyframes videoBtnPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .85; transform: scale(1.12); }
}
@keyframes videoBtnRing {
    0%   { opacity: .9; transform: scale(1); }
    70%  { opacity: 0;  transform: scale(1.5); }
    100% { opacity: 0;  transform: scale(1.5); }
}

/* --- Overlay base --- */

#vcall-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: #000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    max-width: 1280px;
    margin: 0 auto;
    overflow: hidden;
}
#vcall-overlay.open {
    display: flex;
    animation: vcallFadeIn .22s ease both;
}
@keyframes vcallFadeIn {
    from { opacity: 0; transform: scale(.97); }
    to   { opacity: 1; transform: none; }
}

/* Vídeo de fundo sempre borrado */
/* --- Tela de "chamando" --- */

#vcall-ringing {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 16px;
    padding: 40px 20px;
}

.vcall-ringing-avatar {
    position: relative;
    width: 110px;
    height: 110px;
    margin-bottom: 8px;
}
.vcall-ringing-avatar img {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,.25);
    position: relative;
    z-index: 1;
}
.ringing-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.35);
    animation: ringingExpand 2.4s ease-out infinite;
}
.ringing-ring.ring2 { animation-delay: .8s; }
.ringing-ring.ring3 { animation-delay: 1.6s; }

@keyframes ringingExpand {
    0%   { transform: scale(1);    opacity: .6; }
    100% { transform: scale(2.2);  opacity: 0;  }
}

.vcall-ringing-name {
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0,0,0,.5);
}
.vcall-ringing-status {
    color: rgba(255,255,255,.65);
    font-size: 15px;
    letter-spacing: .3px;
}
.vcall-ringing-actions {
    margin-top: 48px;
}
.vcall-ringing-btn.cancel {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: #fff;
    background: #e53935;
    box-shadow: 0 6px 24px rgba(229,57,53,.5);
    transition: transform .13s, filter .13s;
}
.vcall-ringing-btn.cancel:hover  { filter: brightness(1.1); }
.vcall-ringing-btn.cancel:active { transform: scale(.93); }

/* --- Tela ativa (com lock) --- */

#vcall-top-bar {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 0;
}
#vcall-contact { display: flex; flex-direction: column; }
#vcall-contact .vcall-name {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 1px 6px rgba(0,0,0,.5);
}
#vcall-contact .vcall-status {
    color: rgba(255,255,255,.65);
    font-size: 13px;
    margin-top: 2px;
}
#vcall-close-btn {
    background: rgba(255,255,255,.12);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: #fff;
    font-size: 20px;
    backdrop-filter: blur(8px);
    transition: background .15s, transform .12s;
}
#vcall-close-btn:hover  { background: rgba(255,255,255,.22); }
#vcall-close-btn:active { transform: scale(.93); }

#vcall-lock-overlay {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    flex: 1;
    width: 100%;
    padding: 20px;
}
#vcall-lock-card {
    background: rgba(0,0,0,.52);
    backdrop-filter: blur(18px) saturate(1.2);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 22px;
    padding: 32px 30px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 320px;
    width: 100%;
    text-align: center;
}
#vcall-lock-card .lock-icon {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: rgba(37,211,102,.18);
    border: 1.5px solid rgba(37,211,102,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lockPulse 2.2s ease-in-out infinite;
}
#vcall-lock-card .lock-icon svg { width: 30px; height: 30px; color: #25D366; }
@keyframes lockPulse {
    0%, 100% { box-shadow: 0 0 0 0    rgba(37,211,102,.35); }
    50%       { box-shadow: 0 0 0 14px rgba(37,211,102,0);   }
}
#vcall-lock-card .lock-title {
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
    text-shadow: 0 1px 8px rgba(0,0,0,.4);
}
#vcall-lock-card .lock-sub {
    color: rgba(255,255,255,.6);
    font-size: 13.5px;
    line-height: 1.5;
}
#vcall-pay-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: .3px;
    box-shadow: 0 6px 22px rgba(37,211,102,.4);
    animation: ctaPulse 2.2s ease-in-out infinite;
    transition: transform .13s, filter .13s;
    margin-top: 4px;
}
#vcall-pay-btn:hover  { filter: brightness(1.07); transform: translateY(-2px); }
#vcall-pay-btn:active { transform: scale(.96); }

#vcall-avatar-preview {
    position: absolute;
    bottom: 110px;
    right: 18px;
    width: 80px;
    height: 80px;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,.2);
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
    z-index: 3;
}
#vcall-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(.85);
}

#vcall-bottom-bar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
    width: 100%;
}
.vcall-ctrl {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: #fff;
    transition: transform .13s, filter .13s;
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(8px);
}
.vcall-ctrl:hover  { filter: brightness(1.12); }
.vcall-ctrl:active { transform: scale(.93); }
.vcall-ctrl.end-call {
    background: #e53935;
    box-shadow: 0 6px 20px rgba(229,57,53,.4);
    width: 66px;
    height: 66px;
}
