/* ==========================================================================
   INSTITUTO PRODIGIUM — Área Administrativa Interna
   Design System Corporativo: Azul Petróleo (#002B36) e Ouro Prodigium (#C5A059)
   ========================================================================== */

:root {
  --navy: #002B36;
  --navy-dark: #001f27;
  --navy-light: #0b3d4a;
  --gold: #C5A059;
  --gold-light: #d4b478;
  --gold-dark: #a8874a;
  --bg: #F8F9FA;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --text: #1a2332;
  --text-muted: #5a6476;
  --success: #16a34a;
  --warning: #ca8a04;
  --danger: #dc2626;
  --info: #0284c7;
  --radius: 10px;
  --shadow: 0 4px 20px -2px rgba(0, 43, 54, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(0, 43, 54, 0.12);
}

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

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- TELA DE LOGIN ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
  padding: 20px;
}

.login-card {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 40px 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.login-logo {
  max-width: 220px;
  height: auto;
  margin-bottom: 24px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.form-group {
  text-align: left;
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-color: #fff;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.2);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper .form-control {
  padding-right: 44px;
}

.btn-toggle-password {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

.btn-toggle-password:hover {
  color: var(--navy);
}

.btn-toggle-password svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.btn-primary {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  margin-top: 10px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(197, 160, 89, 0.4);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-alert {
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 18px;
  display: none;
}

.login-alert.show {
  display: block;
}

.login-alert.error {
  background-color: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.login-backlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 6px 10px;
  border-radius: 6px;
}

.login-backlink:hover {
  color: var(--gold-dark);
  background-color: rgba(197, 160, 89, 0.08);
}

/* ---------- ESTRUTURA DO PAINEL ---------- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--navy);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.sidebar-logo {
  height: 34px;
  width: auto;
  filter: brightness(0) invert(1);
}

.sidebar-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 8px;
  background: rgba(197, 160, 89, 0.2);
  color: var(--gold-light);
  border-radius: 4px;
  font-weight: 700;
}

.sidebar-nav {
  padding: 20px 12px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-link.active {
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #fff;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.user-role {
  font-size: 11px;
  color: var(--gold-light);
}

.btn-logout {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.2s;
}

.btn-logout:hover {
  color: #ef4444;
}

/* Área de Conteúdo */
.content-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}

.main-content {
  padding: 32px;
  flex-grow: 1;
}

/* Cards de Estatísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  margin-top: 4px;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 43, 54, 0.05);
  color: var(--navy);
}

.stat-icon.gold {
  background: rgba(197, 160, 89, 0.15);
  color: var(--gold-dark);
}

.stat-icon.green {
  background: rgba(22, 163, 74, 0.15);
  color: var(--success);
}

/* Barra de Filtros e Busca */
.filters-bar {
  background: #fff;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  width: 100%;
  max-width: 340px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 13.5px;
  margin-left: 8px;
  font-family: inherit;
}

.filter-select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}

/* Tabelas */
.table-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.data-table th {
  background: #f1f5f9;
  color: var(--navy);
  font-weight: 700;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: #f8fafc;
}

/* Badges de Status */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.badge-pendente {
  background: #fef3c7;
  color: #92400e;
}

.badge-emanalise {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-homologado {
  background: #dcfce7;
  color: #15803d;
}

.badge-reprovado {
  background: #fee2e2;
  color: #b91c1c;
}

/* Botões de Ação */
.btn-action {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-action:hover {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.btn-action.gold {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}

.btn-action.gold:hover {
  background: var(--gold-dark);
}

/* Modal de Detalhes */
.admin-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 43, 54, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.admin-modal.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 850px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

.detail-section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-item span.label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.detail-item span.value {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  margin-top: 2px;
}

.detail-item.span-full {
  grid-column: 1 / -1;
}

/* Cards de Anexos no Modal */
.anexos-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.anexo-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  gap: 12px;
}

.anexo-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.anexo-tipo {
  font-size: 11px;
  font-weight: 700;
  color: var(--navy);
}

.anexo-nome {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.anexo-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.anexo-download-btn {
  padding: 6px 10px;
  background: var(--navy);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.anexo-download-btn:hover {
  background: var(--gold-dark);
}

.anexo-delete-btn {
  padding: 6px 10px;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.anexo-delete-btn:hover {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

/* Caixa de Novo Anexo */
.new-anexo-box {
  margin-top: 16px;
  padding: 16px 20px;
  background: #fdfaf3;
  border: 1.5px dashed var(--gold);
  border-radius: 10px;
}

.new-anexo-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.new-anexo-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.new-anexo-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 180px;
}

.new-anexo-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
}

.new-anexo-field .form-control {
  padding: 8px 10px;
  font-size: 13px;
}

/* Abas de Modo no Modal (Visualizar / Editar) */
.modal-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 10px;
}

.modal-tab-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #f1f5f9;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.modal-tab-btn:hover {
  background: #e2e8f0;
  color: var(--navy);
}

.modal-tab-btn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

/* Formulário de Edição no Modal */
.edit-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
}

.edit-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.edit-form-group.span-full {
  grid-column: 1 / -1;
}

.edit-form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
}

.edit-form-group .form-control {
  padding: 9px 12px;
  font-size: 13px;
}

.form-check-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Toast de Alerta */
.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  z-index: 10000;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.admin-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.admin-toast.success {
  background-color: var(--success);
}

.admin-toast.error {
  background-color: var(--danger);
}

