:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #10b981;
    --primary-hover: #059669;
    --secondary: #3b82f6;
    --secondary-hover: #2563eb;
    --border: #334155;
    --danger: #ef4444;
    --warning: #f59e0b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
}

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.highlight {
    color: var(--primary);
}

.content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .content {
        grid-template-columns: 1fr;
    }
}

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

/* ─── Badge de Status ─────────────────────────────────────────────────────── */
.badge {
    padding: 6px 16px;
    border-radius: 99px;
    font-size: 0.875rem;
    font-weight: 600;
    background-color: var(--card-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.badge.connected {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    border-color: rgba(16, 185, 129, 0.4);
}

/* Badge de agendamento ativo (no header) */
.scheduled-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.15);
    color: var(--secondary);
    border: 1px solid rgba(59, 130, 246, 0.4);
    animation: pulse 2s infinite;
}

.scheduled-badge button {
    background: none;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 2px;
    line-height: 1;
}

/* Badge diário */
.daily-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.08);
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Countdown badge no terminal */
.countdown-badge {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ─── QR Code ─────────────────────────────────────────────────────────────── */
.qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    background-color: white;
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
}

#qrCode {
    max-width: 100%;
}

/* ─── Form ────────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.helper-text {
    font-size: 0.8rem !important;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.contacts-input {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    color: white;
    font-size: 0.9rem;
    resize: vertical;
}

.contacts-input:focus {
    outline: none;
    border-color: var(--secondary);
}

/* Contador de contatos */
.contact-count-badge {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 0.75rem;
    color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    pointer-events: none;
}

.file-drop-area {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 1.2rem;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
    cursor: pointer;
}

.file-drop-area:hover {
    border-color: var(--secondary);
    background-color: rgba(59, 130, 246, 0.05);
}

.file-drop-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ─── Caixa de Mensagens ──────────────────────────────────────────────────── */
.msg-box {
    margin-bottom: 12px;
}

.msg-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.msg-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary);
    background: rgba(59, 130, 246, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

.preview-btn {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--primary);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-btn:hover {
    background: rgba(16, 185, 129, 0.2);
}

textarea.msg-input {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    color: white;
    font-size: 0.9rem;
    resize: vertical;
}

textarea.msg-input:focus {
    outline: none;
    border-color: var(--secondary);
}

/* ─── Delays ──────────────────────────────────────────────────────────────── */
.delay-inputs {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.delay-inputs input {
    width: 80px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    color: white;
    text-align: center;
}

.delay-inputs input:focus {
    outline: none;
    border-color: var(--secondary);
}

/* ─── Seções com destaque ─────────────────────────────────────────────────── */
.section-highlight {
    background: rgba(37, 211, 102, 0.04);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(37, 211, 102, 0.25);
}

.section-warn {
    background: rgba(245, 158, 11, 0.04);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.section-schedule {
    background: rgba(59, 130, 246, 0.04);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

/* Datetime input styling */
input[type="datetime-local"] {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    font-size: 0.9rem;
    flex: 1;
    min-width: 200px;
}

input[type="datetime-local"]:focus {
    outline: none;
    border-color: var(--secondary);
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
button {
    cursor: pointer;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary);
    color: white;
    font-size: 1rem;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background-color: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-secondary {
    padding: 0.6rem 1rem;
    background-color: transparent;
    color: var(--secondary);
    border: 1px dashed var(--secondary);
    font-size: 0.85rem;
}

.btn-secondary:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

/* ─── Terminal ────────────────────────────────────────────────────────────── */
.terminal-card {
    background-color: #0b0f19;
}

.terminal {
    height: 280px;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.82rem;
    color: #a3e635;
    background-color: #000;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #1f2937;
}

.log-entry {
    margin-bottom: 3px;
    word-break: break-word;
}

/* ─── Barra de Progresso ──────────────────────────────────────────────────── */
.progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #34d399);
    border-radius: 99px;
    transition: width 0.5s ease;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

/* ─── Toast System ────────────────────────────────────────────────────────── */
#toastContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 500;
    max-width: 380px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: all;
}

.toast.toast-visible {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #d1fae5;
}

.toast-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fee2e2;
}

.toast-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fef3c7;
}

.toast-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #dbeafe;
}

.toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.toast-msg {
    line-height: 1.4;
}

/* ─── Modais ──────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from {
        transform: scale(0.92);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1.1rem;
}

.modal-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-muted);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* Balão de preview (simula WhatsApp) */
.preview-bubble {
    background: #005c4b;
    border-radius: 12px 12px 2px 12px;
    padding: 14px 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #e9e9e9;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 60px;
    word-break: break-word;
}

/* ─── Grupos ──────────────────────────────────────────────────────────────── */
.group-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.group-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.group-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.group-item span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.group-item strong {
    font-size: 0.9rem;
}

.group-item small {
    font-size: 0.75rem;
}

/* ─── Loader / Pulse ──────────────────────────────────────────────────────── */
.loader {
    color: var(--text-muted);
    font-weight: 500;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

/* ─── Password Modal Input ──────────────────────────────────────────────────── */
#passwordInput {
    outline: none;
    transition: border-color 0.2s;
}

#passwordInput:focus {
    border-color: var(--secondary) !important;
}

#passwordSubmitBtn {
    width: 100%;
}