/* ============================================================
   Edu Vagas — base + atmosfera educacional (minimalista)
   Tokens: UX_referencia / tailwind-config.js
   ============================================================ */

:root {
  --azul-institucional: #1b4d89;
  --azul-institucional-escuro: #0f3560;
  --azul-institucional-claro: #eaf1fb;
  --amarelo-crianca: #ffc93c;
  --amarelo-crianca-claro: #fff6df;
  --verde-aprovacao: #1b9c66;
  --vermelho-alerta: #d9483c;
  --cinza-fundo: #f3f5f9;
  --cinza-texto: #33404f;
  --cinza-texto-suave: #6b7686;
  --cinza-borda: #e1e6ee;
}

:focus-visible {
  outline: 3px solid var(--azul-institucional);
  outline-offset: 2px;
  border-radius: 6px;
}

html {
  scroll-behavior: smooth;
  /* Evita o “pulo” horizontal ao filtrar (scrollbar aparece/some) */
  scrollbar-gutter: stable;
}

body {
  font-family: Inter, sans-serif;
}

h1,
h2,
h3,
h4,
.font-display {
  font-family: Lexend, sans-serif;
}

/* ---------- Atmosfera: fundo suave + linhas de caderno bem leves ---------- */
body.ambiente-educacao {
  background-color: var(--cinza-fundo);
  background-image:
    radial-gradient(ellipse 90% 55% at 8% -5%, rgba(255, 201, 60, 0.11), transparent 55%),
    radial-gradient(ellipse 65% 45% at 100% 5%, rgba(27, 77, 137, 0.08), transparent 52%),
    radial-gradient(ellipse 45% 35% at 85% 100%, rgba(27, 156, 102, 0.05), transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, transparent 32%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 31px,
      rgba(27, 77, 137, 0.022) 31px,
      rgba(27, 77, 137, 0.022) 32px
    );
  background-attachment: scroll;
}

/* Sem margem vermelha flutuante — em monitores largos ela “cortava” o vazio. */

body.ambiente-educacao > header,
body.ambiente-educacao > main,
body.ambiente-educacao > footer,
body.ambiente-educacao > #toast-region {
  position: relative;
  z-index: 1;
}

/* Skip link: só aparece no foco (acessibilidade). Não forçar position nele. */
body.ambiente-educacao > a.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.ambiente-educacao > a.sr-only:focus,
body.ambiente-educacao > a.sr-only:focus-visible {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 50;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.5rem 1rem;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ---------- Decoração flutuante (portal) ---------- */
.atmosfera-edu {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.atmosfera-edu__item {
  position: absolute;
  opacity: 0.07;
  color: var(--azul-institucional);
}

.atmosfera-edu__item--amarelo {
  color: var(--amarelo-crianca);
  opacity: 0.11;
}

.atmosfera-edu__item--lapis {
  width: 7rem;
  height: 7rem;
  right: 4%;
  bottom: 8%;
  transform: rotate(-18deg);
}

.atmosfera-edu__item--caderno {
  width: 6.5rem;
  height: 6.5rem;
  left: 3%;
  top: 22%;
  transform: rotate(8deg);
}

.atmosfera-edu__item--estrela {
  width: 2.25rem;
  height: 2.25rem;
  right: 12%;
  top: 18%;
  opacity: 0.09;
}

@media (max-width: 767px) {
  .atmosfera-edu {
    display: none;
  }
}

@media (min-width: 768px) {
  .atmosfera-edu__item {
    opacity: 0.1;
  }
  .atmosfera-edu__item--amarelo {
    opacity: 0.14;
  }
  .atmosfera-edu__item--lapis {
    width: 9rem;
    height: 9rem;
    right: 6%;
  }
  .atmosfera-edu__item--caderno {
    width: 8rem;
    height: 8rem;
    left: 5%;
  }
}

@keyframes edu-float {
  0%,
  100% {
    transform: translateY(0) rotate(var(--edu-rot, 0deg));
  }
  50% {
    transform: translateY(-10px) rotate(var(--edu-rot, 0deg));
  }
}

.atmosfera-edu__item--lapis {
  --edu-rot: -18deg;
  animation: edu-float 9s ease-in-out infinite;
}

.atmosfera-edu__item--caderno {
  --edu-rot: 8deg;
  animation: edu-float 11s ease-in-out infinite 1.2s;
}

.atmosfera-edu__item--estrela {
  --edu-rot: 0deg;
  animation: edu-float 7s ease-in-out infinite 0.5s;
}

/* ---------- Acentos de UI ---------- */
.titulo-com-tracinho::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 4px;
  margin: 0.85rem auto 0;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--amarelo-crianca),
    rgba(27, 77, 137, 0.55)
  );
}

