/**
 * CPA — Comissão Própria de Avaliação
 * css/relatorios.css — Estilos da tela de Relatórios
 */

/* ══════════════════════════════════════════════════════════
   ANIMAÇÕES
══════════════════════════════════════════════════════════ */
@keyframes rel-fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes rel-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.08); opacity: .7; }
}

/* ══════════════════════════════════════════════════════════
   CABEÇALHO DA PÁGINA
══════════════════════════════════════════════════════════ */
.rel-header-icon {
  background: linear-gradient(135deg, #f0e6ff, #ddd6fe) !important;
  color: #6d28d9 !important;
}

/* ══════════════════════════════════════════════════════════
   SEÇÕES / PAINÉIS GERAIS
══════════════════════════════════════════════════════════ */
.rel-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 22px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  animation: rel-fadeUp .3s ease;
}

.rel-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
  flex-wrap: wrap;
  gap: 10px;
}

.rel-section-title {
  font-size: .95rem;
  font-weight: 700;
  color: #1c5c2f;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rel-section-body {
  padding: 20px;
}

/* ══════════════════════════════════════════════════════════
   FILTROS
══════════════════════════════════════════════════════════ */
.rel-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.rel-filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rel-filter-label {
  font-size: .78rem;
  font-weight: 700;
  color: #374151;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.rel-filter-input,
.rel-filter-select {
  padding: 8px 12px;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  font-size: .855rem;
  color: #1f2937;
  background: #fff;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}

.rel-filter-input:focus,
.rel-filter-select:focus {
  outline: none;
  border-color: #6d28d9;
  box-shadow: 0 0 0 3px rgba(109,40,217,.1);
}

/* Multi-select personalizado */
.rel-multi-select {
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  max-height: 120px;
  overflow-y: auto;
  padding: 4px;
  background: #fff;
  transition: border-color .2s;
}
.rel-multi-select:focus-within {
  border-color: #6d28d9;
}

.rel-multi-select label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 7px;
  border-radius: 4px;
  font-size: .835rem;
  color: #374151;
  cursor: pointer;
  transition: background .15s;
}
.rel-multi-select label:hover {
  background: #f5f3ff;
}
.rel-multi-select input[type="checkbox"] {
  accent-color: #6d28d9;
  width: 14px;
  height: 14px;
}

/* Botões de ação dos filtros */
.rel-filter-actions {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding-top: 4px;
}

/* ══════════════════════════════════════════════════════════
   BOTÕES
══════════════════════════════════════════════════════════ */
.rel-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: .865rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  font-family: inherit;
  white-space: nowrap;
}
.rel-btn:disabled { opacity: .5; cursor: not-allowed; }

.rel-btn--primary {
  background: linear-gradient(135deg, #5b21b6, #7c3aed);
  color: #fff;
}
.rel-btn--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #4c1d95, #6d28d9);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(109,40,217,.3);
}

.rel-btn--secondary {
  background: #f8fafc;
  color: #475569;
  border: 1.5px solid #e2e8f0;
}
.rel-btn--secondary:hover:not(:disabled) {
  background: #f1f5f9;
}

.rel-btn--green {
  background: #dcfce7;
  color: #166534;
  border: 1.5px solid #86efac;
}
.rel-btn--green:hover:not(:disabled) {
  background: #bbf7d0;
}

.rel-btn--blue {
  background: #dbeafe;
  color: #1e40af;
  border: 1.5px solid #93c5fd;
}
.rel-btn--blue:hover:not(:disabled) {
  background: #bfdbfe;
}

.rel-btn--orange {
  background: #fff7ed;
  color: #9a3412;
  border: 1.5px solid #fed7aa;
}
.rel-btn--orange:hover:not(:disabled) {
  background: #ffedd5;
}

.rel-btn--red {
  background: #fee2e2;
  color: #991b1b;
  border: 1.5px solid #fecaca;
}
.rel-btn--red:hover:not(:disabled) {
  background: #fecaca;
}

.rel-btn--sm {
  padding: 6px 12px;
  font-size: .8rem;
}

