/* ==========================================================================
   NOVA DASHBOARD DE CANAIS WHATSAPP (SaaS MODERN UI / CLOUD META)
   ========================================================================== */

:root {
    --wa-brand: #00a884;
    --wa-brand-hover: #008069;
    --wa-brand-light: #e7f7ed;
    --wa-dark: #111b21;
    --wa-gray-text: #667781;
    --wa-card-bg: #ffffff;
    --wa-border: #e9edef;
    --wa-amber: #f59e0b;
    --wa-amber-light: #fffbeb;
    --wa-blue: #3b82f6;
    --wa-blue-light: #eff6ff;
    --wa-red: #ef4444;
}

.wa-dashboard-wrapper {
    background-color: #f8fafc;
    min-height: calc(100vh - 50px);
    padding: 24px 32px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--wa-dark);
    box-sizing: border-box;
}

/* 1. BARRA SUPERIOR E HERO */
.wa-dash-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.wa-dash-headline {
    display: flex;
    align-items: center;
    gap: 14px;
}

.wa-dash-logo-badge {
    width: 48px;
    height: 48px;
    border-radius: 14px !important;
    background: linear-gradient(135deg, #00a884 0%, #128c7e 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 14px rgba(0, 168, 132, 0.28);
}

.wa-dash-title {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.3px;
}

.wa-dash-desc {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

.wa-dash-btn-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-wa-action-primary {
    background-color: var(--wa-brand) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 10px 20px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(0, 168, 132, 0.25) !important;
    transition: all 0.15s ease-in-out !important;
}

    .btn-wa-action-primary:hover {
        background-color: var(--wa-brand-hover) !important;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 168, 132, 0.35) !important;
    }

.btn-wa-refresh {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
    border-radius: 10px !important;
    width: 42px !important;
    height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04) !important;
}

    .btn-wa-refresh:hover {
        background: #f1f5f9 !important;
        color: #0f172a !important;
    }

/* 2. KPIS GLOBAIS DA OPERAÇÃO */
.wa-kpi-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

@media (max-width: 992px) {
    .wa-kpi-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.wa-kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px !important;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

    .wa-kpi-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    }

.wa-kpi-info {
    display: flex;
    flex-direction: column;
}

.wa-kpi-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 4px;
}

.wa-kpi-number {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    color: #0f172a;
}

.wa-kpi-icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 12px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.wa-kpi-card.green .wa-kpi-icon-circle {
    background: #dcfce7;
    color: #15803d;
}

.wa-kpi-card.amber .wa-kpi-icon-circle {
    background: #fef3c7;
    color: #b45309;
}

.wa-kpi-card.blue .wa-kpi-icon-circle {
    background: #dbeafe;
    color: #1d4ed8;
}

.wa-kpi-card.red .wa-kpi-icon-circle {
    background: #fee2e2;
    color: #b91c1c;
}

/* 3. FILTRO E BUSCA DE CANAIS (QUANDO HOUVER MÚLTIPLOS) */
.wa-channels-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.wa-search-channel-box {
    position: relative;
    min-width: 280px;
    flex: 1;
    max-width: 420px;
}

    .wa-search-channel-box i {
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        color: #94a3b8;
        font-size: 14px;
    }

.wa-search-channel-input {
    width: 100%;
    height: 40px;
    border-radius: 10px !important;
    border: 1px solid #cbd5e1;
    padding-left: 38px;
    padding-right: 14px;
    font-size: 13px;
    color: #0f172a;
    background-color: #ffffff;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

    .wa-search-channel-input:focus {
        border-color: var(--wa-brand);
        box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.12);
    }

.wa-filter-tabs {
    display: flex;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 10px !important;
    gap: 2px;
}

.wa-tab-btn {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 8px !important;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

    .wa-tab-btn.active {
        background: #ffffff;
        color: #0f172a;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }

/* 4. CARDS DE CANAIS (GRID E SINGLE-MODE) */
.wa-channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 22px;
}

/* MODO CANAL ÚNICO: Card Expandido em Destaque */
.wa-single-channel-view {
    max-width: 820px;
    margin: 0 auto;
}

    .wa-single-channel-view .wa-channel-card-modern {
        border-width: 1.5px;
    }

.wa-channel-card-modern {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    position: relative;
}

    .wa-channel-card-modern:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
        border-color: #cbd5e1;
    }

    .wa-channel-card-modern.is-principal {
        border-top: 4px solid var(--wa-brand);
    }

.wa-card-header-modern {
    padding: 20px 22px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
}

