@import url('../../vendor/fontes-perfil/plus-jakarta-sans.css');

:root {
    --primary-color: #00bfa5;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --bg-input: #f8fafc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
}

.client-chat-wrapper {
    width: 100%;
    max-width: 640px;
    height: 92vh;
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: 0 12px 35px -4px rgba(15, 23, 42, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.client-chat-header {
    padding: 18px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-support-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.support-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--primary-color) 12%, transparent);
    color: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
}

.header-support-info :is(h2, h3) {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.status-online {
    font-size: 12.5px;
    color: var(--primary-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 0 6px var(--primary-color);
}

.badge-sala {
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
}

#chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: #f8fafc;
}

#chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#chat-log::-webkit-scrollbar {
    width: 5px;
}

#chat-log::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.mensagem {
    padding: 12px 16px;
    max-width: 75%;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.sistema {
    background: color-mix(in srgb, var(--primary-color) 10%, transparent);
    color: var(--primary-color);
    align-self: center;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 9999px;
}

.recebida {
    background: #ffffff;
    color: var(--text-main);
    align-self: flex-start;
    border-radius: 16px 16px 16px 4px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.enviada {
    background: linear-gradient(135deg, var(--primary-color) 0%, color-mix(in srgb, var(--primary-color) 80%, #000) 100%);
    color: #ffffff;
    align-self: flex-end;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 30%, transparent);
}

#status-digitacao {
    padding: 0 24px 8px 24px;
    font-size: 12px;
    color: var(--primary-color);
    font-style: italic;
    background: transparent;
    position: absolute;
    bottom: 0;
    width: 100%;
}

#input-container {
    padding: 16px 20px;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--border-color);
}

.attach-btn {
    background: transparent;
    border: none;
    font-size: 19px;
    color: var(--text-muted);
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.2s;
}

.attach-btn:hover {
    color: var(--primary-color);
    background: var(--bg-input);
}

#chat-message-input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    background: var(--bg-input);
    font-size: 14px;
    color: var(--text-main);
    outline: none;
    font-family: inherit;
    transition: 0.2s;
}

#chat-message-input:focus {
    border-color: var(--primary-color);
    background: #ffffff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 15%, transparent);
}

#chat-message-submit {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary-color);
    border: none;
    color: #ffffff;
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 4px 10px color-mix(in srgb, var(--primary-color) 30%, transparent);
}

#chat-message-submit:hover {
    transform: scale(1.04);
}

@media (max-width: 680px) {
    body {
        background-color: var(--bg-card);
    }
    .client-chat-wrapper {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: none;
    }
}

