/* ═══════════════════════════════════════════════════════
   PLATAFORMA CANDIDATOS — DESIGN SYSTEM v1
   ═══════════════════════════════════════════════════════ */

/* ── TOKENS ─────────────────────────────────────────── */
:root {
  /* Palette — dark */
  --c-bg:          #0f172a;
  --c-bg-card:     #1e293b;
  --c-bg-surface:  #334155;
  --c-border:      #334155;
  --c-text:        #e2e8f0;
  --c-text-muted:  #94a3b8;
  --c-text-faint:  #64748b;

  /* Palette — light (landing sections) */
  --c-white:       #ffffff;
  --c-gray-50:     #f8fafc;
  --c-gray-100:    #f1f5f9;
  --c-gray-200:    #e2e8f0;
  --c-gray-900:    #0f172a;

  /* Brand */
  --c-primary:       #2563eb;
  --c-primary-hover: #1d4ed8;
  --c-primary-light: #dbeafe;
  --c-primary-glow:  rgba(37,99,235,.25);
  --c-success:       #16a34a;
  --c-success-bg:    #14532d;
  --c-danger:        #ef4444;
  --c-danger-bg:     #450a0a;
  --c-warning:       #d97706;
  --c-warning-bg:    #713f12;

  /* Typography */
  --font: system-ui, -apple-system, 'Inter', sans-serif;
  --text-xs:   .75rem;
  --text-sm:   .875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;
  --text-6xl:  3.75rem;

  /* Spacing — escala de 4px */
  --sp-1:  4px;  --sp-2:  8px;  --sp-3:  12px; --sp-4:  16px;
  --sp-5:  20px; --sp-6:  24px; --sp-8:  32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px; --sp-24: 96px;

  /* Border radius */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 1px 2px rgba(0,0,0,.3);
  --shadow-card: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-lg:   0 10px 40px rgba(0,0,0,.5);
  --shadow-glow: 0 0 40px var(--c-primary-glow);

  /* Transitions */
  --t:     .15s ease;
  --t-med: .25s ease;
}

/* ── RESET ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); font-size: var(--text-base); color: var(--c-text); line-height: 1.6; }
a { color: inherit; }
img { max-width: 100%; display: block; }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 20px;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: background var(--t), transform var(--t), box-shadow var(--t);
  white-space: nowrap;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary  { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-hover); box-shadow: 0 4px 16px rgba(37,99,235,.4); }
.btn-ghost    { background: var(--c-bg-surface); color: var(--c-text); }
.btn-ghost:hover { background: #475569; }
.btn-ghost-light { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.15); }
.btn-ghost-light:hover { background: rgba(255,255,255,.18); }
.btn-outline  { background: transparent; color: var(--c-text); border: 1px solid var(--c-border); }
.btn-outline:hover { background: var(--c-bg-surface); }
.btn-danger   { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success  { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-wa { background: #25d366; color: #fff; }
.btn-wa:hover { background: #1ebe5a; box-shadow: 0 4px 20px rgba(37,211,102,.4); }
.btn-sm  { padding: 6px 14px; font-size: var(--text-xs); border-radius: var(--r-sm); }
.btn-lg  { padding: 14px 28px; font-size: var(--text-base); border-radius: var(--r-lg); }
.btn-xl  { padding: 18px 36px; font-size: var(--text-lg); border-radius: var(--r-lg); }

/* ── BADGES ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 700;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .7;
  flex-shrink: 0;
}
.badge.conectado    { background: var(--c-success-bg); color: #86efac; }
.badge.pendente     { background: var(--c-warning-bg); color: #fde68a; }
.badge.desconectado { background: var(--c-danger-bg);  color: #fca5a5; }
.badge.ativo        { background: #1e3a5f; color: #93c5fd; }
.badge.inativo      { background: #1e1e2e; color: #6b7280; }
.badge.publicado    { background: var(--c-success-bg); color: #86efac; }
.badge.erro         { background: var(--c-danger-bg);  color: #fca5a5; }

/* ── CARDS ───────────────────────────────────────────── */
.card {
  background: var(--c-bg-card);
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.05);
  box-shadow: var(--shadow-card);
}
.card-header {
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--c-border);
}
.card-header h2 { font-size: var(--text-sm); font-weight: 600; }

