/* ========================================
   PORTAL DE REGULACAO - CSS COMPLEMENTAR
   Complementa o Design System CIEGES
   ======================================== */

/* ========================================
   SKIP TO CONTENT (WCAG AAA)
   ======================================== */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 9999;
  padding: 1rem 2rem;
  background: var(--primary-blue);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 var(--border-radius-md) 0;
  transition: top 0.3s ease;
}

.skip-to-content:focus {
  top: 0;
  color: #fff;
  outline: 3px solid var(--secondary-yellow);
  outline-offset: 2px;
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero-section {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 60%, #000d1f 100%);
  position: relative;
  overflow: hidden;
  min-height: 60vh;
  display: flex;
  align-items: center;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(3, 115, 205, 0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(0, 183, 94, 0.15) 0%, transparent 50%);
  z-index: 1;
}

.hero-title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 2.75rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
  font-size: 1.15rem;
  opacity: 0.92;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.hero-search-card {
  border: none;
  border-radius: var(--border-radius-xl);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.min-vh-50 {
  min-height: 50vh;
}

/* ========================================
   KPI CARDS
   ======================================== */
.kpi-card {
  background: #fff;
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--spacing-xl);
  text-align: center;
  border: 1px solid var(--gray-200);
  transition: all 0.3s ease;
  height: 100%;
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-blue-light);
}

.kpi-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--border-radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.4rem;
  margin-bottom: var(--spacing-md);
}

/* ========================================
   ACENTOS DOS ÍCONES DE KPI E DE CARD
   ========================================
   Substituem os gradientes escritos à mão no `style=` dos templates, que vinham
   da paleta do Bootstrap (#0d6efd, #198754, #6f42c1, #d63384, #fd7e14) e não da
   paleta institucional — o roxo/rosa não existe em lugar nenhum do portal.

   Nomes próprios de propósito: o design system do observatório também tem
   `.kpi-icon.primary/.success/.warning/.danger`, mas lá o tratamento é círculo
   com fundo tingido a 10% e glifo colorido. Aqui o `.kpi-icon` é quadrado com
   gradiente sólido e glifo BRANCO (portal.css vence a base) — reaproveitar
   aqueles nomes daria glifo branco sobre fundo quase branco.

   Os glifos são decorativos (`aria-hidden="true"`); quem carrega o significado
   é o valor e o rótulo do card. */
.icon-gradient-blue {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-light) 100%);
}

.icon-gradient-green {
  background: linear-gradient(135deg, var(--secondary-green) 0%, var(--secondary-green-light) 100%);
}

.icon-gradient-amber {
  background: linear-gradient(135deg, var(--secondary-orange) 0%, var(--warning) 100%);
}

.icon-gradient-cyan {
  background: linear-gradient(135deg, var(--primary-blue-light) 0%, var(--info) 100%);
}

.icon-gradient-red {
  background: linear-gradient(135deg, var(--error) 0%, var(--secondary-orange) 100%);
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.kpi-label {
  font-family: var(--font-primary);
  font-size: 0.875rem;
  color: var(--gray-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========================================
   STEP CARDS (How It Works)
   ======================================== */
.step-card {
  padding: var(--spacing-xl);
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-light) 100%);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 900;
  box-shadow: 0 4px 15px rgba(2, 62, 136, 0.3);
}

/* ========================================
   CHART CARDS
   ======================================== */
.chart-card {
  padding: var(--spacing-xl);
}

.chart-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--gray-100);
}

.chart-container {
  position: relative;
  height: 320px;
  width: 100%;
}

.chart-container-tall {
  height: 450px;
}

/* ========================================
   FLUXO DA FILA
   ======================================== */
.fluxo-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
}

.fluxo-risco-table {
  font-size: 0.8rem;
}

.fluxo-risco-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 0.25rem 0.4rem;
  border: none;
}

.fluxo-risco-table td {
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
}

.badge-sm {
  font-size: 0.65rem;
  padding: 0.2em 0.5em;
}

@media (max-width: 575.98px) {
  .fluxo-value {
    font-size: 1.15rem;
  }
}

/* ========================================
   SEARCH RESULTS
   ======================================== */
.patient-card {
  border-left: 4px solid var(--primary-blue);
  height: auto !important;
  display: block !important;
  flex: none !important;
}

