/* ==========================================================================
   WHATSAPP WEB + OMNIROUTE DESIGN SYSTEM (DARK THEME)
   Fidelidade ao layout oficial do WhatsApp Web com a estética, tipografia,
   paleta de cores e badges inspirados na interface do OmniRoute.
   ========================================================================== */

:root {
    /* Cores Inspiradas no OmniRoute + WhatsApp Web */
    --wa-bg-app: #0b0e14;
    --wa-bg-dock: #111622;
    --wa-bg-header: #111622;
    --wa-bg-sidebar: #111622;
    --wa-bg-chat: #0b0e14;
    --wa-bg-card: #161c28;
    --wa-bg-input-bar: #111622;
    --wa-bg-input: #161c28;
    --wa-bg-search: #111622;
    --wa-bg-search-input: #161c28;
    --wa-bg-hover: #151b27;
    --wa-bg-active: #182030;
    
    /* Balões Oficiais do WhatsApp */
    --wa-bubble-out: #005c4b;
    --wa-bubble-in: #182030;
    --wa-bubble-out-text: #f1f5f9;
    --wa-bubble-in-text: #f1f5f9;
    --wa-meta-out: #8696a0;
    --wa-meta-in: #8696a0;
    
    /* Acentos & Badges Estilo OmniRoute */
    --wa-teal: #00a884;
    --wa-teal-light: #00e699;
    --wa-blue-tick: #53bdeb;
    --wa-icon-gray: #94a3b8;
    --wa-border: rgba(255, 255, 255, 0.07);
    --wa-border-subtle: rgba(255, 255, 255, 0.05);
    --wa-text-primary: #f1f5f9;
    --wa-text-secondary: #94a3b8;
    --wa-text-muted: #64748b;
    --wa-badge-unread: #00a884;
    --wa-badge-red: #e11d48;
}

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

body.wa-studio-body {
    height: 100vh;
    width: 100vw;
    background-color: var(--wa-bg-app);
    color: var(--wa-text-primary);
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
    display: flex;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* ══════════════════════════════════════════════════════════════════════════
   1. DOCK VERTICAL DE NAVEGAÇÃO RÁPIDA (EXTREMA ESQUERDA - 60px)
   ══════════════════════════════════════════════════════════════════════════ */
.wa-dock {
    width: 60px;
    height: 100vh;
    background: var(--wa-bg-dock);
    border-right: 1px solid var(--wa-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    flex-shrink: 0;
    z-index: 100;
}

.wa-dock-brand {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #00a884, #008769);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 168, 132, 0.35);
    margin-bottom: 16px;
    transition: transform 0.15s ease;
}

.wa-dock-brand:hover {
    transform: scale(1.05);
}

.wa-dock-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.wa-dock-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: var(--wa-icon-gray);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.wa-dock-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--wa-text-primary);
}

.wa-dock-btn.active {
    background: rgba(0, 168, 132, 0.16);
    color: var(--wa-teal-light);
}

.wa-dock-btn.active::before {
    content: '';
    position: absolute;
    left: -9px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--wa-teal-light);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px rgba(0, 230, 153, 0.6);
}

.wa-dock-btn .wa-dock-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--wa-teal-light);
}

.wa-dock-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    width: 100%;
}

/* ══════════════════════════════════════════════════════════════════════════
   2. ÁREA PRINCIPAL DO WHATSAPP (SPLIT VIEW AUTÊNTICO)
   ══════════════════════════════════════════════════════════════════════════ */
.wa-main-container {
    flex: 1;
    height: 100vh;
    display: flex;
    overflow: hidden;
    position: relative;
    background: var(--wa-bg-chat);
}

#waConnectedState {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* ──────────────── LISTA LATERAL DE CHATS (380px) ──────────────── */
.wa-sidebar-chats {
    width: 380px;
    height: 100vh;
    background: var(--wa-bg-sidebar);
    border-right: 1px solid var(--wa-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Header da lista de chats */
.wa-header-chats {
    height: 60px;
    background: var(--wa-bg-header);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--wa-border);
}

.wa-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #1e2637;
    color: var(--wa-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.wa-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--wa-icon-gray);
    font-size: 16px;
}

