/* ═══════════════════════════════════════════════════════════════
   WhatsApp Bulk Panel — Dark Theme CSS
═══════════════════════════════════════════════════════════════ */
:root {
  --bg-primary:    #0f1117;
  --bg-secondary:  #1a1d2e;
  --bg-card:       #1e2135;
  --bg-input:      #252840;
  --border:        #2d3154;
  --text-primary:  #e8eaf6;
  --text-secondary:#9fa8da;
  --text-muted:    #6272a4;
  --accent:        #25D366;
  --accent-dark:   #1ba350;
  --danger:        #ff5c75;
  --warning:       #ffb347;
  --info:          #5ebbff;
  --purple:        #bd93f9;
  --sidebar-w:     230px;
  --radius:        10px;
  --shadow:        0 4px 20px rgba(0,0,0,.35);
}

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

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg-primary); color: var(--text-primary); }

/* ─── AUTH ─────────────────────────────────────────────────────── */
.auth-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #1a2b1e 0%, var(--bg-primary) 70%);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%; max-width: 380px;
  box-shadow: var(--shadow);
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo h1 { font-size: 1.4rem; margin-top: 12px; }
.auth-logo p  { color: var(--text-muted); font-size: .85rem; margin-top: 4px; }

/* ─── FORMS ─────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .82rem; color: var(--text-secondary); margin-bottom: 6px; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; }

.input-field,
.auth-form input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: .9rem;
  transition: border .2s;
  outline: none;
}
.input-field:focus,
.auth-form input:focus { border-color: var(--accent); }

textarea.input-field { resize: vertical; min-height: 100px; }
select.input-field { cursor: pointer; }

.input-search {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 8px 14px;
  font-size: .88rem;
  outline: none;
  width: 240px;
}
.input-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 8px 14px;
  font-size: .88rem;
  outline: none;
  cursor: pointer;
}

/* ─── BUTTONS ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius);
  border: none; cursor: pointer;
  font-size: .88rem; font-weight: 500;
  transition: all .15s;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }

.btn-primary  { background: var(--accent); color: #0f1117; }
.btn-primary:hover { background: var(--accent-dark); }

.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .85; }

.btn-success  { background: #2ec96e; color: #0f1117; }
.btn-success:hover { background: #25a65b; }

.btn-ghost    { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-input); }

.btn-sm { padding: 6px 13px; font-size: .82rem; }
.btn-full { width: 100%; justify-content: center; }

/* ─── DASHBOARD LAYOUT ───────────────────────────────────────────── */
.dashboard-body { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: .95rem;
}

.sidebar-nav { padding: 12px 8px; flex: 1; overflow-y: auto; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  color: var(--text-secondary); text-decoration: none;
  font-size: .88rem; margin-bottom: 4px;
  transition: all .15s;
}
.nav-item:hover, .nav-item.active {
  background: var(--bg-card);
  color: var(--text-primary);
}
.nav-item.active { border-left: 3px solid var(--accent); }
.nav-icon { font-size: 1rem; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}

.wa-status-badge {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem; color: var(--text-secondary);
}

.status-dot {
  width: 9px; height: 9px; border-radius: 50%;
}
.status-dot.online  { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.status-dot.offline { background: #555; }
.status-dot.qr      { background: var(--warning); }

/* ─── MAIN CONTENT ───────────────────────────────────────────────── */
.main-content {
  flex: 1; overflow-y: auto;
  padding: 28px 32px;
}

.page { display: none; animation: fadeIn .2s ease; }
.page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h2 { font-size: 1.4rem; }
.header-actions { display: flex; gap: 10px; }

/* ─── CARDS ─────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-header h3 { font-size: 1rem; }

/* ─── STAT GRID ──────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 16px;
}

.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.stat-icon.green  { background: rgba(37,211,102,.15); }
.stat-icon.red    { background: rgba(255,92,117,.15); }
.stat-icon.blue   { background: rgba(94,187,255,.15); }
.stat-icon.purple { background: rgba(189,147,249,.15); }

.stat-value { font-size: 1.6rem; font-weight: 700; }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }

/* ─── WARMUP ─────────────────────────────────────────────────────── */
.warmup-info {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr));
  gap: 12px; margin-bottom: 14px;
}
.warmup-item { display: flex; flex-direction: column; gap: 4px; }
.warmup-item span { font-size: .75rem; color: var(--text-muted); }
.warmup-item strong { font-size: .95rem; }

