/* ============================================================
   FEPRAG – Estilos do painel administrativo
   Arquivo: admin/admin.css
   ============================================================ */

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

:root {
  --color-primary:    #1a3a5c;
  --color-primary-lt: #2563a8;
  --color-accent:     #e8a020;
  --color-bg:         #f0f2f5;
  --color-surface:    #ffffff;
  --color-border:     #dde1e7;
  --color-text:       #1e293b;
  --color-muted:      #64748b;
  --color-danger:     #dc2626;
  --color-success:    #16a34a;
  --color-warning:    #d97706;
  --sidebar-w:        240px;
  --topbar-h:         56px;
  --radius:           8px;
  --shadow:           0 1px 4px rgba(0,0,0,.10);
  --font:             'Inter', system-ui, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── LOGIN ─────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
}
.login-box {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-title { font-size: 1.3rem; font-weight: 700; text-align: center; color: var(--color-primary); }
.login-sub   { font-size: .85rem; text-align: center; color: var(--color-muted); margin-bottom: 1.5rem; }

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--color-primary);
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.sidebar__brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar__brand img { width: 110px; }
.sidebar__brand-sub { font-size: .7rem; color: rgba(255,255,255,.55); margin-top: .25rem; }

.sidebar__nav { padding: 1rem 0; flex: 1; }
.sidebar__nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem 1.25rem;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: .875rem;
  transition: background .15s, color .15s;
}
.sidebar__icon {
  width: 1.1rem;
  font-size: .95rem;
  line-height: 1;
  text-align: center;
  opacity: .9;
  flex-shrink: 0;
}
.sidebar__nav a:hover,
.sidebar__nav a.ativo {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.sidebar__nav a:hover .sidebar__icon,
.sidebar__nav a.ativo .sidebar__icon {
  opacity: 1;
}
.sidebar__nav .nav-section {
  font-size: .7rem;
  font-weight: 600;
  color: rgba(255,255,255,.4);
  padding: 1rem 1.25rem .3rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sidebar__footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .8rem;
  color: rgba(255,255,255,.6);
}
.sidebar__footer > div {
  margin-bottom: .5rem;
}
.sidebar__footer a {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .35rem;
  color: rgba(255,255,255,.7);
  text-decoration: none;
}
.sidebar__footer a:hover { color: #fff; }

/* Main content */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar__title { font-weight: 600; font-size: 1rem; flex: 1; }
.topbar__user  { font-size: .8rem; color: var(--color-muted); }
.topbar__badge {
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .55rem;
  border-radius: 20px;
  background: var(--color-accent);
  color: #fff;
}
.topbar__badge--admin { background: var(--color-primary); }

/* Page content */
.page-content {
  padding: 1.75rem 1.5rem;
  max-width: 1100px;
}

/* ── CARTÕES DASHBOARD ─────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.card-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
}
.card-stat__num  { font-size: 2rem; font-weight: 700; color: var(--color-primary); }
.card-stat__lbl  { font-size: .78rem; color: var(--color-muted); margin-top: .25rem; }

/* ── ALERTAS FLASH ─────────────────────────────────────────── */
.alerta {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .875rem;
  font-weight: 500;
}
.alerta--sucesso { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alerta--erro    { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── TABELA ────────────────────────────────────────────────── */
.table-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.table-box table { width: 100%; border-collapse: collapse; }
.table-box th {
  background: #f8fafc;
  padding: .65rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--color-border);
}
.table-box td {
  padding: .7rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: .875rem;
  vertical-align: middle;
}
.table-box tr:last-child td { border-bottom: none; }
.table-box tr:hover td { background: #fafbfc; }

/* ── STATUS BADGES ─────────────────────────────────────────── */
.badge-status {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
}
.badge-status--ativo   { background: #dcfce7; color: #166534; }
.badge-status--inativo { background: #f1f5f9; color: #64748b; }
.badge-status--vencido { background: #fee2e2; color: #991b1b; }

/* ── FORMULÁRIOS ───────────────────────────────────────────── */
.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  max-width: 800px;
}
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: .35rem;
  color: var(--color-text);
}
.form-group .form-hint {
  font-size: .75rem;
  color: var(--color-muted);
  margin-top: .25rem;
}
.form-control {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: var(--font);
  font-size: .875rem;
  color: var(--color-text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary-lt);
  box-shadow: 0 0 0 3px rgba(37,99,168,.15);
}
textarea.form-control { resize: vertical; min-height: 120px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── BOTÕES ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border: none;
  border-radius: 6px;
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .88; }
.btn-primary   { background: var(--color-primary); color: #fff; }
.btn-secondary { background: #e2e8f0; color: var(--color-text); }
.btn-danger    { background: var(--color-danger); color: #fff; }
.btn-sm        { padding: .3rem .7rem; font-size: .8rem; }
.btn-block     { width: 100%; justify-content: center; margin-top: 1rem; }

/* ── PAGINAÇÃO ─────────────────────────────────────────────── */
.paginacao {
  display: flex;
  gap: .5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.paginacao a, .paginacao span {
  padding: .35rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: .82rem;
  color: var(--color-text);
  text-decoration: none;
  background: var(--color-surface);
}
.paginacao .ativo { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ── UTILITÁRIOS ───────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.page-header h2 { font-size: 1.2rem; font-weight: 700; color: var(--color-primary); }
.text-muted  { color: var(--color-muted); }
.text-danger { color: var(--color-danger); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