.titulo-com-tracinho.titulo-com-tracinho--esquerda::after {
  margin-left: 0;
  margin-right: auto;
}

.card-papel {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 4px 16px -4px rgba(27, 77, 137, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}

.header-portal {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--cinza-borda);
  box-shadow: 0 1px 0 rgba(255, 201, 60, 0.35);
}

.header-portal-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  min-height: 3.75rem;
  flex-wrap: wrap;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.header-portal-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  flex: 1 1 auto;
}

.header-portal-brand:hover {
  text-decoration: none;
}

.header-portal-logo {
  display: block;
  height: 2.5rem;
  width: auto;
  max-height: 2.5rem;
  object-fit: contain;
}

.header-portal-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.header-portal-nav__link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--cinza-texto-suave);
  text-decoration: none;
  padding: 0.45rem 0.7rem;
  border-radius: 0.65rem;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
}

.header-portal-nav__link:hover {
  color: var(--azul-institucional);
  background: var(--azul-institucional-claro);
  text-decoration: none;
}

.header-portal-nav__link.is-active {
  color: var(--azul-institucional-escuro);
  background: var(--azul-institucional-claro);
}

@media (min-width: 640px) {
  .header-portal-inner {
    min-height: 4.25rem;
    flex-wrap: nowrap;
  }
  .header-portal-logo {
    height: 2.75rem;
    max-height: 2.75rem;
  }
}

/*
  Header CMS:
  - Altura e halo brancos FIXOS — o texto da página (ficha/protocolo) não entra aqui.
  - Senão o degradê “cresce” ao navegar Filas → Ficha → Ofertas.
*/
.header-cms {
  color: #fff;
  background-color: var(--azul-institucional-escuro);
  border-bottom: 1px solid rgba(15, 53, 96, 0.35);
  box-shadow: 0 2px 10px rgba(15, 53, 96, 0.18);
}

.header-cms-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.75rem;
  height: 3.75rem;
}

.header-cms-brand {
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  max-width: calc(100% - 6.5rem);
  color: var(--azul-institucional-escuro);
  text-decoration: none;
}

.header-cms-brand:hover {
  text-decoration: none;
  color: var(--azul-institucional-escuro);
}

.header-cms-brand::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -0.55rem;
  bottom: -0.55rem;
  left: -1.15rem;
  width: 16.5rem;
  max-width: 58vw;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.55) 10%,
    #ffffff 18%,
    #ffffff 78%,
    rgba(255, 255, 255, 0.55) 90%,
    rgba(255, 255, 255, 0) 100%
  );
  pointer-events: none;
}

.header-cms-titles {
  min-width: 0;
}

.header-cms-title {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-cms-sub {
  font-size: 0.7rem;
  line-height: 1.25;
  color: rgba(15, 53, 96, 0.72);
}

.header-cms-logo {
  display: block;
  height: 2.25rem;
  width: auto;
  max-width: none;
}

.header-cms-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.header-cms-user {
  display: inline-flex;
  height: 2.25rem;
  max-width: 11rem;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0 0.7rem 0 0.45rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.header-cms-user-name {
  display: none;
  font-size: 0.75rem;
  font-weight: 600;
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .header-cms-user-name {
    display: inline;
  }
}

.header-cms-sair {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--amarelo-crianca);
  background: none;
  border: 0;
  padding: 0.35rem 0.15rem;
  min-height: 2.5rem;
  cursor: pointer;
}

.header-cms-sair:hover {
  text-decoration: underline;
}

.cms-voltar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 1.25rem;
}

