/* =============================================================
   BreveIA — edital-detail.css
   Estilos da página /edital/{id}.
   ============================================================= */

.edital-detail {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-6) var(--sp-16);
}

/* ---------- BREADCRUMB ---------- */
.edital-detail__breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  font-size: 13px;
  color: var(--texto-secundario);
}
.edital-detail__breadcrumb a {
  color: var(--texto-secundario);
  text-decoration: none;
  transition: color var(--transition);
}
.edital-detail__breadcrumb a:hover { color: var(--azul); }
.edital-detail__breadcrumb-sep {
  color: var(--borda);
}

/* ---------- HEADER ---------- */
.edital-detail__head {
  background: linear-gradient(135deg, var(--superficie) 0%, var(--azul-fundo) 100%);
  border: 1px solid var(--borda-leve);
  border-radius: var(--r-xl);
  padding: var(--sp-6) var(--sp-6);
  margin-bottom: var(--sp-6);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-6);
  align-items: start;
}

.edital-detail__title-area {
  min-width: 0;
}

.edital-detail__type-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: var(--azul);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-3);
}

.edital-detail__title {
  font-size: clamp(1.375rem, 3vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--azul);
  margin: 0 0 var(--sp-2);
  line-height: 1.25;
  /* Limita a 3 linhas — texto completo fica no card "RESUMO BREVEIA". */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.ia-progress {
  border: 1px solid var(--borda-leve);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  background: linear-gradient(135deg, var(--superficie) 0%, var(--azul-fundo) 100%);
}

.ia-progress__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  color: var(--azul);
  font-weight: 800;
  margin-bottom: var(--sp-3);
}

.ia-progress__bar {
  height: 10px;
  border-radius: 999px;
  background: var(--borda-leve);
  overflow: hidden;
  margin-bottom: var(--sp-3);
}

.ia-progress__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--dourado), var(--azul));
  transition: width 350ms ease;
}

.ia-progress__message {
  margin: 0 0 var(--sp-3);
  color: var(--texto-secundario);
  font-size: 14px;
}

.ia-progress__steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  color: var(--texto-secundario);
  font-size: 13px;
}

.ia-progress__steps li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ia-progress__steps li.is-done {
  color: var(--verde-escuro);
  font-weight: 700;
}

.ia-progress__steps li.is-current {
  color: var(--azul);
  font-weight: 800;
}

.ia-progress--error {
  background: var(--vermelho-fundo);
  border-color: rgba(185, 28, 28, 0.2);
  color: var(--vermelho);
}

.edital-detail__org {
  font-size: 14px;
  color: var(--texto-secundario);
  margin-bottom: var(--sp-4);
}

.edital-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* ---------- SCORE GRANDE ---------- */
.edital-detail__score-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

.score-big {
  --score-thickness: 9px;
  width: 120px;
  height: 120px;
  position: relative;
  /* IMPORTANTE: --score-value chega já com unidade % do inline style.
     Ver nota em components.css .score-badge. */
  background: conic-gradient(var(--score-color, var(--verde)) var(--score-value, 0%), var(--borda-leve) 0);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.score-big::before {
  content: '';
  position: absolute;
  inset: var(--score-thickness);
  background: var(--superficie);
  border-radius: 50%;
}
.score-big__value {
  position: relative;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--texto);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score-big__suffix {
  position: relative;
  font-size: 14px;
  color: var(--texto-secundario);
  font-weight: 500;
  font-family: var(--font-mono);
  margin-top: 4px;
}
.score-big--green   { --score-color: var(--verde); }
.score-big--orange  { --score-color: var(--laranja); }
.score-big--red     { --score-color: var(--vermelho); }
.score-big--neutral { --score-color: var(--borda-leve); }
.score-big--neutral .score-big__value { color: var(--texto-secundario); }

.score-big-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.score-big-label--green   { color: var(--verde-escuro); }
.score-big-label--orange  { color: var(--laranja-escuro); }
.score-big-label--red     { color: var(--vermelho-escuro); }
.score-big-label--neutral { color: var(--texto-secundario); font-weight: 600; }

.score-big--locked .score-big__value { font-size: 42px; }

/* Score grande com ícone SVG (estrela). Mantém renderização idêntica
   em Firefox/Chrome/Safari independente de font-variant-emoji. */
.score-big__value--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  color: var(--dourado);
}
.score-big__value--icon svg {
  display: block;
  width: 42px;
  height: 42px;
}
.score-big-locked-hint {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--texto-secundario);
  text-align: center;
  margin-top: 4px;
  letter-spacing: 0.05em;
}

/* ---------- AÇÕES (BARRA SUPERIOR) ---------- */
.edital-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--borda-leve);
}

.edital-detail__actions .btn--icon-only {
  width: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edital-detail__actions .btn-bookmark.is-salvo {
  background: var(--dourado-fundo);
  color: var(--dourado);
  border-color: var(--dourado);
}

/* ---------- LAYOUT EM GRID ---------- */
.edital-detail__grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--sp-5);
}

.edital-detail__col-main {
  min-width: 0;
}