.wa-channel-identity {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.wa-channel-avatar-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px !important;
    background-color: var(--wa-brand-light);
    color: var(--wa-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.wa-channel-meta-text {
    min-width: 0;
}

.wa-channel-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wa-channel-title-modern {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-badge-star {
    font-size: 10px;
    font-weight: 800;
    color: #047857;
    background: #d1fae5;
    padding: 2px 6px;
    border-radius: 6px !important;
    text-transform: uppercase;
}

.wa-channel-status-sub {
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.wa-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50% !important;
    background-color: #10b981;
    box-shadow: 0 0 0 2px #d1fae5;
}

    .wa-pulse-dot.offline {
        background-color: #94a3b8;
        box-shadow: none;
    }

/* Ações no Header */
.wa-card-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-card-config {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px !important;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}

    .btn-card-config:hover {
        background: #f1f5f9;
        color: #0f172a;
        border-color: #cbd5e1;
    }

/* Bloco de Métricas Interativas (3 Colunas) */
.wa-metrics-container {
    padding: 20px 22px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    background: #ffffff;
}

.wa-metric-box {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 12px !important;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    position: relative;
    overflow: hidden;
}

    .wa-metric-box:hover {
        background: #ffffff;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
        transform: translateY(-2px);
    }

    .wa-metric-box.green:hover {
        border-color: #10b981;
    }

    .wa-metric-box.amber:hover {
        border-color: #f59e0b;
    }

    .wa-metric-box.blue:hover {
        border-color: #3b82f6;
    }

.wa-metric-box-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #64748b;
    margin-bottom: 6px;
}

.wa-metric-box-val {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.wa-metric-box.green .wa-metric-box-val {
    color: #059669;
}

.wa-metric-box.amber .wa-metric-box-val {
    color: #d97706;
}

.wa-metric-box.blue .wa-metric-box-val {
    color: #2563eb;
}

.wa-metric-box-action {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Indicador de Fila com Urgência */
.wa-metric-box.has-queue-alert {
    background-color: #fffbeb;
    border-color: #fde68a;
}

/* Rodapé do Card do Canal */
.wa-card-footer-modern {
    padding: 16px 22px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.wa-footer-stats-text {
    font-size: 12.5px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-open-channel-direct {
    background-color: var(--wa-brand) !important;
    border: none !important;
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    padding: 8px 18px !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    text-decoration: none !important;
    box-shadow: 0 1px 3px rgba(0, 168, 132, 0.2) !important;
}

    .btn-open-channel-direct:hover {
        background-color: var(--wa-brand-hover) !important;
        transform: translateY(-1px);
        box-shadow: 0 4px 10px rgba(0, 168, 132, 0.3) !important;
    }

/* 5. GAVETA LATERAL DESLIZANTE (SLIDE-OVER DRAWER DE CHATS) */
.wa-slide-drawer-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.5);
    z-index: 1050;
    display: flex;
    justify-content: flex-end;
    animation: fadeIn 0.18s ease-out;
}

.wa-slide-drawer-panel {
    width: 100%;
    max-width: 620px;
    background: #ffffff;
    height: 100vh;
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.wa-drawer-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
}

.wa-drawer-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wa-drawer-badge {
    padding: 4px 12px;
    border-radius: 20px !important;
    font-size: 12px;
    font-weight: 800;
}

    .wa-drawer-badge.green {
        background: #dcfce7;
        color: #15803d;
    }

    .wa-drawer-badge.amber {
        background: #fef3c7;
        color: #b45309;
    }

    .wa-drawer-badge.blue {
        background: #dbeafe;
        color: #1e40af;
    }

.btn-drawer-close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

    .btn-drawer-close:hover {
        background: #f1f5f9;
        color: #0f172a;
    }

.wa-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: #f8fafc;
}

.wa-drawer-chat-item {
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.12s ease;
    gap: 12px;
}

    .wa-drawer-chat-item:hover {
        background: #f8fafc;
    }

.wa-chat-lead-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.wa-chat-avatar-round {
    width: 42px;
    height: 42px;
    border-radius: 50% !important;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.wa-chat-lead-text {
    min-width: 0;
    flex: 1;
}

.wa-chat-lead-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-chat-lead-msg {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
    margin-top: 2px;
}

.wa-chat-actions-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.wa-chat-time-tag {
    font-size: 11px;
    color: #94a3b8;
}

.btn-attend-chat {
    background: var(--wa-brand) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 6px 14px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: background 0.15s !important;
}

    .btn-attend-chat:hover {
        background: var(--wa-brand-hover) !important;
    }

.wa-drawer-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
