/* ==========================================================================
   TELA DE GESTÃO DE WHATSAPP FLOWS DA META (YGIA / HIGIA)
   ========================================================================== */
.whatsapp-flows-container {
    padding: 20px 24px;
    background-color: #f8fafc;
    min-height: 88vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 1. Header Bar */
.wf-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    background-color: #ffffff;
    padding: 16px 20px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.wf-badge-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #e7f7ed;
    color: #0f766e;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid #a7f3d0;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.wf-header-title h2 {
    margin: 0 0 4px 0;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.wf-header-title p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.wf-header-actions {
    display: flex;
    gap: 10px;
}

.wf-btn-sync {
    border-radius: 6px !important;
    font-weight: 600;
    font-size: 12.5px;
    padding: 7px 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.wf-btn-novo {
    background-color: #00a884 !important;
    border-color: #008069 !important;
    color: #ffffff !important;
    border-radius: 6px !important;
    font-weight: 700;
    font-size: 12.5px;
    padding: 7px 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

    .wf-btn-novo:hover {
        background-color: #008069 !important;
    }

/* 2. Barra de Filtros */
.wf-filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 16px;
    background: #ffffff;
    padding: 12px 18px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.wf-filter-item {
    width: 240px;
}

    .wf-filter-item label {
        font-size: 12px;
        font-weight: 700;
        color: #475569;
        margin-bottom: 4px;
        display: block;
    }

.wf-filter-search {
    flex: 1;
}

/* 3. Tabela de Flows */
.wf-table-card {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.wf-table {
    margin-bottom: 0;
}

    .wf-table th {
        background-color: #f8fafc;
        color: #475569;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        padding: 12px 14px;
        border-bottom: 1px solid #e2e8f0 !important;
    }

    .wf-table td {
        padding: 12px 14px;
        vertical-align: middle !important;
        font-size: 13px;
        color: #1e293b;
        border-top: 1px solid #f1f5f9;
    }

/* Status Pills */
.wf-status-pill {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

    .wf-status-pill.publicado {
        background-color: #dcfce7;
        color: #15803d;
        border: 1px solid #86efac;
    }

    .wf-status-pill.rascunho {
        background-color: #fef3c7;
        color: #92400e;
        border: 1px solid #fde047;
    }

    .wf-status-pill.deprecado, .wf-status-pill.bloqueado {
        background-color: #fee2e2;
        color: #b91c1c;
        border: 1px solid #fca5a5;
    }

.wf-flow-name {
    font-size: 13.5px;
    color: #0f172a;
}

.wf-cat-badge {
    font-size: 9.5px;
    font-weight: 800;
    background-color: #f1f5f9;
    color: #475569;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.wf-meta-id-badge {
    font-family: monospace;
    font-size: 11px;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    color: #0284c7;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

    .wf-meta-id-badge:hover {
        background-color: #e2e8f0;
    }

.wf-versao-badge {
    background-color: #64748b;
    font-size: 11px;
    border-radius: 10px;
    padding: 3px 8px;
}

.wf-btn-action {
    border-radius: 5px !important;
    margin-left: 4px;
}

.wf-empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
}

    .wf-empty-state h4 {
        margin: 12px 0 6px 0;
        color: #475569;
        font-weight: 700;
    }

/* 4. Modal de Configuração do Flow */
.wf-modal {
    border-radius: 12px !important;
    border: none;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.wf-modal-header {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 20px;
}

    .wf-modal-header .modal-title {
        font-size: 16px;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0;
    }

.wf-fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px 14px 16px;
    margin-bottom: 10px;
}

    .wf-fieldset legend {
        width: auto;
        border: none;
        font-size: 12.5px;
        font-weight: 700;
        color: #334155;
        padding: 0 8px;
        margin-bottom: 4px;
    }

.wf-label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 5px;
    display: block;
}

.wf-help-text {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 4px;
    margin-bottom: 0;
}

/* Editor de Código do Flow JSON */
.wf-json-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.wf-json-textarea {
    width: 100%;
    height: 380px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    background-color: #1e293b;
    color: #f8fafc;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 10px 12px;
    resize: vertical;
    white-space: pre;
    outline: none;
    box-sizing: border-box;
}

    .wf-json-textarea:focus {
        border-color: #0284c7;
        box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25);
    }

/* Erros de Validação da Meta */
.wf-validation-box {
    background-color: #fef2f2;
    border: 1px solid #f87171;
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 12px;
}

    .wf-validation-box h5 {
        margin: 0 0 6px 0;
        color: #991b1b;
        font-size: 12.5px;
        font-weight: 700;
    }

.wf-validation-list {
    margin: 0;
    padding-left: 18px;
    font-size: 11.5px;
    color: #7f1d1d;
}

    .wf-validation-list li {
        margin-bottom: 3px;
    }

/* 5. Simulador WhatsApp (Preview à Direita) */
.wf-preview-panel {
    background-color: #efeae2; /* Fundo oficial do WhatsApp */
    border: 1px solid #d1d7db;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 480px;
}

.wf-preview-header {
    background-color: #008069;
    color: #ffffff;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wf-preview-screen {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.wf-wa-bubble {
    background-color: #ffffff;
    border-radius: 8px 8px 8px 0;
    padding: 10px 12px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.13);
    max-width: 95%;
    margin: 0 auto;
}

.wf-wa-title {
    font-weight: 700;
    font-size: 13px;
    color: #111b21;
    margin-bottom: 4px;
}

.wf-wa-text {
    font-size: 12.5px;
    line-height: 1.45;
    color: #3b4a54;
    margin-bottom: 10px;
}

.wf-wa-flow-button {
    display: block;
    width: 100%;
    text-align: center;
    background-color: #f0f2f5;
    border-top: 1px solid #e9edef;
    color: #00a884;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 10px;
    border-radius: 0 0 6px 6px;
    cursor: default;
    border: none;
}

    .wf-wa-flow-button i {
        margin-right: 4px;
    }

.wf-preview-footer {
    background-color: #ffffff;
    padding: 8px 12px;
    border-top: 1px solid #e2e8f0;
    font-size: 11px;
    color: #64748b;
}

/* 6. Histórico de Versões na Modal */
.wf-version-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.15s ease;
}

    .wf-version-card:hover {
        border-color: #cbd5e1;
        background-color: #f8fafc;
    }

.wf-version-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
}

.wf-version-subtitle {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 2px;
}

/* 7. Botões da Modal */
.wf-modal-footer {
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 12px 20px;
}

.wf-btn-salvar {
    background-color: #0284c7 !important;
    border-color: #0369a1 !important;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 13px;
    padding: 7px 18px;
    border-radius: 6px !important;
}

.wf-btn-publicar {
    background-color: #00a884 !important;
    border-color: #008069 !important;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 13px;
    padding: 7px 18px;
    border-radius: 6px !important;
}