.posicao-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-light) 100%);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  font-family: var(--font-heading);
  box-shadow: 0 2px 8px rgba(2, 62, 136, 0.3);
  padding: 0 0.5rem;
}

.resultado-card {
  border-left: 3px solid var(--primary-blue-light);
  transition: all 0.3s ease;
  height: auto !important;
  padding: 1.25rem !important;
  display: block !important;
  flex: none !important;
}

.resultado-card:hover {
  border-left-color: var(--primary-blue);
  transform: translateY(-2px);
}

/* ========================================
   RISK BADGE COLORS
   ========================================
   Três destas quatro regras apenas repetiam o valor padrão do Bootstrap, ou
   seja, não pintavam nada: por isso as tarjas de risco saíam com a cor do
   framework e não com a do portal. Agora apontam para os tokens da paleta, o
   que também melhora o contraste:
     bg-primary  #0d6efd -> --primary-blue  (branco sobre o fundo: 4,50 -> 10,26)
     bg-warning  #fd7e14 -> --warning       (texto escuro:         6,18 ->  7,40)
     bg-info     #0dcaf0 -> --info          (texto escuro:         8,11 ->  6,54) */
.badge.bg-warning {
  background-color: var(--warning) !important;
}

.badge.bg-info {
  background-color: var(--info) !important;
}

.badge.bg-primary {
  background-color: var(--primary-blue) !important;
}

/* A tarja "Emergência" fica fora da tokenização de propósito. O único vermelho
   da paleta é `--error` (#ef4444) e ele é claro demais: com o texto branco do
   `.badge` cai para 3,77:1 e reprova no AA. O #dc3545 abaixo dá 4,53:1. Trocar
   por token aqui seria regressão de acessibilidade — resolver isso pede um
   vermelho escuro na paleta, o que é decisão de design system, não de ajuste. */
.badge.bg-danger {
  background-color: #dc3545 !important;
}

/* ========================================
   TABLE STYLES
   ======================================== */
.table thead th {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
  padding: 0.875rem 0.75rem;
}

.table tbody td {
  padding: 0.875rem 0.75rem;
  vertical-align: middle;
  font-size: 0.9rem;
}

.table-hover tbody tr:hover {
  background-color: rgba(2, 62, 136, 0.04);
}

/* ========================================
   FORM ENHANCEMENTS
   ======================================== */
.form-control:focus {
  border-color: var(--primary-blue-light);
  box-shadow: 0 0 0 0.2rem rgba(3, 115, 205, 0.25);
}

.form-control-lg {
  font-size: 1.1rem;
  padding: 0.875rem 1.25rem;
  border-radius: var(--border-radius-md);
}

/* ========================================
   COR DE ÍCONE DE CABEÇALHO DE CARD
   ========================================
   Era `.text-purple { color: #6f42c1 }` — roxo do Bootstrap, cor que não existe
   em nenhum outro lugar do portal, usada num ícone só. */
.text-gov-blue {
  color: var(--primary-blue);
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 991.98px) {
  .hero-title {
    font-size: 2.25rem;
  }

  .kpi-value {
    font-size: 2rem;
  }

  .chart-container {
    height: 280px;
  }

  .chart-container-tall {
    height: 380px;
  }
}

@media (max-width: 767.98px) {
  .hero-section {
    min-height: auto;
    padding: 2rem 0;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .kpi-value {
    font-size: 1.75rem;
  }

  .kpi-label {
    font-size: 0.75rem;
  }

  .chart-container {
    height: 260px;
  }

  .chart-container-tall {
    height: 350px;
  }
}

@media (max-width: 575.98px) {
  .hero-title {
    font-size: 1.5rem;
  }

  .kpi-card {
    padding: var(--spacing-lg);
  }

  .kpi-value {
    font-size: 1.5rem;
  }

  .posicao-badge {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
  .top_bar,
  .main-navigation,
  .breadcrumb-modern-section,
  .hero-section,
  .modern-footer,
  .skip-to-content,
  .btn-modern,
  form {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 10pt;
  }

  .card-modern,
  .kpi-card,
  .chart-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .kpi-value {
    color: #000 !important;
  }

  .chart-container {
    height: auto !important;
    min-height: 200px;
  }

  .page-header-section {
    background: #023E88 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  section {
    padding: 1rem 0 !important;
  }

  .container {
    max-width: 100% !important;
  }

  a[href]:after {
    content: none !important;
  }
}
