/* ============================================================
   app.css — ajustes só do front (o resto vem de /assets/css/*)
   ============================================================ */

/* ---------- Botão flutuante "Adicionar" (canto inferior direito da tela) ---------- */
.fab{
  right: 24px;
  left: auto;
  bottom: 24px;
  z-index: 1100;
}

@media (max-width: 768px){
  .fab{ right: 16px; bottom: 16px; }
}

/* espaço pro FAB não cobrir a última linha da tabela */
.content{ padding-bottom: 96px; }

/* ---------- Combo (select com busca) ---------- */
.combo{ position: relative; }

.combo-busca{ width: 100%; }

.combo-lista{
  margin-top: 6px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.combo-item{
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
}

.combo-item:hover,
.combo-item.ativo{
  background: var(--accent-soft);
  color: var(--accent);
}

.combo-vazio{
  padding: 9px 12px;
  font-size: 13px;
  color: var(--ink-faint);
}

/* ---------- Trava de fundo enquanto um overlay está aberto ---------- */
html{ scrollbar-gutter: stable; }              /* evita o "pulo" ao esconder a rolagem */

body.modal-aberto{
  overflow: hidden;
  overscroll-behavior: contain;
}
body.modal-aberto .fab{ display: none; }       /* o botão flutuante não fura o modal */

/* o modal e o lightbox ficam acima de tudo (inclusive do FAB, z-index 1100) */
.modal-overlay{ z-index: 1200; }

/* ---------- Linha de tabela clicável ---------- */
tbody tr.linha-clicavel{ cursor: pointer; }
tbody tr.linha-clicavel:hover{ background: var(--surface-alt); }

/* ---------- Tela do item ---------- */
.page-head .btn-ghost{ align-self: center; }

/* ações do formulário do item (Salvar / Remover) */
.form-acoes{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

/* ---------- Card de auditoria (mini tela de registro-auditoria do item) ---------- */
.card-auditoria{ margin-top: 18px; }

.card-titulo{
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.tabela-scroll{ overflow-x: auto; }

.tabela-auditoria{ width: 100%; border-collapse: collapse; }
.tabela-auditoria th{
  text-align: left;
  font-size: 12px;
  color: var(--ink-soft);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tabela-auditoria td{
  padding: 9px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

/* JSON de valor anterior / valor novo, identado e legível */
.aud-json{
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  min-width: 240px;
  max-height: 260px;
  overflow: auto;
}

@media (max-width: 768px){
  /* no card de auditoria mantém a tabela de verdade (rolando na horizontal),
     em vez do layout empilhado que o .table-card aplica nas listas */
  .card-auditoria table{ display: table; width: max-content; min-width: 100%; }
  .card-auditoria thead{ display: table-header-group; }
  .card-auditoria tbody{ display: table-row-group; }
  .card-auditoria tr{ display: table-row; border: 0; margin: 0; box-shadow: none; }
  .card-auditoria td{ display: table-cell; text-align: left; }
  .card-auditoria td::before{ content: none; }
  .aud-json{ min-width: 200px; }
}

/* ---------- Detalhe só-leitura (recursos sem formulário) ---------- */
.detalhe-item label{
  font-size: 12px;
  color: var(--ink-soft);
}
.detalhe-valor{
  font-size: 14px;
  color: var(--ink);
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--border);
  word-break: break-word;
  white-space: pre-wrap;
}

/* ---------- Campo de imagem ---------- */
.campo-imagem-preview{
  max-width: 100%;
  max-height: 220px;
  width: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: contain;
  background: var(--surface-alt);
  cursor: zoom-in;
}

/* ---------- Lightbox (imagem em foco) ---------- */
.lightbox{
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, .88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}

.lightbox img{
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.campo-imagem .btn{
  align-self: flex-start;
}