.cms-voltar__link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--azul-institucional);
  text-decoration: none;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
}

.cms-voltar__link:hover {
  text-decoration: underline;
}

.cms-voltar__kicker {
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--cinza-texto-suave);
}

.cms-paginacao a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid var(--cinza-borda);
  color: var(--azul-institucional);
  font-weight: 600;
  text-decoration: none;
  background: #fff;
}

.cms-paginacao a:hover {
  background: var(--azul-institucional-claro);
}

.cms-acoes a,
.cms-acoes button {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cms-acoes-cta-mobile {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 0.75rem 1rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--cinza-borda);
  box-shadow: 0 -10px 28px -12px rgba(27, 77, 137, 0.2);
}

.cms-confirm-acoes {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
}

.cms-confirm-acoes form,
.cms-confirm-acoes button {
  width: 100%;
}

.cms-confirm-acoes button {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 640px) {
  .cms-confirm-acoes {
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
  }

  .cms-confirm-acoes form,
  .cms-confirm-acoes button {
    width: auto;
  }
}

@media (min-width: 640px) {
  .header-cms-inner {
    min-height: 4.25rem;
    height: 4.25rem;
  }
  .header-cms-logo {
    height: 2.75rem;
  }
  .header-cms-title {
    font-size: 1.125rem;
  }
  .header-cms-sub {
    font-size: 0.75rem;
  }
  .header-cms-brand::before {
    width: 20.5rem;
  }
}

input[type="file"],
select[multiple] {
  max-width: 100%;
}

/* Badges de status CMS — cores semânticas (tokens do design system) */
.badge-status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.badge-status--aguardando {
  background: var(--azul-institucional-claro);
  color: var(--azul-institucional);
}

.badge-status--convocado {
  background: var(--amarelo-crianca-claro);
  color: #8a5a00;
}

.badge-status--matriculado {
  background: #e6f7ef;
  color: #146f49;
}

.badge-status--pendente_documentacao {
  background: #fff3e6;
  color: #9a4d00;
}

.badge-status--desistiu {
  background: #eef1f5;
  color: #5c6775;
}

.badge-status--cancelado {
  background: #fceae8;
  color: #b3342a;
}

/* Fila CMS: colunas estáveis ao trocar filtro (sem “dançar” o card) */
.cms-fila-table {
  table-layout: fixed;
  width: 100%;
}

.cms-fila-table th:nth-child(1),
.cms-fila-table td:nth-child(1) {
  width: 8.5rem;
}

.cms-fila-table th:nth-child(3),
.cms-fila-table td:nth-child(3) {
  width: 10.5rem;
}

.cms-fila-table th:nth-child(4),
.cms-fila-table td:nth-child(4) {
  width: 6rem;
  text-align: center;
}

.cms-fila-table th:nth-child(5),
.cms-fila-table td:nth-child(5) {
  width: 9.5rem;
}

.cms-fila-table th:nth-child(6),
.cms-fila-table td:nth-child(6) {
  width: 9rem;
}

.cms-fila-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cms-fila-table td:nth-child(3),
.cms-fila-table td:nth-child(4) {
  overflow: visible;
  text-overflow: unset;
}

.cms-fila-table td:nth-child(4) {
  font-variant-numeric: tabular-nums;
}

.cms-fila-table td:nth-child(5) {
  white-space: normal;
  overflow: visible;
}

.cms-fila-table td:nth-child(6) {
  white-space: nowrap;
  overflow: visible;
}

.cms-fila-table td:nth-child(6) a {
  white-space: nowrap;
  display: inline-block;
}