/* ── STAT CARDS ──────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.stat-card {
  background: var(--c-bg-card);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  border: 1px solid rgba(255,255,255,.05);
}
.stat-card .stat-label { font-size: var(--text-xs); color: var(--c-text-faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--sp-2); }
.stat-card .stat-value { font-size: var(--text-3xl); font-weight: 700; }
.stat-card .stat-sub   { font-size: var(--text-xs); color: var(--c-text-muted); margin-top: var(--sp-1); }

/* ── FORMS ───────────────────────────────────────────── */
label {
  display: block;
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  margin-bottom: var(--sp-1);
  margin-top: var(--sp-3);
  font-weight: 500;
  letter-spacing: .02em;
}
input, textarea, select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-3);
  transition: border-color var(--t), box-shadow var(--t);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
input:disabled { color: var(--c-text-faint); cursor: not-allowed; }
textarea { min-height: 80px; resize: vertical; }

/* ── TABLES ──────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  color: var(--c-text-faint);
  font-size: var(--text-xs);
  text-transform: uppercase;
  padding: 10px 16px;
  border-bottom: 1px solid var(--c-border);
  letter-spacing: .05em;
  font-weight: 600;
}
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--c-bg);
  font-size: var(--text-sm);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #162032; }

/* ── TOAST ───────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--c-success);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: 500;
  opacity: 0;
  transition: opacity var(--t-med), transform var(--t-med);
  pointer-events: none;
  z-index: 200;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--c-danger); }

/* ── OVERLAY / DRAWER ────────────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.overlay.open { display: flex; }
.drawer {
  background: var(--c-bg-card);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%;
  max-width: 860px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.drawer-head {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.drawer-head h2 { font-size: var(--text-lg); font-weight: 700; }
.drawer-body    { flex: 1; overflow-y: auto; }

/* ── TABS ────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--c-border);
  padding: 0 var(--sp-6);
  flex-shrink: 0;
  background: var(--c-bg-card);
  overflow-x: auto;
}
.tab-btn {
  padding: 12px 18px;
  font-size: var(--text-sm);
  background: none;
  border: none;
  color: var(--c-text-faint);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
  transition: color var(--t);
  font-family: var(--font);
  white-space: nowrap;
}
.tab-btn:hover    { color: var(--c-text); }
.tab-btn.active   { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.tab-pane         { display: none; padding: var(--sp-6); }
.tab-pane.active  { display: block; }

/* ── LISTS ───────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--c-bg);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-2);
  font-size: var(--text-sm);
  gap: var(--sp-3);
  border: 1px solid rgba(255,255,255,.04);
}
.list-item .info { flex: 1; }
.list-item .sub  { color: var(--c-text-faint); font-size: var(--text-xs); margin-top: 2px; }

.empty-state { text-align: center; color: var(--c-text-faint); padding: var(--sp-8); font-size: var(--text-sm); }

.section-title {
  font-size: var(--text-xs);
  text-transform: uppercase;
  color: var(--c-text-faint);
  letter-spacing: .08em;
  margin: var(--sp-5) 0 var(--sp-3);
  font-weight: 600;
}

.add-row { display: flex; gap: var(--sp-3); margin-top: var(--sp-2); }
.add-row input { margin-bottom: 0; flex: 1; }

.erro { color: #f87171; font-size: var(--text-xs); margin-top: var(--sp-2); }

/* ── MISC ────────────────────────────────────────────── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-5); }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }

.qr-link-box {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  background: var(--c-bg);
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin-top: var(--sp-2);
  border: 1px solid var(--c-border);
}
.qr-link-box code { flex: 1; color: #60a5fa; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); }

.wa-status-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 14px;
  background: var(--c-bg);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-4);
  border: 1px solid rgba(255,255,255,.04);
}
.wa-status-row .label { font-size: var(--text-xs); color: var(--c-text-faint); }

.pub-item {
  padding: 12px 14px;
  background: var(--c-bg);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-2);
  border: 1px solid rgba(255,255,255,.04);
}
.pub-item a { color: #60a5fa; text-decoration: none; font-size: var(--text-xs); }
.pub-item a:hover { text-decoration: underline; }
.pub-date { color: var(--c-text-faint); font-size: var(--text-xs); margin-top: 3px; }

.spin { animation: _rotate .8s linear infinite; display: inline-block; }
@keyframes _rotate { to { transform: rotate(360deg); } }

/* ── SCROLLBAR ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-bg-surface); border-radius: var(--r-full); }
