/* =========================================================
   Central de Operações — OLTS Tech
   Módulo Aprovações — fila de publicação do Instagram
   Design system: Spotify (getdesign.md/design-md/spotify)
   Ordem do Marcus (12/11/2026): Spotify substitui o SpaceX.
   Carregado DEPOIS de css/central.css: não redefine token
   nenhum, só consome os que já existem e os componentes base
   (.badge-status, .button-pill, .text-input, .field-label,
    .empty-state, .caption, .search-pill-input, .sort-select).

   Ordem: tons → avisos → lista → prévia → corpo → legenda →
          decisão → ações → estados → responsivo
   ========================================================= */

/* ---------- 0. Tons de estado (semânticos Spotify) ---------- */
:root {
  --apr-ok-ink: #1ed760;
  --apr-warn-ink: #ffa42b;
  --apr-err-ink: #f3727f;
}

/* ---------- 1. Avisos do topo ---------- */
.apr-gate-alert,
.apr-api-banner {
  margin-top: var(--sp-base);
  padding: var(--sp-md) var(--sp-base);
  border-radius: var(--r-xs);
  border: 0; border-left: 4px solid var(--attention);
  background: #1f1f1f;
  font-size: var(--pbody-sm);
  line-height: var(--lh-body);
  color: var(--ink);
}
.apr-api-banner {
  border-left-color: var(--critical);
  font-weight: 700;
  color: var(--apr-err-ink);
}

/* Filtros de status (o feed usa .feed-chips; o módulo tem a sua fileira) */
.apr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin-top: var(--sp-base);
}

/* Linha de status das ações — é aqui que o erro da API aparece */
.apr-status-line {
  margin-top: var(--sp-base);
  padding: var(--sp-sm) var(--sp-base);
  border-radius: var(--r-xs);
  border: 0;
  background: #1f1f1f;
  color: var(--charcoal);
  font-size: var(--pbody-sm);
  font-weight: 700;
}
.apr-status-line.is-ok { color: var(--apr-ok-ink); }
.apr-status-line.is-warn { color: var(--apr-warn-ink); }
.apr-status-line.is-error { color: var(--apr-err-ink); }

/* ---------- 2. Lista de cards ---------- */
.apr-list {
  display: grid;
  grid-template-columns: 1fr;   /* mobile-first: um post por linha */
  gap: var(--sp-xl);
  margin-top: var(--sp-xl);
}
.apr-card {
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
  background: var(--canvas-soft);
  border: 0; border-left: 4px solid var(--hairline);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-card, rgba(0, 0, 0, 0.3) 0px 8px 8px);
}
/* Status pela borda esquerda — mesma convenção do .job-card */
.apr-card.status-pendente { border-left-color: var(--attention); }
.apr-card.status-aprovado { border-left-color: var(--success); }
.apr-card.status-reprovado { border-left-color: var(--critical); }
.apr-card.status-aprovado .badge-status.ativo { color: var(--apr-ok-ink); border-color: var(--apr-ok-ink); }

/* ---------- 3. Prévia (o que vai ao ar) ---------- */
.apr-media {
  position: relative;
  aspect-ratio: 4 / 5;          /* card do Instagram 1080×1350 */
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
  overflow: hidden;
}
/* contain, nunca cover: a arte carrega texto e um recorte poderia
   esconder justamente o número que a aprovação está liberando */
.apr-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.apr-media-empty { display: grid; place-items: center; }

.apr-gallery-nav {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-xs);
  pointer-events: none;         /* só os controles clicáveis */
}
.apr-gal-btn {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;    /* alvo de toque mínimo */
  padding: 0;
  border: 1px solid var(--ink-mute);
  border-radius: 50%;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body); font-size: 1.35rem; line-height: 1;
  cursor: pointer;
}
.apr-gal-btn:active { background: #ffffff; color: #000000; }
.apr-gal-count {
  position: absolute;
  top: var(--sp-xs); right: var(--sp-xs);
  padding: 2px var(--sp-sm);
  border: 1px solid var(--hairline);
  border-radius: var(--r-chip);
  background: var(--canvas);
  color: var(--charcoal);
  font-size: var(--ptiny); font-weight: 700;
}
.apr-dots {
  position: absolute;
  left: 50%; bottom: var(--sp-xs);
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 6px var(--sp-sm);
  border: 1px solid var(--hairline);
  border-radius: var(--r-chip);
  background: var(--canvas);
}
.apr-dot {
  width: 10px; height: 10px; padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.apr-dot.is-active { background: #ffffff; border-color: #ffffff; }

/* ---------- 4. Corpo do card ---------- */
.apr-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: var(--sp-lg);
  min-width: 0;
}
.apr-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-xs); flex-wrap: wrap;
}
.apr-channel {
  font-size: var(--ptiny); font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--charcoal); white-space: nowrap;
}
.apr-title {
  font-family: var(--font-display);
  font-size: var(--psubtitle-lg); font-weight: 700;
  line-height: var(--lh-headings); letter-spacing: var(--ls-display, 0.02em);
  text-transform: uppercase;
  color: var(--ink);
}
/* Intenção do post — discreta: muted Spotify, corpo menor */
.apr-summary {
  font-size: var(--pcaption, 0.8125rem);
  line-height: var(--lh-body);
  color: var(--charcoal);
}
.apr-when {
  display: flex; align-items: baseline; gap: var(--sp-xs); flex-wrap: wrap;
  font-size: var(--pbody-sm); color: var(--ink);
}
.apr-rel {
  padding: 1px var(--sp-xs);
  border: 1px solid var(--hairline);
  border-radius: var(--r-chip);
  background: transparent;
  color: var(--charcoal);
  font-size: var(--ptiny); font-weight: 700;
}
.apr-facts { font-size: var(--pcaption); color: var(--charcoal); }