.wa-header-icon-btn {
    background: transparent;
    border: none;
    color: var(--wa-icon-gray);
    font-size: 16px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.wa-header-icon-btn:hover {
    color: var(--wa-text-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* Barra de Pesquisa Estilo OmniRoute */
.wa-search-bar-wrap {
    padding: 10px 14px;
    background: var(--wa-bg-sidebar);
    border-bottom: 1px solid var(--wa-border-subtle);
}

.wa-search-box {
    display: flex;
    align-items: center;
    background: var(--wa-bg-search-input);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 6px 12px;
    gap: 10px;
    transition: border-color 0.15s ease;
}

.wa-search-box:focus-within {
    border-color: rgba(0, 168, 132, 0.6);
}

.wa-search-box i {
    color: var(--wa-text-muted);
    font-size: 13px;
}

.wa-search-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--wa-text-primary);
    font-size: 13px;
    width: 100%;
    font-family: inherit;
}

.wa-search-input::placeholder {
    color: var(--wa-text-muted);
}

.wa-search-kbd {
    display: flex;
    gap: 2px;
    align-items: center;
}

.wa-search-kbd kbd {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 1px 4px;
    font-size: 10px;
    font-family: monospace;
    color: var(--wa-text-muted);
}

/* Filtros em Pílulas Estilo OmniRoute */
.wa-filter-pills {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    background: var(--wa-bg-sidebar);
    border-bottom: 1px solid var(--wa-border);
    overflow-x: auto;
}

.wa-pill {
    background: var(--wa-bg-card);
    color: var(--wa-text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
    font-family: inherit;
}

.wa-pill:hover {
    background: #1c2333;
    color: var(--wa-text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.wa-pill.active {
    background: #e11d48;
    color: #fff;
    border-color: #e11d48;
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.35);
}

/* Pontos coloridos dos filtros (Status Dots) */
.wa-pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.dot-all { background: #e11d48; }
.dot-unread { background: #f59e0b; }
.dot-groups { background: #38bdf8; }
.dot-direct { background: #10b981; }

.wa-pill.active .wa-pill-dot {
    background: #fff;
}

.wa-count-pill {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 9999px;
    padding: 0 5px;
    font-size: 10.5px;
    font-weight: 700;
}

.wa-pill.active .wa-count-pill {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Feed de Conversas */
.wa-chats-feed {
    flex: 1;
    overflow-y: auto;
}

/* Item de Conversa na Lista */
.wa-chat-item-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s ease;
    position: relative;
}

.wa-chat-item-row:hover {
    background: var(--wa-bg-hover);
}

.wa-chat-item-row.active {
    background: var(--wa-bg-active);
}

.wa-chat-item-row.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--wa-teal-light);
    border-radius: 0 3px 3px 0;
}

.wa-contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

.wa-contact-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--wa-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-contact-time {
    font-size: 11px;
    color: var(--wa-text-muted);
    flex-shrink: 0;
    font-weight: 500;
}

.wa-contact-lastmsg {
    font-size: 12px;
    color: var(--wa-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
    font-weight: 400;
}

.wa-contact-lastmsg.unread {
    color: #f1f5f9;
    font-weight: 700;
}

.wa-unread-badge {
    background: var(--wa-teal);
    color: #080c16;
    font-size: 10px;
    font-weight: 800;
    border-radius: 9999px;
    padding: 1px 6px;
    flex-shrink: 0;
}

.wa-group-tag {
    font-size: 9.5px;
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #38bdf8;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
    margin-left: 6px;
}

/* ──────────────── ÁREA DA CONVERSA ABERTA (DIREITA) ──────────────── */
.wa-conversation-view {
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--wa-bg-chat);
    position: relative;
    overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════════════
   3. TELA DE BOAS-VINDAS (EMPTY STATE WHATSAPP + OMNIROUTE)
   ══════════════════════════════════════════════════════════════════════════ */
.wa-empty-welcome {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
    background: var(--wa-bg-chat);
    position: relative;
}

.wa-empty-welcome-content {
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.wa-welcome-hero-art {
    position: relative;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.wa-welcome-ring {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 168, 132, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

.wa-welcome-icon-box {
    width: 76px;
    height: 76px;
    border-radius: 20px;
    background: #141b28;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    color: #00e699;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.wa-welcome-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--wa-text-primary);
    letter-spacing: -0.01em;
}

.wa-welcome-subtitle {
    font-size: 13.5px;
    color: var(--wa-text-secondary);
    line-height: 1.6;
}

.wa-welcome-badges-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 6px;
}

.wa-badge-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
}

.wa-badge-pill.green {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.28);
    color: #10b981;
}

.wa-badge-pill.purple {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.28);
    color: #c084fc;
}

.wa-status-dot-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    margin-right: 6px;
    box-shadow: 0 0 8px #10b981;
}

.wa-welcome-lock {
    margin-top: 24px;
    font-size: 11.5px;
    color: var(--wa-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ══════════════════════════════════════════════════════════════════════════
   4. CONVERSA ATIVA (TIMELINE & BALÕES)
   ══════════════════════════════════════════════════════════════════════════ */
.wa-active-header {
    height: 60px;
    background: var(--wa-bg-header);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--wa-border);
    z-index: 10;
}

.wa-active-contact {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wa-active-name {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--wa-text-primary);
}

.wa-active-status {
    font-size: 11.5px;
    color: var(--wa-text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.wa-messages-timeline {
    flex: 1;
    overflow-y: auto;
    padding: 16px 8%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

/* Balões com Tipografia OmniRoute */
.wa-balloon {
    position: relative;
    max-width: 65%;
    padding: 7px 11px 8px 11px;
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 19px;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.wa-balloon.customer {
    align-self: flex-start;
    background: var(--wa-bubble-in);
    color: var(--wa-bubble-in-text);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top-left-radius: 0;
}

.wa-balloon.me {
    align-self: flex-end;
    background: var(--wa-bubble-out);
    color: var(--wa-bubble-out-text);
    border-top-right-radius: 0;
}

.wa-balloon-sender {
    font-size: 11px;
    font-weight: 700;
    color: #38bdf8;
    margin-bottom: 2px;
}

.wa-balloon-text {
    word-break: break-word;
    white-space: pre-wrap;
}

.wa-balloon-meta {
    align-self: flex-end;
    margin-top: 3px;
    font-size: 10.5px;
    color: var(--wa-meta-out);
    display: flex;
    align-items: center;
    gap: 4px;
}

.wa-check-double {
    color: #53bdeb;
    font-size: 11px;
}

/* Barra de Respostas Rápidas */
.wa-quick-bar {
    background: rgba(17, 22, 34, 0.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--wa-border);
    padding: 8px 14px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    z-index: 10;
}

.wa-quick-chip {
    background: var(--wa-bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    padding: 4px 12px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--wa-text-secondary);
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
    font-family: inherit;
}

.wa-quick-chip:hover {
    background: #1e2637;
    color: var(--wa-text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Barra Inferior de Digitação */
.wa-input-bar {
    height: 62px;
    background: var(--wa-bg-input-bar);
    border-top: 1px solid var(--wa-border);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10;
}

.wa-input-field {
    flex: 1;
    background: var(--wa-bg-input);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--wa-text-primary);
    font-size: 13.5px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

.wa-input-field:focus {
    border-color: rgba(0, 168, 132, 0.6);
}

.wa-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--wa-teal);
    color: #0b0e14;
    border: none;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

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

/* ══════════════════════════════════════════════════════════════════════════
   5. MÓDULOS EXTRAS (DISPAROS, FILA, QR CODE, URA, AI CONFIG)
   ══════════════════════════════════════════════════════════════════════════ */
.wa-module-view {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 24px 32px;
    background: var(--wa-bg-chat);
}

.wa-module-header {
    margin-bottom: 24px;
}

.wa-module-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--wa-text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.wa-module-header p {
    font-size: 13px;
    color: var(--wa-text-secondary);
}

.wa-card {
    background: var(--wa-bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.wa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.wa-table th {
    text-align: left;
    padding: 10px 12px;
    color: var(--wa-text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--wa-border);
}

.wa-table td {
    padding: 12px;
    color: var(--wa-text-primary);
    border-bottom: 1px solid var(--wa-border-subtle);
}

.wa-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}
