/* ============================================================
   PUBLICSCIENCE — admin.css  v4 (completo + tipografia corrigida)
   ============================================================ */

/* ── Google Fonts carregado direto no CSS ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ── Variáveis ── */
:root {
  --blue-950: #0a1628;
  --blue-900: #0f2040;
  --blue-700: #1e4080;
  --blue-600: #1a56db;
  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --blue-50:  #eff6ff;
  --accent:   #06d6a0;
  --gray-900: #111318;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-400: #9ca3af;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50:  #f9fafb;
  --white:    #ffffff;

  --font-head: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.14);

  --transition: .2s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: #f1f5f9;
  color: #1e293b;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ── Botões ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-md);
  font-family: var(--font-head); font-weight: 600; font-size: .82rem;
  letter-spacing: .01em; cursor: pointer;
  border: 1.5px solid transparent; transition: all var(--transition);
  white-space: nowrap; line-height: 1;
}
.btn-primary { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }
.btn-primary:hover { background: var(--blue-700); box-shadow: 0 4px 14px rgba(26,86,219,.35); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--blue-600); border-color: var(--blue-600); }
.btn-outline:hover { background: var(--blue-50); transform: translateY(-1px); }
.btn-sm { padding: 6px 13px; font-size: .76rem; }
.btn-lg { padding: 12px 26px; font-size: .9rem; }

/* ================================================================
   LAYOUT
   ================================================================ */
.admin-layout { display: flex; min-height: 100vh; }

/* ================================================================
   SIDEBAR
   ================================================================ */
.admin-sidebar {
  width: 248px; flex-shrink: 0;
  background: #0f172a;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; overflow-y: auto;
  display: flex; flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
}

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 36px; height: 36px; background: #1d4ed8;
  border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 1.2rem; flex-shrink: 0;
}
.logo-text {
  font-family: var(--font-head); font-weight: 800; font-size: 1.05rem;
  color: #fff; letter-spacing: -.02em;
}

.sidebar-nav { flex: 1; padding: 10px 10px 16px; }

.sidebar-section-label {
  display: block;
  font-family: var(--font-head);
  font-size: .62rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255,255,255,.2);
  padding: 0 10px; margin: 22px 0 6px;
}
.sidebar-section-label:first-child { margin-top: 6px; }