/* ══════════════════════════════════════════════════════════
   CARDS KPI (RESUMO GERAL)
══════════════════════════════════════════════════════════ */
.rel-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.rel-kpi-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  animation: rel-fadeUp .35s ease;
  transition: transform .2s, box-shadow .2s;
}
.rel-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.rel-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.rel-kpi-icon--green  { background: #dcfce7; color: #166534; }
.rel-kpi-icon--blue   { background: #dbeafe; color: #1e40af; }
.rel-kpi-icon--orange { background: #fff7ed; color: #9a3412; }
.rel-kpi-icon--red    { background: #fee2e2; color: #991b1b; }
.rel-kpi-icon--purple { background: #f5f3ff; color: #6d28d9; }

.rel-kpi-body {}
.rel-kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: #1f2937;
  line-height: 1.1;
}
.rel-kpi-label {
  font-size: .78rem;
  color: #6b7280;
  font-weight: 500;
  margin-top: 3px;
}

/* ══════════════════════════════════════════════════════════
   RESULTADO VAZIO / PLACEHOLDER
══════════════════════════════════════════════════════════ */
.rel-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #9ca3af;
}

.rel-empty-state i {
  font-size: 3rem;
  display: block;
  margin-bottom: 14px;
  opacity: .35;
}

.rel-empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #6b7280;
  margin: 0 0 8px;
}

.rel-empty-state p {
  font-size: .875rem;
  margin: 0;
}

/* ══════════════════════════════════════════════════════════
   TABELAS DE RESULTADO
══════════════════════════════════════════════════════════ */
.rel-table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.rel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .855rem;
  color: #374151;
}

.rel-table thead {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

.rel-table thead th {
  padding: 10px 14px;
  font-weight: 700;
  font-size: .78rem;
  text-align: left;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

.rel-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background .15s;
}
.rel-table tbody tr:last-child { border-bottom: none; }
.rel-table tbody tr:hover { background: #fafbff; }

.rel-table td {
  padding: 10px 14px;
  vertical-align: middle;
}

/* Barras de percentual */
.rel-pct-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.rel-pct-bar-track {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.rel-pct-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .5s ease;
}
.rel-pct-bar-fill--green  { background: #4caf6e; }
.rel-pct-bar-fill--yellow { background: #f59e0b; }
.rel-pct-bar-fill--red    { background: #ef4444; }

.rel-pct-text {
  font-weight: 700;
  font-size: .82rem;
  min-width: 38px;
  text-align: right;
}

/* Badges de classificação */
.rel-class-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
}
.rel-class-badge--excelente { background: #dcfce7; color: #166534; }
.rel-class-badge--bom       { background: #dbeafe; color: #1e40af; }
.rel-class-badge--satisfatorio { background: #fef9c3; color: #854d0e; }
.rel-class-badge--regular   { background: #fff7ed; color: #9a3412; }
.rel-class-badge--critico   { background: #fee2e2; color: #991b1b; }

/* ══════════════════════════════════════════════════════════
   ÁREA DE EXPORTAÇÃO
══════════════════════════════════════════════════════════ */
.rel-export-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: #f5f3ff;
  border-top: 1px solid #ddd6fe;
  flex-wrap: wrap;
}

.rel-export-label {
  font-size: .82rem;
  font-weight: 700;
  color: #6d28d9;
  margin-right: 4px;
}

/* ══════════════════════════════════════════════════════════
   HISTÓRICO DE RELATÓRIOS GERADOS
══════════════════════════════════════════════════════════ */
.rel-hist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .845rem;
}

.rel-hist-table thead th {
  padding: 10px 14px;
  background: #f8fafc;
  font-size: .76rem;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid #e2e8f0;
  text-align: left;
}

.rel-hist-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background .15s;
}
.rel-hist-table tbody tr:hover { background: #fafbff; }
.rel-hist-table tbody tr:last-child { border-bottom: none; }

.rel-hist-table td {
  padding: 10px 14px;
  vertical-align: middle;
}

.rel-hist-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}

/* ══════════════════════════════════════════════════════════
   GRÁFICOS INLINE
══════════════════════════════════════════════════════════ */
.rel-chart-container {
  position: relative;
  height: 280px;
}

.rel-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 22px;
}

.rel-chart-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.rel-chart-card-title {
  font-size: .875rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ══════════════════════════════════════════════════════════
   BADGE TIPO QUESTIONÁRIO
══════════════════════════════════════════════════════════ */
.rel-tipo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: .75rem;
  font-weight: 600;
}
.rel-tipo-badge--inst   { background: #dbeafe; color: #1e40af; }
.rel-tipo-badge--curso  { background: #f5f3ff; color: #6d28d9; }

/* ══════════════════════════════════════════════════════════
   ALERTA / INFORMAÇÃO
══════════════════════════════════════════════════════════ */
.rel-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: .855rem;
  margin-bottom: 20px;
  animation: rel-fadeUp .3s ease;
}
.rel-alert i { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.rel-alert--info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.rel-alert--success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.rel-alert--warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ══════════════════════════════════════════════════════════
   LOADING SPINNER
══════════════════════════════════════════════════════════ */
.rel-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: #6b7280;
  font-size: .9rem;
}
.rel-loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e5e7eb;
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: rel-spin 0.7s linear infinite;
}
@keyframes rel-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════ */
.rel-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVIDADE
══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .rel-filters-grid {
    grid-template-columns: 1fr 1fr;
  }
  .rel-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .rel-charts-grid {
    grid-template-columns: 1fr;
  }
  .rel-export-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .rel-filter-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .rel-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .rel-filters-grid {
    grid-template-columns: 1fr;
  }
  .rel-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .rel-kpi-value {
    font-size: 1.3rem;
  }
}