.auth-overlay-custom { position: fixed; top:0; left:0; width:100vw; height:100vh; background:rgba(15, 23, 42, 0.85); z-index: 2000; display:flex; align-items:center; justify-content:center; backdrop-filter: blur(8px); }
.auth-card-custom { background: #ffffff; padding: 32px; border-radius: 20px; width: 90vw; max-width: 380px; display:flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 60px rgba(0,0,0,0.5); }
.auth-card-custom h2 { font-size: 20px; font-weight: 800; color: #0f172a; text-align: center; margin-bottom: 2px; }
.auth-card-custom p { font-size: 13px; color: #64748b; text-align: center; margin-bottom: 10px; }
.auth-card-custom input { padding: 14px; border: 1px solid #cbd5e1; border-radius: 10px; outline: none; font-family: inherit; font-size: 14px; background: #f8fafc; transition: all 0.2s; }
.auth-card-custom input:focus { border-color: var(--primary-color); background: #ffffff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 15%, transparent); }
.auth-card-custom button { padding: 14px; border: none; background: var(--primary-color); color: #fff; border-radius: 10px; font-weight: 700; cursor: pointer; transition: all 0.2s; font-size: 14.5px; box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 30%, transparent); }
.auth-card-custom button:hover { transform: translateY(-2px); filter: brightness(1.1); }
.auth-card-custom button.secondary { background: #f1f5f9; color: #334155; box-shadow: none; }
.auth-card-custom button.secondary:hover { background: #e2e8f0; }

.btn-profile-client { background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-muted); font-size: 12px; font-weight: 700; padding: 8px 12px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.2s; }
.btn-profile-client:hover { color: var(--primary-color); border-color: var(--primary-color); }

.stream-message-row { position: relative; display: flex; gap: 12px; max-width: 75%; margin-top: 14px; animation: messageIn 0.25s ease; }
.stream-message-row.sent { align-self: flex-end; flex-direction: row-reverse; }
.stream-message-row.received { align-self: flex-start; }
.msg-avatar { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.msg-balloon-wrap { display: flex; flex-direction: column; max-width: 100%; }
.msg-meta-inline { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.stream-message-row.sent .msg-meta-inline { justify-content: flex-end; }
.msg-author { font-size: 12.5px; font-weight: 700; color: var(--text-main); }
.msg-time { font-size: 10.5px; color: var(--text-muted); }
.msg-bubble { padding: 12px 18px; font-size: 14px; line-height: 1.5; border-radius: 16px; word-break: break-word; }
.stream-message-row.sent .msg-bubble { background: linear-gradient(135deg, var(--primary-color) 0%, color-mix(in srgb, var(--primary-color) 80%, #000) 100%); color: #ffffff; border-bottom-right-radius: 4px; box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 30%, transparent); }
.stream-message-row.received .msg-bubble { background: #ffffff; color: var(--text-main); border-bottom-left-radius: 4px; border: 1px solid var(--border-color); box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04); }

.wa-call-modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2500; display: none; }
.wa-call-modal-overlay > * { pointer-events: auto; }
.wa-call-card { position: fixed; top: 80px; right: 40px; width: 320px; background: #111b21; border: 1px solid rgba(255,255,255,0.1); border-radius: 24px; padding: 24px 20px; box-shadow: 0 20px 50px rgba(0,0,0,0.6); display: flex; flex-direction: column; align-items: center; text-align: center; color: #e9edef; }
.wa-screen-container { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 760px; height: 500px; min-width: 420px; min-height: 280px; max-width: 95vw; max-height: 90vh; background: #0b0f19; border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; padding: 10px; box-shadow: 0 30px 70px rgba(0,0,0,0.85), 0 0 0 1px rgba(255,255,255,0.04); display: none; flex-direction: column; gap: 8px; z-index: 2600; resize: both; overflow: hidden; }
.wa-screen-container.is-dragged { transform: none; }
.wa-screen-container.is-dragging { opacity: 0.95; cursor: grabbing !important; }
.wa-screen-header-bar { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 6px 4px; cursor: grab; user-select: none; flex-shrink: 0; }
.wa-screen-pill-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: #f1f5f9; background: rgba(255,255,255,0.05); padding: 4px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.08); }
.wa-screen-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; box-shadow: 0 0 8px #10b981; }
.wa-screen-ctrls { display: flex; align-items: center; gap: 6px; }
.wa-screen-ctrl-btn { width: 28px; height: 28px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.04); color: #94a3b8; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 13px; transition: all 0.15s ease; }
.wa-screen-ctrl-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.wa-screen-ctrl-btn.danger { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.25); color: #ef4444; }
.wa-screen-ctrl-btn.danger:hover { background: #ef4444; color: #fff; }
.wa-screen-video-box { flex: 1; width: 100%; height: 100%; min-height: 0; background: #000000; border-radius: 10px; overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,0.05); }
.wa-screen-video-box video { width: 100%; height: 100%; object-fit: contain; display: block; }
.wa-avatar-box { width: 84px; height: 84px; border-radius: 50%; position: relative; margin: 16px 0 12px 0; }
.wa-avatar-box img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid #00a884; }
.wa-pulse-ring { position: absolute; top: -6px; left: -6px; right: -6px; bottom: -6px; border-radius: 50%; border: 2px solid #00a884; animation: waPulse 1.8s infinite; opacity: 0.6; }
@keyframes waPulse { 0% { transform: scale(0.95); opacity: 0.8; } 50% { transform: scale(1.15); opacity: 0.2; } 100% { transform: scale(0.95); opacity: 0.8; } }
.wa-caller-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.wa-call-status { font-size: 13px; color: #8696a0; margin-bottom: 24px; font-variant-numeric: tabular-nums; }
.wa-actions-row { display: flex; align-items: center; justify-content: center; gap: 18px; width: 100%; }
.wa-btn-circle { width: 48px; height: 48px; border-radius: 50%; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; transition: transform 0.15s ease; }
.wa-btn-circle:hover { transform: scale(1.08); }
.wa-btn-mute { background: #2a3942; }
.wa-btn-mute.is-muted { background: #ef4444; }
.wa-btn-minimize { background: #2a3942; }
.wa-btn-end { background: #ea0038; }
.wa-minimized-pill { background: #111b21; border: 1px solid #00a884; border-radius: 9999px; padding: 8px 18px; display: none; align-items: center; gap: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); color: #e9edef; font-size: 13px; font-weight: 700; }
.wa-minimized-pill button { background: transparent; border: none; color: #e9edef; cursor: pointer; font-size: 15px; display: flex; align-items: center; }

.msg-attachment-wrap { margin-top: 6px; }
.custom-audio-player { display: flex; align-items: center; gap: 12px; width: 240px; max-width: 100%; padding: 4px 0; user-select: none; }
.btn-audio-play { width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; transition: transform 0.15s ease; }
.btn-audio-play:hover { transform: scale(1.06); }
.stream-message-row.sent .btn-audio-play { background: #ffffff; color: var(--primary-color); }
.stream-message-row.received .btn-audio-play { background: var(--primary-color); color: #ffffff; }
.audio-track-wrap { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.audio-seek-bar { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.35); outline: none; cursor: pointer; }
.stream-message-row.received .audio-seek-bar { background: var(--border-color); }
.audio-seek-bar::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #ffffff; cursor: pointer; transition: transform 0.1s ease; }
.stream-message-row.received .audio-seek-bar::-webkit-slider-thumb { background: var(--primary-color); }
.audio-seek-bar::-webkit-slider-thumb:hover { transform: scale(1.2); }
.audio-time-info { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: 0.85; }
.msg-attachment-img { max-width: 280px; max-height: 220px; border-radius: 10px; object-fit: cover; display: block; border: 1px solid rgba(255, 255, 255, 0.12); }
.msg-attachment-file { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; background: rgba(0, 0, 0, 0.18); border: 1px solid var(--border-color); border-radius: 8px; color: inherit; text-decoration: none; font-size: 12.5px; font-weight: 600; }
.msg-attachment-file:hover { border-color: var(--primary-color); }

.audio-recording-bar { display: flex; align-items: center; justify-content: space-between; flex: 1; gap: 16px; padding: 4px 8px; }
.recording-indicator { display: flex; align-items: center; gap: 8px; }
.recording-pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: recordPulse 1.2s infinite ease-in-out; }
@keyframes recordPulse { 0%, 100% { transform: scale(0.9); opacity: 0.6; } 50% { transform: scale(1.3); opacity: 1; } }
.recording-timer { font-size: 13.5px; font-weight: 700; color: #ef4444; font-variant-numeric: tabular-nums; }
.recording-waves { display: flex; align-items: center; gap: 3px; height: 18px; flex: 1; justify-content: center; }
.recording-waves span { display: inline-block; width: 3px; height: 100%; background: #ef4444; border-radius: 3px; animation: waveAnim 0.8s ease-in-out infinite alternate; }
.recording-waves span:nth-child(1) { animation-delay: 0.1s; }
.recording-waves span:nth-child(2) { animation-delay: 0.3s; }
.recording-waves span:nth-child(3) { animation-delay: 0.5s; }
.recording-waves span:nth-child(4) { animation-delay: 0.2s; }
.recording-waves span:nth-child(5) { animation-delay: 0.4s; }
.recording-waves span:nth-child(6) { animation-delay: 0.6s; }
.recording-waves span:nth-child(7) { animation-delay: 0.15s; }
.recording-waves span:nth-child(8) { animation-delay: 0.35s; }
@keyframes waveAnim { 0% { height: 4px; } 100% { height: 18px; } }
.btn-cancel-audio-record { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px 6px; border-radius: 6px; display: flex; align-items: center; transition: color 0.15s; }
.btn-cancel-audio-record:hover { color: #ef4444; }
/* Seletor de idioma ({% seletor_idioma %}, idiomas/seletor.css): no topo do cartão de entrada (antes de entrar) e
 * numa linha própria do painel "Do seu jeito". Usa as variáveis do tema do cliente (claro/escuro). */
.client-workspace .auth-card-custom .auth-idioma { display: flex; justify-content: flex-end; margin: -10px -8px -2px 0; }
:root[data-canal-embed] .client-workspace .auth-card-custom .auth-idioma { justify-content: flex-start; margin: -10px 0 -2px -8px; }
.client-workspace .seletor-idioma--cliente { color: var(--text-muted); }
.client-workspace .seletor-idioma--cliente .seletor-idioma-rotulo { font-size: 12px; font-weight: 600; }
.client-workspace .seletor-idioma--cliente select { min-height: 34px; padding: 4px 28px 4px 10px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input); color: var(--text-main); font-size: 12px; font-weight: 600; }
.client-workspace .seletor-idioma--cliente select:hover { border-color: var(--primary-color); }
.client-workspace .seletor-idioma--cliente select:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
:root[data-client-theme="dark"] .client-workspace .seletor-idioma--cliente select option,
.client-workspace.dark-mode .seletor-idioma--cliente select option { color: #e9eef6; background: #1b2534; }
/* Sem JavaScript o seletor mostra o botão "Aplicar": discreto, sem o estilo grande dos botões do cartão. */
.client-workspace .auth-card-custom .seletor-idioma-enviar,
.client-workspace .client-appearance-panel .seletor-idioma-enviar { min-height: 34px; padding: 4px 10px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input); color: var(--text-main); box-shadow: none; font-size: 12px; }
.client-workspace .client-language-option { margin: 9px 0 17px; }
.client-workspace .client-language-option .seletor-idioma { display: flex; width: 100%; }
.client-workspace .client-language-option select { flex: 1; min-height: 42px; border-radius: 10px; }

/* Conversa vazia: o texto vem traduzido do template (data-vazio), não do CSS. */
body.client-workspace #chat-log[data-vazio]:empty::before { content: attr(data-vazio); }