.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: rgba(255,255,255,.55);
  font-family: var(--font-body);
  font-size: .84rem; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 1px;
}
.sidebar-link:hover  { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-link.active { background: #1d4ed8; color: #fff; }
.sidebar-link .icon  { width: 20px; text-align: center; font-size: .95rem; flex-shrink: 0; }

.sidebar-badge {
  margin-left: auto; background: #ef4444; color: #fff;
  font-size: .65rem; font-weight: 700; min-width: 18px; height: 18px;
  border-radius: 9px; display: flex; align-items: center;
  justify-content: center; padding: 0 4px;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
  font-size: .81rem;
}
.sidebar-footer a { color: rgba(255,255,255,.32); transition: color var(--transition); }
.sidebar-footer a:hover { color: #fff; }

/* ================================================================
   MAIN
   ================================================================ */
.admin-main {
  margin-left: 248px;
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
  background: #f1f5f9;
}

/* Topbar */
.admin-topbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  height: 60px; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 40;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  gap: 16px;
}
.topbar-title {
  font-family: var(--font-head);
  font-size: 1rem; font-weight: 700; color: #0f172a;
  flex-shrink: 0; letter-spacing: -.01em;
}
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-user  { display: flex; align-items: center; gap: 8px; font-size: .83rem; color: #475569; font-weight: 500; }
.topbar-avatar {
  width: 33px; height: 33px; background: #1d4ed8; color: #fff;
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: .82rem; flex-shrink: 0;
}

/* Analytics badge */
.ga-topbar-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  font-family: var(--font-body);
  font-size: .73rem; font-weight: 600;
  border: 1px solid; transition: opacity var(--transition);
  text-decoration: none; white-space: nowrap;
}
.ga-topbar-badge:hover { opacity: .75; }
.ga-topbar-badge--on  { background: #f0fdf4; border-color: #86efac; color: #065f46; }
.ga-topbar-badge--off { background: #f8fafc; border-color: #cbd5e1; color: #94a3b8; }
.ga-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.ga-topbar-badge--on  .ga-dot { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,.25); animation: gadot 2s ease infinite; }
.ga-topbar-badge--off .ga-dot { background: #cbd5e1; }
@keyframes gadot { 0%,100%{box-shadow:0 0 0 2px rgba(34,197,94,.25)} 50%{box-shadow:0 0 0 5px rgba(34,197,94,.07)} }
.ga-topbar-badge code { font-size:.7rem; background:rgba(0,0,0,.07); padding:1px 5px; border-radius:3px; font-family:monospace; }

/* Content */
.admin-content { padding: 26px 30px; flex: 1; }

/* ================================================================
   DASHBOARD — Welcome
   ================================================================ */
.dash-welcome {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 24px;
}
.dash-welcome h1 {
  font-family: var(--font-head);
  font-size: 1.55rem; font-weight: 800;
  color: #0f172a; letter-spacing: -.03em; line-height: 1.2;
  margin-bottom: 3px;
}
.dash-welcome p { font-size: .82rem; color: #94a3b8; font-weight: 400; }

/* ================================================================
   STAT CARDS
   ================================================================ */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg); padding: 18px 16px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: #bfdbfe; }

.stat-card-icon {
  width: 44px; height: 44px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.stat-card-icon--blue   { background: #eff6ff; }
.stat-card-icon--green  { background: #f0fdf4; }
.stat-card-icon--yellow { background: #fffbeb; }
.stat-card-icon--purple { background: #faf5ff; }

.stat-card-body { min-width: 0; }
.stat-label {
  display: block;
  font-family: var(--font-head);
  font-size: .65rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  color: #94a3b8; margin-bottom: 5px;
}
.stat-val {
  display: block;
  font-family: var(--font-head);
  font-size: 2rem; font-weight: 800;
  color: #0f172a; line-height: 1; letter-spacing: -.04em;
}
.stat-change {
  display: block;
  font-family: var(--font-body);
  font-size: .71rem; font-weight: 500;
  color: #059669; margin-top: 5px;
}

/* ================================================================
   ROWS & CARDS
   ================================================================ */
.dash-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.dash-card { background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius-lg); overflow: hidden; }
.dash-card-header {
  padding: 16px 20px; border-bottom: 1px solid #f1f5f9;
  display: flex; justify-content: space-between; align-items: center;
}
.dash-card-header h3 {
  font-family: var(--font-head);
  font-size: .9rem; font-weight: 700; color: #0f172a; letter-spacing: -.01em;
}
.dash-card-body {}

/* Quick actions */
.quick-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 14px; }
.quick-action-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 14px; background: #f8fafc;
  border: 1px solid #e2e8f0; border-radius: 10px;
  font-family: var(--font-head); font-size: .8rem; font-weight: 600;
  color: #334155; transition: all var(--transition); cursor: pointer;
}
.quick-action-btn:hover {
  background: #eff6ff; border-color: #93c5fd;
  color: #1d4ed8; transform: translateY(-2px);
  box-shadow: 0 3px 10px rgba(0,0,0,.07);
}
.qa-icon {
  width: 28px; height: 28px; background: #fff; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ================================================================
   TABLES
   ================================================================ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-family: var(--font-head);
  font-size: .67rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: #94a3b8; padding: 10px 18px;
  background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
.data-table td {
  padding: 12px 18px; border-bottom: 1px solid #f1f5f9;
  font-family: var(--font-body); font-size: .84rem;
  color: #475569; vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8faff; }
.empty-row td {
  text-align: center; padding: 32px;
  font-family: var(--font-body); color: #94a3b8; font-size: .84rem;
}

/* ================================================================
   BADGES
   ================================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  font-family: var(--font-head); font-size: .68rem; font-weight: 700;
  letter-spacing: .04em; white-space: nowrap;
}
.badge--green  { background: #d1fae5; color: #065f46; }
.badge--yellow { background: #fef3c7; color: #92400e; }
.badge--blue   { background: #dbeafe; color: #1e40af; }
.badge--red    { background: #fee2e2; color: #991b1b; }
.badge--gray   { background: #f3f4f6; color: #374151; }
.badge--purple { background: #ede9fe; color: #5b21b6; }

/* ================================================================
   FORMS
   ================================================================ */
.form-card {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg); padding: 26px 30px; margin-bottom: 18px;
}
.form-card h2 {
  font-family: var(--font-head);
  font-size: 1rem; font-weight: 700; color: #0f172a;
  letter-spacing: -.01em; margin-bottom: 20px;
  padding-bottom: 14px; border-bottom: 1px solid #f1f5f9;
}
.form-grid    { display: grid; grid-template-columns: 1fr 1fr;       gap: 16px; }
.form-grid--3 { display: grid; grid-template-columns: 1fr 1fr 1fr;   gap: 16px; }
.form-group   { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-family: var(--font-head);
  font-size: .74rem; font-weight: 700; color: #374151; letter-spacing: .03em;
}
.required { color: #ef4444; margin-left: 2px; }
.form-hint { font-family: var(--font-body); font-weight: 400; color: #9ca3af; font-size: .74rem; margin-left: 8px; }
.form-hint code { background: #f3f4f6; padding: 1px 4px; border-radius: 3px; font-size: .74rem; }
.form-note { font-family: var(--font-body); font-size: .74rem; color: #9ca3af; margin-top: 5px; }

.form-control {
  padding: 10px 13px;
  border: 1.5px solid #e2e8f0; border-radius: 9px;
  font-family: var(--font-body); font-size: .87rem;
  color: #0f172a; background: #fff; width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.form-control::placeholder { color: #cbd5e1; }
textarea.form-control { resize: vertical; min-height: 88px; }

.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding-top: 18px; border-top: 1px solid #f1f5f9; margin-top: 18px;
}

/* ================================================================
   PAGE HEADER
   ================================================================ */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.page-header h1 {
  font-family: var(--font-head);
  font-size: 1.35rem; font-weight: 800; color: #0f172a; letter-spacing: -.02em;
}
.page-header p { font-family: var(--font-body); font-size: .83rem; color: #94a3b8; margin-top: 3px; }

/* ================================================================
   FLASH MESSAGES
   ================================================================ */
.flash-msg {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 18px;
  font-family: var(--font-body); font-weight: 500; font-size: .86rem;
  display: flex; align-items: center; gap: 9px;
}
.flash-msg--success { background: #f0fdf4; border: 1px solid #86efac; color: #065f46; }
.flash-msg--error   { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.flash-msg--warning { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }
.flash-msg--info    { background: #eff6ff; border: 1px solid #93c5fd; color: #1e40af; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1280px) { .dash-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1024px) { .admin-content { padding: 18px 20px; } }
@media (max-width: 900px)  {
  .admin-layout  { display: block; }
  .admin-sidebar { transform: translateX(-100%); transition: transform var(--transition); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main    { margin-left: 0; }
  .dash-row      { grid-template-columns: 1fr; }
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px)  {
  .dash-stats { grid-template-columns: 1fr 1fr; }
  .admin-content { padding: 14px; }
  .topbar-right .ga-topbar-badge { display: none; }
}
