/* 
 * ARQUIVO: frontend.css 
 * FUNÇÃO: Estilo da interface do usuário - Premium Floating Logic
 * VERSÃO: 3.2.1 (Validação client-side + botão voltar topo + GTM styles)
 */

.whatschat-wrapper {
    /* Removida posição relativa para garantir que filhos fixos se apoiem na Viewport global */
    z-index: 999999;
    contain: none; /* Alterado de layout para none para evitar o trap de fixed position */
    line-height: initial;
}

.whatschat-button {
    position: fixed !important; /* Garantia técnica de flutuação independente do contêiner site-footer */
    z-index: 999999;
    width: 60px;
    height: 60px;
    border: 0;
    cursor: pointer;
    background: var(--whatschat-primary, #25D366);
    color: var(--whatschat-secondary, #ffffff);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .20);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow .25s ease, background .25s ease;
    overflow: hidden;
    will-change: transform, bottom, left, right;
    pointer-events: auto; /* Assegura clicabilidade */
}

/* Fix de Visual Diantedo do Layout - Acompanhamento Dinâmico */
.whatschat-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, .28);
}

.whatschat-button.whatschat-active {
    transform: scale(0.9) rotate(5deg);
}

.whatschat-rounded {
    border-radius: 50% !important;
}

.whatschat-square {
    border-radius: 14px !important;
}

.whatschat-button-icon {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .22s ease, transform .22s ease;
    width: 100%;
    height: 100%;
}

.whatschat-button-icon i {
    font-size: 28px;
    line-height: 1;
}