.edital-detail__col-side {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* ---------- CARDS DE CONTEÚDO ---------- */
.detail-card {
  background: var(--superficie);
  border: 1px solid var(--borda-leve);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}

.detail-card--accent {
  background: linear-gradient(135deg, #FFFCF0 0%, #fff 50%);
  border-color: var(--dourado);
  border-width: 1.5px;
}

.detail-card__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.detail-card__head-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--azul-claro);
}
.detail-card--accent .detail-card__head-icon { color: var(--dourado); }

.detail-card__title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--texto-secundario);
  margin: 0;
  font-weight: 600;
}
.detail-card--accent .detail-card__title { color: var(--dourado); }

.detail-card__body {
  font-size: 15px;
  color: var(--texto);
  line-height: 1.6;
}

.detail-card__body strong {
  color: var(--azul);
  font-weight: 700;
}

/* Resumo BreveIA: texto longo / parágrafos (nl2br) */
.detail-card__resumo-breveia {
  margin: 0;
  max-width: 72ch;
}

/* ---------- LISTA (RISCOS / OPORTUNIDADES) ---------- */
.detail-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.detail-list li {
  display: flex;
  gap: var(--sp-3);
  font-size: 14px;
  color: var(--texto);
  line-height: 1.5;
}

.detail-list--good li::before,
.detail-list--bad  li::before,
.detail-list--neutral li::before {
  content: '';
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 12px;
}
.detail-list--good li::before {
  background-color: var(--verde-claro);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23166534' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/></svg>");
}
.detail-list--bad li::before {
  background-color: var(--vermelho-claro);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23991B1B' d='M12 2L1 21h22L12 2zm0 6l7.53 13H4.47L12 8zm-1 4v4h2v-4h-2zm0 6v2h2v-2h-2z'/></svg>");
}
.detail-list--neutral li::before {
  background-color: var(--azul-fundo);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='3' fill='%230F2A44'/></svg>");
}

/* ---------- ANÁLISE POR CRITÉRIO ---------- */
.criterios-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.criterio {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-3);
  align-items: center;
}
.criterio__label {
  grid-column: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--texto);
}
.criterio__value {
  grid-column: 2;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--texto);
  letter-spacing: -0.01em;
}
.criterio__bar-track {
  grid-column: 1 / -1;
  height: 8px;
  background: var(--borda-leve);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.criterio__bar-fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}
.criterio__bar-fill--green   { background: linear-gradient(90deg, var(--verde-claro), var(--verde)); }
.criterio__bar-fill--orange  { background: linear-gradient(90deg, var(--dourado), var(--laranja)); }
.criterio__bar-fill--red     { background: linear-gradient(90deg, var(--laranja), var(--vermelho)); }

/* ---------- BLOCO PROC LOCKED (PARA GRATUITO) ---------- */
.locked-section {
  position: relative;
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  text-align: center;
  margin-bottom: var(--sp-4);
  overflow: hidden;
}

.locked-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 10px,
      rgba(15,42,68,0.02) 10px,
      rgba(15,42,68,0.02) 20px
    );
  pointer-events: none;
}

.locked-section__icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--dourado-fundo);
  color: var(--dourado);
  margin-bottom: var(--sp-3);
}

.locked-section__title {
  position: relative;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--sp-2);
  color: var(--azul);
}

.locked-section__lead {
  position: relative;
  font-size: 13px;
  color: var(--texto-secundario);
  margin-bottom: var(--sp-4);
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* ---------- KEY-VALUE LIST (SIDEBAR) ---------- */
.kv-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.kv {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: var(--sp-3);
  border-bottom: 1px dashed var(--borda-leve);
}
.kv:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.kv__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--texto-secundario);
}
.kv__value {
  font-size: 14px;
  font-weight: 600;
  color: var(--texto);
  letter-spacing: -0.01em;
  word-break: break-word;
}
.kv__value--money {
  font-size: 18px;
  color: var(--azul);
  font-variant-numeric: tabular-nums;
}

/* ---------- PRINT ---------- */
@media print {
  .breveia-header,
  .breveia-footer,
  .edital-detail__actions,
  .edital-detail__breadcrumb,
  .partner-ad,
  .locked-section { display: none !important; }

  .edital-detail__grid {
    grid-template-columns: 1fr;
  }

  .edital-detail__head {
    background: #fff !important;
    border: 1px solid #000 !important;
  }

  body {
    background: #fff !important;
  }

  .detail-card {
    page-break-inside: avoid;
  }
}

/* ---------- MOBILE ---------- */
@media (max-width: 900px) {
  .edital-detail__grid {
    grid-template-columns: 1fr;
  }
  .edital-detail__head {
    grid-template-columns: 1fr;
  }
  .edital-detail__score-area {
    flex-direction: row;
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .edital-detail {
    padding: var(--sp-4);
  }
  .edital-detail__head {
    padding: var(--sp-4);
  }
  .score-big {
    width: 96px;
    height: 96px;
  }
  .score-big__value {
    font-size: 30px;
  }
}