/* Etapa: bolinha colorida (diferencia sem competir com badge de status) */
.pill-etapa {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--cinza-texto, #33404f);
  font-size: inherit;
  line-height: 1.25;
}

.pill-etapa__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

.pill-etapa--creche .pill-etapa__dot {
  background: var(--vermelho-alerta);
}

.pill-etapa--pre_escola .pill-etapa__dot {
  background: var(--azul-institucional);
}

.pill-etapa--ensino_fundamental .pill-etapa__dot {
  background: var(--verde-aprovacao);
}

/* Toolbar filtros CMS — mesma altura em input/select/botões */
.cms-filtro-ctrl {
  height: 2.75rem;
  box-sizing: border-box;
}

/* Entrada suave do conteúdo (portal) */
@keyframes edu-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.portal-rise > * {
  animation: edu-rise 0.55s ease-out both;
}

.portal-rise > *:nth-child(2) {
  animation-delay: 0.06s;
}
.portal-rise > *:nth-child(3) {
  animation-delay: 0.12s;
}
.portal-rise > *:nth-child(4) {
  animation-delay: 0.18s;
}
.portal-rise > *:nth-child(5) {
  animation-delay: 0.24s;
}
.portal-rise > *:nth-child(6) {
  animation-delay: 0.28s;
}
.portal-rise > *:nth-child(7) {
  animation-delay: 0.32s;
}
.portal-rise > *:nth-child(8) {
  animation-delay: 0.36s;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  body.ambiente-educacao {
    background-attachment: scroll;
  }
}

/* HTMX loading indicator opcional */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-flex;
}

/* ---------- Ticket / canhoto (portal) ---------- */
.ticket-protocolo {
  isolation: isolate;
}

.ticket-furo {
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: var(--cinza-fundo);
  z-index: 2;
  box-shadow: 0 0 0 1px rgba(225, 230, 238, 0.9);
}

/* Mobile: furos na divisão horizontal */
.ticket-furo--topo {
  top: -0.625rem;
  left: 50%;
  transform: translateX(-50%);
}

.ticket-furo--base {
  bottom: -0.625rem;
  left: 50%;
  transform: translateX(-50%);
}

@media (min-width: 640px) {
  .ticket-furo--topo {
    top: 50%;
    left: -0.625rem;
    transform: translateY(-50%);
  }

  .ticket-furo--base {
    top: auto;
    bottom: 50%;
    left: -0.625rem;
    transform: translateY(50%);
  }
}

/* Manual institucional (/manual/) */
.manual-layout {
  display: grid;
  gap: 2rem;
}

.manual-indice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.manual-indice a {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--azul-institucional);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--cinza-borda);
  background: #fff;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
}

.manual-indice a:hover {
  background: var(--azul-institucional-claro);
  text-decoration: none;
}

.manual-xlsx {
  border: 1px solid var(--cinza-borda);
  border-radius: 0.9rem;
  overflow: hidden;
  background: #fff;
}

.manual-xlsx__abas {
  display: flex;
  gap: 0;
  background: #e8edf4;
  padding: 0.35rem 0.35rem 0;
}

.manual-xlsx__abas span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cinza-texto-suave);
  padding: 0.45rem 0.9rem;
  border-radius: 0.5rem 0.5rem 0 0;
}

.manual-xlsx__abas span.is-on {
  background: #fff;
  color: var(--azul-institucional-escuro);
}

.manual-xlsx__folha {
  padding: 1.25rem 1.35rem 1.4rem;
  min-height: 8.5rem;
  background:
    linear-gradient(#fff, #fff),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 1.5rem,
      rgba(27, 77, 137, 0.04) 1.5rem,
      rgba(27, 77, 137, 0.04) 1.55rem
    );
}

@media (min-width: 1024px) {
  .manual-layout {
    grid-template-columns: 13.5rem minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
  }
  .manual-indice {
    position: sticky;
    top: 5.25rem;
    flex-direction: column;
    flex-wrap: nowrap;
  }
}