.progress-bar-wrap {
  background: var(--bg-input);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #00a896);
  border-radius: 99px;
  transition: width .5s ease;
}

/* ─── BADGE ──────────────────────────────────────────────────────── */
.badge {
  padding: 3px 10px; border-radius: 99px;
  font-size: .72rem; font-weight: 600;
}
.badge-green  { background: rgba(37,211,102,.2); color: var(--accent); }
.badge-red    { background: rgba(255,92,117,.2); color: var(--danger); }
.badge-orange { background: rgba(255,179,71,.2);  color: var(--warning); }
.badge-blue   { background: rgba(94,187,255,.2);  color: var(--info); }
.badge-gray   { background: rgba(120,120,140,.2); color: #aaa; }

/* ─── TABLE ──────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%; border-collapse: collapse;
  font-size: .85rem;
}
.data-table th {
  padding: 10px 12px; text-align: left;
  color: var(--text-muted); font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.02); }

/* ─── PAGINATION ─────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  padding-top: 14px; flex-wrap: wrap;
}
.page-btn {
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-secondary); border-radius: 8px;
  padding: 5px 12px; cursor: pointer; font-size: .8rem;
}
.page-btn.active, .page-btn:hover { background: var(--accent); color: #111; border-color: var(--accent); }

/* ─── FILTERS ────────────────────────────────────────────────────── */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px; align-items: center;
}

/* ─── WHATSAPP PAGE ──────────────────────────────────────────────── */
.wa-panel { display: flex; justify-content: center; }
.wa-status-card {
  text-align: center; max-width: 420px; width: 100%;
  padding: 40px;
}
.wa-big-icon { font-size: 4rem; margin-bottom: 14px; }
.wa-state-label { font-size: 1.3rem; font-weight: 600; margin-bottom: 8px; }
.wa-info { color: var(--text-muted); font-size: .88rem; margin-bottom: 20px; }
.qr-hint { color: var(--text-muted); font-size: .85rem; margin-bottom: 14px; }
.qr-image {
  border-radius: 12px;
  border: 4px solid white;
  max-width: 220px;
  display: block; margin: 0 auto;
}
.wa-btn-group { margin-top: 20px; display: flex; gap: 10px; justify-content: center; }

/* ─── LIVE SEND ──────────────────────────────────────────────────── */
.live-progress { }
.live-stats {
  display: flex; gap: 24px;
  margin-bottom: 14px; font-size: .92rem;
}
.realtime-feed {
  margin-top: 14px;
  max-height: 180px; overflow-y: auto;
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 10px;
  font-size: .8rem;
  font-family: 'Cascadia Code', monospace;
}
.feed-line { padding: 2px 0; }
.feed-line.sent   { color: var(--accent); }
.feed-line.failed { color: var(--danger); }

/* ─── ALERTS ─────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: .85rem;
  margin: 10px 0;
}
.alert-error   { background: rgba(255,92,117,.15); color: var(--danger); border: 1px solid rgba(255,92,117,.3); }
.alert-success { background: rgba(37,211,102,.15); color: var(--accent); border: 1px solid rgba(37,211,102,.3); }
.alert-info    { background: rgba(94,187,255,.15);  color: var(--info);   border: 1px solid rgba(94,187,255,.3); }

/* ─── INFO BOX ───────────────────────────────────────────────────── */
.info-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .84rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

/* ─── MODALS ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow);
  max-height: 90vh; overflow-y: auto;
}
.modal-lg { max-width: 640px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; }
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 22px; }

/* ─── CHART ──────────────────────────────────────────────────────── */
.chart-wrap {
  display: flex; align-items: flex-end; gap: 10px;
  height: 120px; padding: 0 4px;
}
.chart-bar-group {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.chart-bars { display: flex; align-items: flex-end; gap: 2px; height: 90px; width: 100%; }
.chart-bar {
  flex: 1; border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height .3s ease;
}
.chart-bar.sent   { background: var(--accent); opacity: .8; }
.chart-bar.failed { background: var(--danger); opacity: .8; }
.chart-label { font-size: .72rem; color: var(--text-muted); }

/* ─── SCROLLBAR ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── CODE ───────────────────────────────────────────────────────── */
code {
  background: var(--bg-input);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: .82em;
  font-family: 'Cascadia Code', monospace;
  color: var(--accent);
}
