/* campanhas.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
}

.header {
    background: #1a1a2e;
    color: #fff;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.header h1 { font-size: 1.1rem; font-weight: 600; }
.header a { color: #7ec8e3; font-size: 0.85rem; text-decoration: none; }

.container { max-width: 1100px; margin: 24px auto; padding: 0 16px; }

.campaigns-grid { display: flex; flex-direction: column; gap: 16px; }

.campaign-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    overflow: hidden;
}
.campaign-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #f0f2f5;
}
.campaign-header:hover { background: #fafafa; }
.campaign-name { font-weight: 600; font-size: 1rem; flex: 1; }

.badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-active    { background: #d4edda; color: #155724; }
.badge-paused    { background: #fff3cd; color: #856404; }
.badge-completed { background: #cce5ff; color: #004085; }
.badge-cancelled { background: #f8d7da; color: #721c24; }
.badge-running   { background: #cce5ff; color: #004085; animation: pulse 1.5s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .5; }
}

.campaign-stats { display: flex; gap: 16px; font-size: 0.8rem; color: #666; }
.stat-value { font-weight: 600; color: #333; }

.campaign-actions { display: flex; gap: 6px; }

.btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    transition: opacity .15s;
}
.btn:hover { opacity: .8; }
.btn-primary   { background: #128C7E; color: #fff; }
.btn-warning   { background: #f0ad4e; color: #fff; }
.btn-danger    { background: #e74c3c; color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-sm        { padding: 3px 9px; font-size: 0.78rem; }
.btn-block-perm { background: #6d28d9; color: #fff; }

.queue-panel { display: none; padding: 16px; background: #fafafa; }
.queue-panel.open { display: block; }

.add-manual-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
    background: #e8f4fd;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
}
.add-manual-form input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.83rem;
    flex: 1;
    min-width: 120px;
}
.add-manual-form label {
    font-size: 0.78rem;
    color: #555;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 120px;
}

/* ── Importar por lista ────────────────────────────────────────────────────── */
.paste-import-section {
    background: #f0f7ff;
    border: 1px dashed #90c2f7;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.paste-import-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1a5276;
    margin-bottom: 4px;
}
.paste-hint {
    font-size: 0.76rem;
    color: #555;
    margin-bottom: 8px;
    line-height: 1.4;
}
.paste-textarea {
    width: 100%;
    font-family: monospace;
    font-size: 0.8rem;
    padding: 8px;
    border: 1px solid #c5d8f0;
    border-radius: 6px;
    resize: vertical;
    background: #fff;
    margin-bottom: 8px;
    color: #222;
}
.paste-result {
    font-size: 0.78rem;
    color: #555;
    margin-bottom: 6px;
    min-height: 18px;
}
.paste-result-ok  { color: #155724; font-weight: 600; }
.paste-result-err { color: #721c24; font-weight: 600; }

.queue-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.queue-table th {
    background: #e9ecef;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #555;
}
.queue-table td { padding: 7px 10px; border-bottom: 1px solid #eee; }
.queue-table tr:last-child td { border-bottom: none; }
.queue-table tr:hover td { background: #f5f5f5; }

.status-pending  { color: #856404; }
.status-sent     { color: #155724; }
.status-failed   { color: #721c24; }
.status-skipped  { color: #999; text-decoration: line-through; }

.queue-table tr.row-skipped td { opacity: .55; background: #fafafa; }

.empty-msg { color: #999; font-size: 0.85rem; text-align: center; padding: 20px; }

.new-campaign-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    padding: 20px;
    margin-bottom: 24px;
}
.new-campaign-card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 14px; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.form-row label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 140px;
    font-size: 0.8rem;
    color: #555;
    font-weight: 500;
}
.form-row input, .form-row textarea {
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
}
.form-row textarea { resize: vertical; min-height: 70px; }

.variations-wrapper { margin-bottom: 10px; }
.variation-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.var-label { font-size: 0.75rem; color: #888; min-width: 20px; padding-top: 10px; font-weight: 600; }
.variation-row textarea { flex: 1; }

.add-variation-btn {
    font-size: 0.8rem;
    color: #128C7E;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0 0 12px 0;
    font-family: inherit;
}
.add-variation-btn:hover { text-decoration: underline; }

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1a1a2e;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.88rem;
    z-index: 9999;
    opacity: 0;
    transition: opacity .3s;
    pointer-events: none;
}
.toast.show  { opacity: 1; }
.toast.error { background: #c0392b; }

/* ── Modal de confirmação de envio ───────────────────────────────────────── */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.confirm-modal {
    background: #fff;
    border-radius: 12px;
    padding: 28px 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    text-align: center;
}
.confirm-icon   { font-size: 2.4rem; margin-bottom: 8px; }
.confirm-title  { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; color: #1a1a2e; }
.confirm-body   { font-size: 0.9rem; color: #444; line-height: 1.6; margin-bottom: 20px; }
.confirm-body strong { color: #128C7E; font-size: 1.3rem; }
.confirm-body .deferred-note {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #888;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 6px 10px;
}
.confirm-footer { display: flex; gap: 10px; justify-content: center; }
.confirm-footer .btn { min-width: 130px; padding: 8px 18px; font-size: 0.9rem; }

@media (max-width: 600px) {
    .campaign-header { flex-wrap: wrap; }
    .campaign-actions { width: 100%; }
}
