/* Banco de Fontes UFAL — estilos (paleta sky, alinhada ao site Node/Tailwind). */

:root {
  --bg: #f8fafc;            /* slate-50 */
  --fg: #0f172a;            /* slate-900 */
  --muted: #64748b;         /* slate-500 */
  --border: #e2e8f0;        /* slate-200 */
  --primary: #0083c9;       /* hsl(201 100% 38%) */
  --primary-dark: #00608f;  /* hsl(201 100% 28%) */
  --accent: #e6f4fb;        /* sky muito claro */
  --accent-fg: #00608f;
  --card: #ffffff;
  --danger: #dc2626;
  --success: #15803d;
  --radius: 0.75rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); }

.container { max-width: 1120px; margin: 0 auto; padding: 1.5rem; }

/* Header (sticky, branco, logo empilhado UFAL / Banco de Fontes) */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .inner {
  max-width: 1120px; margin: 0 auto; padding: 0.85rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.7rem; color: var(--fg); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand .brand-sup { font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.brand .brand-name { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.brand:hover { color: var(--fg); }
.nav { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--muted); font-size: 0.92rem; }
.nav a:hover { color: var(--primary-dark); }
/* Botões dentro da navbar: a regra .nav a (cinza) sobrescreveria a cor do .btn,
   então reforçamos aqui o contraste correto. */
.nav a.btn { color: #fff; }
.nav a.btn:hover { color: #fff; }
.nav a.btn-secondary { color: var(--fg); }
.nav a.btn-secondary:hover { color: var(--primary-dark); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.875rem; margin-top: 3rem; }
.site-footer .inner { max-width: 1120px; margin: 0 auto; padding: 1.5rem; }

/* Buttons (rounded-xl) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: 0.6rem 1.1rem; border-radius: var(--radius);
  background: var(--primary); color: #fff; border: 1px solid transparent; cursor: pointer;
  font-size: 0.92rem; font-weight: 600;
}
.btn:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }
.btn-secondary { background: #fff; color: var(--fg); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--accent); color: var(--primary-dark); }
.btn-block { display: flex; width: 100%; }

/* Cards (arredondados) */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 1.25rem; padding: 1.25rem; }
.grid { display: grid; gap: 1rem; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* Forms */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.35rem; }
.input, .textarea, select {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 0.95rem; background: #fff; color: var(--fg);
}
.input:focus, .textarea:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.textarea { min-height: 120px; resize: vertical; }

/* Chips / badges */
.chip {
  display: inline-block; padding: 0.2rem 0.65rem; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg); font-size: 0.8rem; margin: 0.15rem;
}

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.95rem; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

/* Utilities */
.muted { color: var(--muted); }
.center { text-align: center; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-4 { margin-top: 2rem; }
.auth-box { max-width: 420px; margin: 2rem auto; }
.page-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 0.5rem; }
.filters { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin-bottom: 0; flex: 1 1 180px; }
.avatar { width: 56px; height: 56px; border-radius: 999px; object-fit: cover; background: #e2e8f0; }

/* ===== Painéis com menu lateral (espelha dashboard-sidebar do Node) ===== */
.panel-wrap {
  max-width: 1120px; margin: 0 auto; padding: 1.5rem;
  display: grid; grid-template-columns: 270px 1fr; gap: 1.5rem; align-items: start;
}
@media (max-width: 860px) { .panel-wrap { grid-template-columns: 1fr; } }

.sidebar { position: sticky; top: 1.5rem; padding: 1rem; height: fit-content; }
.sidebar-head {
  display: flex; gap: 0.75rem; align-items: center;
  background: var(--accent); border-radius: 1rem; padding: 0.9rem 1rem; text-decoration: none;
}
.sidebar-head:hover { filter: brightness(0.98); }
.sidebar-logo {
  width: 44px; height: 44px; border-radius: 0.75rem; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem;
}
.sidebar-title { margin: 0; font-weight: 600; color: var(--fg); }
.sidebar-nav { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.2rem; }
.sidebar-link {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%; padding: 0.65rem 0.75rem; border-radius: var(--radius);
  font-size: 0.92rem; color: #334155; background: none; border: none; text-align: left;
  text-decoration: none; font-family: inherit;
}
.sidebar-link:hover { background: var(--accent); color: var(--primary-dark); }
.sidebar-link.active { background: var(--accent); color: var(--primary-dark); font-weight: 600; }
.sidebar-link-label { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.sidebar-link .sidebar-count { margin-left: auto; }
.sidebar-link-icon { color: #94a3b8; display: flex; flex: 0 0 auto; }
.sidebar-link:hover .sidebar-link-icon,
.sidebar-link.active .sidebar-link-icon { color: var(--primary-dark); }
.sidebar-logout:hover .sidebar-link-icon { color: #b91c1c; }
.sidebar-logout { color: #64748b; }
.sidebar-logout:hover { background: #fef2f2; color: #b91c1c; }
.sidebar-count {
  background: #fef3c7; color: #b45309; border-radius: 999px; min-width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; padding: 0 0.35rem;
}
.panel-content { min-width: 0; }

/* Tabelas dos painéis */
table { border-collapse: collapse; }
thead th { font-size: 0.85rem; color: var(--muted); }

/* ===== Home ===== */
.home-stack > * + * { margin-top: 2.5rem; }

.hero {
  border-radius: 32px; overflow: hidden; color: #fff;
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 55%, #0ea5e9 100%);
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.25);
  border: 1px solid #bae6fd;
}
.hero-grid { display: grid; gap: 2rem; padding: 2rem; }
@media (min-width: 768px) { .hero-grid { grid-template-columns: 1.2fr 0.8fr; padding: 3rem; } }
.hero-title { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1.15; }
@media (min-width: 768px) { .hero-title { font-size: 2.6rem; } }
.hero-sub { color: #e0f2fe; margin: 0.85rem 0 0; font-size: 1.02rem; max-width: 42rem; line-height: 1.5; }
.hero-search {
  background: #fff; border-radius: 1rem; padding: 0.75rem; margin-top: 1.6rem;
  display: flex; gap: 0.75rem; flex-wrap: wrap; box-shadow: 0 10px 20px rgba(0,0,0,0.18);
}
.hero-search-input {
  flex: 1 1 240px; display: flex; align-items: center; gap: 0.6rem;
  border: 1px solid var(--border); border-radius: 0.75rem; padding: 0 0.9rem;
}
.hero-search-icon { color: #94a3b8; display: flex; }
.hero-search-input input { border: 0; outline: 0; height: 48px; width: 100%; font-size: 0.95rem; color: var(--fg); background: transparent; }
.hero-search .btn { height: 48px; padding: 0 1.5rem; }
.hero-aside { background: rgba(255,255,255,0.1); border-radius: 1.5rem; padding: 1.5rem; backdrop-filter: blur(4px); }
.hero-aside h3 { margin: 0; font-size: 1.25rem; font-weight: 600; }
.hero-aside-sub { margin: 0.5rem 0 0; color: #e0f2fe; font-size: 0.9rem; }
.hero-steps { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.hero-step { display: flex; gap: 1rem; align-items: flex-start; background: rgba(255,255,255,0.1); border-radius: 1rem; padding: 1rem; font-size: 0.9rem; color: #e0f2fe; line-height: 1.45; }
.hero-step .num {
  flex: 0 0 auto; width: 1.5rem; height: 1.5rem; border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.4); display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 600; color: rgba(255,255,255,0.85);
}

.quick-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.quick-card { display: block; background: #fff; border: 1px solid var(--border); border-radius: 1.5rem; padding: 1.5rem; color: inherit; height: 100%; }
.quick-card:hover { border-color: #7dd3fc; background: var(--accent); color: inherit; }
.quick-icon { width: 48px; height: 48px; border-radius: 1rem; background: var(--accent); color: var(--primary-dark); display: flex; align-items: center; justify-content: center; margin-bottom: 0.85rem; }
.quick-card h3 { margin: 0.25rem 0; font-size: 1.1rem; font-weight: 600; color: var(--fg); }
.quick-card p { margin: 0; font-size: 0.88rem; color: var(--muted); line-height: 1.55; }

.featured-grid { display: grid; gap: 1.5rem; }
@media (min-width: 1024px) { .featured-grid { grid-template-columns: 1fr 0.95fr; } }
.panel-card { background: #fff; border: 1px solid var(--border); border-radius: 1.5rem; padding: 1.5rem; min-width: 0; }
.eyebrow { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--primary-dark); margin: 0; }
.fr-row { display: flex; gap: 1rem; align-items: flex-start; border: 1px solid var(--border); border-radius: 1rem; padding: 1rem; text-decoration: none; color: inherit; }
.fr-row:hover { border-color: #7dd3fc; background: var(--accent); color: inherit; }
.fr-avatar { width: 48px; height: 48px; border-radius: 999px; background: #e2e8f0; object-fit: cover; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; color: #475569; font-size: 0.95rem; }
.badge-soft { display: inline-block; background: #f1f5f9; color: #334155; border-radius: 999px; padding: 0.15rem 0.65rem; font-size: 0.78rem; }
.badge-status { display: inline-block; background: #ecfdf5; color: #047857; border-radius: 999px; padding: 0.15rem 0.65rem; font-size: 0.78rem; font-weight: 600; }

/* ===== Card de pesquisador (listagem) ===== */
.rcard {
  background: #fff; border: 1px solid var(--border); border-radius: 1.5rem; padding: 1.75rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}
@media (min-width: 768px) { .rcard { flex-direction: row; align-items: flex-start; justify-content: space-between; } }
.rcard:hover { border-color: #bae6fd; background: rgba(240, 249, 255, 0.4); }
.rcard-main { display: flex; gap: 1.25rem; min-width: 0; }
.rcard-avatar {
  width: 64px; height: 64px; border-radius: 999px; flex: 0 0 auto; object-fit: cover;
  background: #f1f5f9; color: #475569; display: inline-flex; align-items: center; justify-content: center; font-weight: 600;
  border: 1px solid var(--border);
}
.rcard-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.rcard-name { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; margin: 0; color: var(--fg); }
.rcard-sub { margin: 0.35rem 0 0; font-size: 0.9rem; }
.rcard-pin { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0.35rem 0 0; font-size: 0.9rem; }
.rcard-bio { margin: 0.75rem 0 0; font-size: 0.9rem; line-height: 1.55; color: #475569; max-width: 48rem; }
.rcard-topics { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.rcard-actions { display: flex; flex-direction: column; gap: 0.5rem; flex: 0 0 auto; }
@media (min-width: 768px) { .rcard-actions { width: 13rem; } }

/* Pilha de cards na listagem */
.rstack { display: flex; flex-direction: column; gap: 1.25rem; }

/* ===== Perfil público ===== */
.profile-header {
  background: #fff; border: 1px solid var(--border); border-radius: 32px; padding: 1.75rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}
@media (min-width: 768px) { .profile-header { flex-direction: row; align-items: flex-start; justify-content: space-between; padding: 2rem; } }
.profile-avatar {
  width: 80px; height: 80px; border-radius: 999px; flex: 0 0 auto; object-fit: cover;
  background: #f1f5f9; color: #475569; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 1.4rem; border: 1px solid var(--border);
}

/* Caixas de autenticação com cantos arredondados */
.auth-box .card { border-radius: 1.5rem; }

/* ===== Badges de estado (espelham as cores do Node) ===== */
.badge { display: inline-block; border-radius: 999px; padding: 0.15rem 0.65rem; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.badge-slate   { background: #f1f5f9; color: #334155; }
.badge-amber   { background: #fffbeb; color: #b45309; }
.badge-sky     { background: #f0f9ff; color: #0369a1; }
.badge-orange  { background: #fff7ed; color: #c2410c; }
.badge-rose    { background: #fff1f2; color: #be123c; }
.badge-emerald { background: #ecfdf5; color: #047857; }
.badge-violet  { background: #f5f3ff; color: #6d28d9; }

/* ===== Métricas do dashboard ===== */
.metrics-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
@media (min-width: 1024px) { .metrics-grid { grid-template-columns: repeat(3, 1fr); } }
.metric-card { display: flex; gap: 1rem; align-items: flex-start; background: #fff; border: 1px solid var(--border); border-radius: 1.5rem; padding: 1.25rem; }
.metric-icon { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 0.75rem; display: flex; align-items: center; justify-content: center; }
.metric-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; color: var(--fg); }
.metric-title { font-size: 0.9rem; font-weight: 600; color: #334155; margin: 0.1rem 0 0; }
.metric-desc { font-size: 0.78rem; color: var(--muted); margin: 0.25rem 0 0; }
.mi-sky     { background: #f0f9ff; color: #0284c7; }
.mi-emerald { background: #ecfdf5; color: #059669; }
.mi-amber   { background: #fffbeb; color: #d97706; }
.mi-orange  { background: #fff7ed; color: #ea580c; }
.mi-violet  { background: #f5f3ff; color: #7c3aed; }

/* ===== Breakdown "perfis por status" ===== */
.status-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .status-grid { grid-template-columns: repeat(5, 1fr); } }
.status-box { border-radius: 1rem; padding: 0.85rem 1rem; }
.status-box-head { display: flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 999px; flex: 0 0 auto; }
.status-count { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; margin: 0.5rem 0 0; color: var(--fg); }
.st-slate   { background: #f8fafc; } .st-slate   .status-box-head { color: #334155; } .st-slate   .status-dot { background: #94a3b8; }
.st-amber   { background: #fffbeb; } .st-amber   .status-box-head { color: #b45309; } .st-amber   .status-dot { background: #fbbf24; }
.st-sky     { background: #f0f9ff; } .st-sky     .status-box-head { color: #0369a1; } .st-sky     .status-dot { background: #38bdf8; }
.st-orange  { background: #fff7ed; } .st-orange  .status-box-head { color: #c2410c; } .st-orange  .status-dot { background: #fb923c; }
.st-emerald { background: #ecfdf5; } .st-emerald .status-box-head { color: #047857; } .st-emerald .status-dot { background: #34d399; }

/* Linhas de "recentes" */
.recent-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.recent-row:last-of-type { border-bottom: 0; }

/* ===== Busca pública com sidebar de filtros ===== */
.search-layout { display: grid; gap: 1.5rem; }
@media (min-width: 1024px) { .search-layout { grid-template-columns: 300px 1fr; align-items: start; } }
.filter-aside { border-radius: 1.5rem; height: fit-content; }
@media (min-width: 1024px) { .filter-aside { position: sticky; top: 1.5rem; } }
.filter-title { font-size: 0.9rem; font-weight: 600; color: #334155; margin: 0 0 0.6rem; }
.filter-list { display: flex; flex-direction: column; gap: 0.4rem; }
.filter-opt { display: block; border: 1px solid var(--border); border-radius: 0.75rem; padding: 0.5rem 0.75rem; font-size: 0.88rem; color: #334155; text-decoration: none; }
.filter-opt:hover { background: #f8fafc; color: #334155; }
.filter-opt.active { border-color: #bae6fd; background: var(--accent); color: var(--primary-dark); font-weight: 600; }
.search-field { display: flex; align-items: center; gap: 0.5rem; border: 1px solid var(--border); border-radius: 0.75rem; padding: 0 0.75rem; }
.search-field svg { color: #94a3b8; flex: 0 0 auto; }
.search-field input { border: 0; outline: 0; height: 44px; width: 100%; background: transparent; font-size: 0.9rem; color: var(--fg); }

/* ===== Páginas legais (termos / privacidade) ===== */
.legal { max-width: 48rem; margin: 0 auto; color: #334155; }
.legal section { margin-top: 2rem; }
.legal h2 { font-size: 1.1rem; font-weight: 600; color: var(--fg); margin: 0 0 0.6rem; }
.legal p { line-height: 1.75; font-size: 0.92rem; margin: 0 0 0.6rem; }
.legal ul { padding-left: 1.4rem; margin: 0; }
.legal li { line-height: 1.75; font-size: 0.92rem; margin-bottom: 0.3rem; }

/* Logo no cabeçalho */
.brand-logo { width: 40px; height: 40px; flex: 0 0 auto; }
.brand-row { display: flex; align-items: center; gap: 0.7rem; }

/* ===== Formulário (2 colunas) ===== */
.form-grid-2 { display: grid; gap: 1rem; }
@media (min-width: 640px) { .form-grid-2 { grid-template-columns: 1fr 1fr; } }
.format-grid { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.format-opt { display: flex; align-items: center; gap: 0.5rem; border: 1px solid var(--border); border-radius: 0.75rem; padding: 0.6rem 0.8rem; font-size: 0.9rem; cursor: pointer; font-weight: 500; }
.format-opt:hover { border-color: #bae6fd; background: var(--accent); }

/* ===== Páginas de autenticação (card de acesso + formulário) ===== */
.auth-grid { display: grid; gap: 1.5rem; max-width: 64rem; margin: 1rem auto; }
@media (min-width: 1024px) { .auth-grid { grid-template-columns: 0.95fr 1.05fr; align-items: stretch; } }
.access-card {
  border-radius: 28px; color: #fff; padding: 2rem; border: 1px solid #bae6fd;
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 55%, #0ea5e9 100%);
  display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
}
.access-badge { display: inline-block; background: rgba(12, 74, 110, 0.6); color: #fff; border-radius: 999px; padding: 0.25rem 0.75rem; font-size: 0.78rem; font-weight: 600; }
.access-title { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; margin: 1rem 0 0; }
.access-sub { color: #e0f2fe; margin: 0.75rem 0 0; line-height: 1.55; }
.access-highlights { display: flex; flex-direction: column; gap: 0.75rem; }
.access-highlight { display: flex; align-items: center; gap: 0.75rem; background: rgba(255,255,255,0.1); border-radius: 1rem; padding: 0.9rem 1rem; font-size: 0.9rem; font-weight: 500; }
.access-highlight svg { flex: 0 0 auto; }
.auth-card { border-radius: 28px; }
