/* Reproduz o pop-up "Tabela pronta" do Figma.
   Valores literais extraídos do Figma (os tokens do arquivo não usam variáveis).
   O que NÃO está no Figma está marcado com "(nosso)". */

.cm-fundo,
.cm-janela,
.cm-arte,
.cm-painel,
.cm-cabecalho,
.cm-titulo,
.cm-fechar,
.cm-grupo,
.cm-rotulo,
.cm-recortes,
.cm-recorte,
.cm-legenda,
.cm-linha-legenda,
.cm-contador,
.cm-selo,
.cm-aviso,
.cm-publicar,
.cm-pulso,
.cm-esq-titulo,
.cm-esq-rotulo,
.cm-esq-recortes,
.cm-esq-legenda,
.cm-esq-botao {
  box-sizing: border-box;
  font-family: Inter, system-ui, sans-serif;
}

.cm-fundo {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.62);
}

.cm-janela {
  display: flex;
  gap: 28px;
  padding: 28px;
  background: #171a21;
  border: 1px solid #2a2e38;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  color: #e6e8ec;
  max-width: 100%;
  max-height: 100%;
  overflow: auto;
}

.cm-arte {
  flex: none;
  width: 520px;
  height: 650px;
  background: #22262e;
  overflow: hidden;
}

.cm-arte img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cm-painel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 420px;
  height: 650px;
  flex: none;
}

.cm-cabecalho {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cm-titulo {
  flex: 1;
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  color: #e6e8ec;
}

.cm-fechar {
  background: none;
  border: 0;
  padding: 0;
  color: #9aa1ac;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.cm-fechar:hover {
  color: #e6e8ec;
}

.cm-grupo {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cm-rotulo {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.96px;
  text-transform: uppercase;
  color: #9aa1ac;
}

.cm-recortes {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #1e2129;
  border: 1px solid #2a2e38;
  border-radius: 8px;
}

.cm-recorte {
  flex: 1 1 0;
  padding: 8px 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #e6e8ec;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.cm-recorte[aria-pressed="true"] {
  background: #4f8cff;
  color: #0e0e0e;
  font-weight: 600;
}

.cm-recorte:disabled {
  cursor: default;
  opacity: 0.6;
}

.cm-legenda {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: 14px;
  background: #1e2129;
  border: 1px solid #2a2e38;
  border-radius: 8px;
  color: #e6e8ec;
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  resize: none;
  outline: none;
}

.cm-legenda:focus {
  border-color: #4f8cff;
}

.cm-legenda:disabled {
  opacity: 0.6;
}

/* (nosso) */
.cm-linha-legenda {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.cm-contador {
  font-size: 12px;
  color: #9aa1ac;
}

.cm-contador.excedido {
  color: #ff6b6b;
}

/* (nosso) */
.cm-selo {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #2a2e38;
  color: #9aa1ac;
}

.cm-selo[data-estado="verified"] {
  color: #6ee7a8;
  border-color: rgba(110, 231, 168, 0.4);
}

.cm-selo[data-estado="provisional"] {
  color: #f5c451;
  border-color: rgba(245, 196, 81, 0.4);
}

.cm-selo[data-estado="stale"] {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.4);
}

/* (nosso) */
.cm-aviso {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  color: #ffb4b4;
  background: rgba(227, 38, 46, 0.12);
  border: 1px solid rgba(227, 38, 46, 0.4);
}

.cm-aviso[hidden] {
  display: none;
}

.cm-aviso.ok {
  color: #b4f0cf;
  background: rgba(110, 231, 168, 0.12);
  border-color: rgba(110, 231, 168, 0.4);
}

.cm-publicar {
  width: 100%;
  padding: 12px 0;
  border: 0;
  border-radius: 8px;
  background: #4f8cff;
  color: #0e0e0e;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
/* Linha de ações do modal: Download e Publicar dividem o espaço. */
.cm-acoes { display: flex; gap: 12px; flex: none; }

.cm-acoes .cm-publicar,
.cm-acoes .cm-baixar {
  flex: 1;
  width: auto;
}

.cm-baixar {
  padding: 12px 0;
  border: 0;
  border-radius: 8px;
  background: #4f8cff;
  color: #0e0e0e;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 18px;
  cursor: pointer;
}

.cm-baixar:disabled {
  opacity: 0.5;
  cursor: default;
}

.cm-publicar:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Esqueleto de carregamento (medidas do Figma "Skeleton / Tabela") */
.cm-pulso {
  background: #22262e;
  animation: cm-pulso 1.2s ease-in-out infinite; /* (nosso) duração */
}

@keyframes cm-pulso {
  0%,
  100% {
    background-color: #22262e;
  }
  50% {
    background-color: #282c35;
  }
}

.cm-esq-titulo {
  width: 250px;
  height: 24px;
  border-radius: 6px;
}

.cm-esq-rotulo {
  width: 70px;
  height: 10px;
  border-radius: 6px;
}

.cm-esq-recortes {
  height: 38px;
  width: 100%;
  border-radius: 6px;
}

.cm-esq-legenda {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border-radius: 6px;
}

.cm-esq-botao {
  height: 46px;
  width: 100%;
  border-radius: 8px;
  background: #282c35;
}

@media (prefers-reduced-motion: reduce) {
  .cm-pulso {
    animation: none;
  }
}

@media (max-width: 1100px) {
  .cm-janela {
    flex-direction: column;
  }

  .cm-arte {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
  }

  .cm-painel {
    width: 100%;
    height: auto;
  }

  .cm-legenda {
    min-height: 220px;
  }
}
/* O atributo hidden perde para display:flex das classes do modal; esta regra o faz valer. */
.cm-fundo [hidden] { display: none !important; }

/* Altura do botao Publicar igual a do Figma (42 px: 12 + 18 + 12). */
.cm-publicar { line-height: 18px; }

/* Legenda: o campo ocupa o espaço livre do painel, "Gerar de novo" fica embaixo à esquerda e o contador à direita.
   O Publicar fica na base do painel, alinhado à base da arte (nosso). */
.cm-grupo-legenda {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  column-gap: 8px;
  row-gap: 8px;
}

.cm-grupo-legenda > .cm-rotulo {
  grid-column: 1 / -1;
}

.cm-grupo-legenda > .cm-legenda {
  grid-column: 1 / -1;
  height: 100%;
}

.cm-grupo-legenda > .cm-legenda-barra {
  grid-column: 1;
  min-width: 0;
  margin-top: 0 !important; /* anula o margin-top inline da barra (legenda-barra.js) */
}

.cm-grupo-legenda > .cm-linha-legenda {
  grid-column: 2;
  justify-content: flex-end;
}

.cm-legenda-status {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #9aa1ac;
}

.cm-legenda-barra {
  flex-wrap: wrap;
}

.cm-aviso-legenda {
  flex: 1 0 100%;
  color: #9aa1ac;
  font-size: 12px;
  line-height: 1.3;
}

.cm-aviso-legenda[hidden] {
  display: none;
}

.cm-gerar-legenda {
  flex: none;
  padding: 7px 14px;
  background: #1e2129;
  border: 1px solid #2a2e38;
  border-radius: 8px;
  color: #e6e8ec;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  cursor: pointer;
}

.cm-gerar-legenda:hover:not(:disabled) {
  border-color: #4f8cff;
}

.cm-gerar-legenda:disabled {
  opacity: 0.6;
  cursor: default;
}

.cm-aviso,
.cm-publicar {
  flex: none;
}