.whatschat-icon-open {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.whatschat-icon-close {
    opacity: 0;
    transform: scale(0.6) rotate(-90deg);
}

.whatschat-button.whatschat-active .whatschat-icon-open {
    opacity: 0;
    transform: scale(0.6) rotate(90deg);
}

.whatschat-button.whatschat-active .whatschat-icon-close {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.whatschat-box {
    position: fixed !important; /* Popup preso também à janela de visualização do navegador */
    width: 360px;
    max-width: calc(100% - 30px);
    background: #fff;
    border-radius: 20px; /* Transição UI mais moderna */
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
    z-index: 999999;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    backface-visibility: hidden;
    will-change: transform;
}

.whatschat-box-header {
    background: linear-gradient(135deg, var(--whatschat-primary, #25D366), #1bbf5c);
    color: #fff;
    padding: 22px 18px; /* Otimização UX de espaçamento */
    display: flex;
    gap: 12px;
    align-items: flex-start;
    flex-shrink: 0;
}

.whatschat-box-header-main .whatschat-header-main-icon i {
    font-size: 34px;
    line-height: 1;
}

.whatschat-header-main-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.whatschat-header-main-text strong {
    font-size: 16px;
    font-weight: 700; /* Mais ênfase UI no header */
}

.whatschat-header-main-text span {
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.92;
}

.whatschat-box-content {
    max-height: 440px; /* Ligeira melhoria de espaço para listas */
    overflow-y: auto;
    overflow-x: hidden;
}

.whatschat-contacts-list {
    padding: 16px;
}

.whatschat-contacts-note {
    font-size: 12px;
    color: #8d98a5;
    margin-bottom: 16px;
}

.whatschat-empty-message {
    font-size: 13px;
    color: #7f8b97;
    line-height: 1.6;
    padding: 20px 0;
    text-align: center;
}

.whatschat-contact-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 12px;
    background: #f8fafc;
    margin-bottom: 14px;
    cursor: pointer;
    transition: all .2s ease;
    border: 1px solid transparent;
    border-left: 3px solid var(--whatschat-primary, #25D366);
}

.whatschat-contact-card:hover {
    background: #ffffff;
    border: 1px solid #e2ece8; /* Borda súbtil ao passar mouse */
    border-left: 3px solid var(--whatschat-primary, #25D366);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.whatschat-contact-avatar img,
.whatschat-contact-avatar-default {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    object-fit: cover;
    overflow: hidden;
    color: #25D366;
    font-size: 30px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.whatschat-contact-info {
    flex: 1;
    min-width: 0;
}

.whatschat-contact-info strong {
    display: block;
    font-size: 14px;
    color: #334155;
    margin-bottom: 2px;
}

.whatschat-contact-info span {
    font-size: 12px;
    color: #64748b;
}

.whatschat-contact-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    gap: 4px;
}

.whatschat-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.whatschat-status-dot.online {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.whatschat-status-dot.offline {
    background: #ef4444;
}

.whatschat-status-text {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.whatschat-dynamic-form-area {
    display: flex; flex-direction: column; min-height: 420px;
}

.whatschat-dynamic-form-header {
    display: flex; align-items:center; gap:10px; padding: 12px 14px; border-bottom: 1px solid #edf0f4; flex-shrink: 0;
}

.whatschat-back-button {
    border: 0; background: #f0f4f8; width: 34px; height: 34px; min-width: 34px; border-radius: 50%; 
    cursor:pointer; font-size: 16px; color: #64748b; display: inline-flex; align-items:center; justify-content:center;
    transition: all .2s ease;
}

.whatschat-back-button:hover { background: #e2e8f0; color: #1e293b; }

.whatschat-dynamic-contact-title {
    font-size: 15px; font-weight: 700; color: #334155; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.whatschat-form { display: flex; flex-direction: column; min-height:0; padding:14px; }
.whatschat-form-scroll { max-height: 250px; overflow-y:auto; padding-right:6px; }

.whatschat-form-group { margin-bottom: 16px; }
.whatschat-form-group label { display: block; margin-bottom:6px; font-weight: 600; color: #475569; font-size:12px; }

.whatschat-policy-label { font-weight: 400 !important; font-size:11px !important; line-height: 1.5; color: #64748b !important; display: flex !important; align-items: flex-start !important; gap: 8px; }
.whatschat-policy-label input { margin-top: 2px !important; }
.whatschat-policy-label a { color: var(--whatschat-primary, #25D366); text-decoration: underline; }

.whatschat-form input[type="text"], .whatschat-form input[type="email"], .whatschat-form input[type="number"],
.whatschat-form input[type="tel"], .whatschat-form input[type="url"], .whatschat-form textarea, 
.whatschat-form select {
    width: 100% !important; border: 1px solid #e1e7ec !important; border-radius: 10px !important; padding: 12px !important;
    background: #fdfdfd !important; font-size:13px !important; color: #1e293b !important;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.whatschat-form input:focus, .whatschat-form textarea:focus { border-color: var(--whatschat-primary, #25D366) !important; outline: 0 !important; background: #fff !important; }

.whatschat-form textarea { min-height: 80px; resize: none; }

.whatschat-submit {
    width: 100%; border: 0; border-radius: 12px; padding: 15px; background: var(--whatschat-primary, #25D366);
    color:#fff; font-weight: 700; font-size:14px; cursor:pointer; display: flex; align-items:center; justify-content:center;
    gap:10px; margin-top:5px; transition: filter .2s, transform .2s;
}
.whatschat-submit:hover { filter: contrast(1.1); transform: translateY(-1px); }

.whatschat-response { margin-top: 8px; font-size: 13px; text-align: center; font-weight: 500; }
.whatschat-response .error { color: #dc2626; }
.whatschat-response .success { color: #15803d; }

/* NOVA FUNCIONALIDADE A2: Validação visual dos campos */
.whatschat-form input.whatschat-valid,
.whatschat-form textarea.whatschat-valid,
.whatschat-form select.whatschat-valid {
    border-color: #22c55e !important;
    background: #f0fdf4 !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1) !important;
}

.whatschat-form input.whatschat-invalid,
.whatschat-form textarea.whatschat-invalid,
.whatschat-form select.whatschat-invalid {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1) !important;
    animation: wcShake 0.4s ease;
}

@keyframes wcShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-2px); }
}

/* NOVA FUNCIONALIDADE A3: Botão voltar ao topo */
#whatschat-back-to-top:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28) !important;
}

#whatschat-back-to-top:active {
    transform: scale(0.95) !important;
}

/* INJEÇÃO enterprise de Estabilização Dinâmica para Forms Standalone */
.whatschat-standalone-form-wrapper { border: 1px solid var(--wc-st-f-border, #eef2f6) !important; border-radius: 20px; padding: 30px; box-shadow: 0 10px 40px rgba(0,0,0,0.06); }
.whatschat-standalone-form-wrapper .whatschat-form-fields-container { display: flex; gap: 20px; align-items: flex-end; }
.whatschat-layout-horizontal .whatschat-form-fields-container { flex-direction: row !important; }
.whatschat-layout-vertical .whatschat-form-fields-container { flex-direction: column !important; align-items: stretch !important; }

@media (max-width: 500px) {
    .whatschat-button { width: 54px; height: 54px; }
    .whatschat-box { width: calc(100% - 20px) !important; left:10px !important; right:10px !important; bottom: 85px !important; }
    #whatschat-back-to-top { width: 42px; height: 42px; }
    #whatschat-back-to-top i { font-size: 18px; }
}

/* FIM DO PROTOCOLO CPW-EXTREME-FIX: FRONTEND CSS */

/* EXTENSION 2.8.0 - BASE ESTILO P/ ELEMENTOS CURTOS */

/* Mantemos 100% da identidade WhatsChat p/ links de apoio */
a[class*="wcel-"] {
    text-decoration: underline;
    transition: opacity 0.3s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
}

a[class*="wcel-"]:active {
    filter: brightness(1.2)!important;
    transform: scale(0.98)!important;
}

[class*="wcel-"].whatschat-cta-hover:hover {
    box-shadow: 0 6px 15px rgba(0,0,0,0.1) !important;
}

/* Força Reset para não colidir com o Body se no Shortcode estiver dentro de um P ou Header */
.whatschat-button-intext { vertical-align: middle; margin: 0 5px; }