/* ---------- 5. Legenda ---------- */
.apr-caption-wrap {
  position: relative;
  padding: var(--sp-base);
  border-radius: var(--r-xs);
  border: 0;
  background: #1f1f1f;
}
/* pre-line preserva as quebras do texto literal que vai ao Instagram —
   sem isso a legenda aprovada não é a legenda exibida */
.apr-caption {
  font-size: var(--pbody-sm);
  line-height: var(--lh-body);
  color: var(--ink-mute);
  white-space: pre-line;
}
/* Corte seco da legenda + toggle (sem fade) */
.apr-caption-wrap:not(.is-open) .apr-caption { max-height: 9em; overflow: hidden; }
.apr-more {
  display: inline-flex; align-items: center;
  align-self: flex-start;
  min-height: 44px; padding: 0;
  border: 0; background: none;
  color: var(--ink);
  font-family: var(--font-body); font-size: var(--pbody-sm); font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- 6. Decisão registrada ---------- */
.apr-decision { font-size: var(--pbody-sm); color: var(--charcoal); }
.apr-decision strong { color: var(--ink); }
.apr-decision q { color: var(--ink-mute); font-style: italic; }
.apr-decision-idle {
  padding: var(--sp-md);
  border-radius: var(--r-xs);
  background: transparent;
  border: 1px dashed var(--hairline);
}

/* ---------- 7. Ações — CTA aprovar em verde funcional, resto outlined ---------- */
.apr-actions { display: flex; flex-wrap: wrap; gap: var(--sp-sm); margin-top: var(--sp-xxs); }
.apr-btn {
  flex: 1 1 160px;               /* mobile: botão de largura confortável */
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 14px 24px;
  border: 1px solid #7c7c7c;
  border-radius: var(--r-chip);
  background: transparent; color: var(--ink);
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 700;
  letter-spacing: 1.4px; text-transform: uppercase;
  cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.apr-btn:hover { background: rgba(255, 255, 255, 0.06); color: #ffffff; border-color: #ffffff; }
.apr-btn-approve { background: var(--accent, #1ed760); border-color: var(--accent, #1ed760); color: #000000; }
.apr-btn-approve:hover { background: var(--accent-hover, #35e475); border-color: var(--accent-hover, #35e475); color: #000000; }
.apr-btn-reject { color: var(--apr-err-ink); border-color: var(--apr-err-ink); }
.apr-btn-reject:hover { background: transparent; color: var(--apr-err-ink); border-color: var(--apr-err-ink); }
.apr-btn-undo { color: var(--charcoal); border-color: var(--hairline); }
.apr-btn-undo:hover { background: transparent; color: var(--ink); border-color: var(--ink); }
.apr-btn-reject-solid { background: #ffffff; border-color: #ffffff; color: #000000; }
.apr-btn-reject-solid:hover { background: var(--ink-mute); color: #000000; }
.apr-btn-cancel { color: var(--charcoal); border-color: transparent; }
.apr-btn-cancel:hover { background: transparent; color: var(--ink); border-color: var(--hairline); }
.apr-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.apr-locked {
  font-size: var(--ptiny); font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--charcoal);
}

/* Painel de reprovação (motivo opcional) */
.apr-reject-panel {
  display: flex; flex-direction: column; gap: var(--sp-sm);
  margin-top: var(--sp-md);
  padding: var(--sp-base);
  border: 0; border-left: 4px solid var(--critical);
  border-radius: var(--r-xs);
  background: #1f1f1f;
}
.apr-note { height: auto; min-height: 72px; padding: var(--sp-md); resize: vertical; font-size: var(--pbody-sm); }
.apr-reject-actions { display: flex; flex-wrap: wrap; gap: var(--sp-sm); }

/* ---------- 8. Responsivo ---------- */
/* Duas colunas (prévia | decisão) só quando há largura sobrando:
   em tela estreita a prévia fica em cima, inteira. */
@media (min-width: 900px) {
  .apr-card { grid-template-columns: 260px 1fr; }
  .apr-media { border-right: 1px solid var(--hairline); border-bottom: 0; }
  .apr-btn { flex: 0 1 auto; }
}
@media (max-width: 480px) {
  .apr-body { padding: var(--sp-base); }
  .apr-btn { flex: 1 1 100%; }    /* botões empilhados, alvo cheio */
  .apr-gal-btn { width: 40px; height: 40px; }
}
