/* SPDX-License-Identifier: GPL-3.0-or-later */
/* Athenes — Estilos de Painéis, Inspetor de Tipografia e Modais */

.ath-prop-grupo {
  margin-bottom: 14px;
}

.ath-prop-grupo label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ath-text-secondary);
  margin-bottom: 5px;
}

.ath-linha2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ath-linha3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.ath-linha4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

/* Grupo de Botões Segmentados (Alinhamento, etc) */
.ath-btn-grupo {
  display: flex;
  border: 1px solid var(--ath-input-border);
  border-radius: var(--ath-radius-sm);
  background: var(--ath-input);
  padding: 2px;
  gap: 2px;
}

.ath-btn-seg {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  color: var(--ath-muted);
  transition: all 0.15s ease;
}

.ath-btn-seg:hover {
  color: var(--ath-text);
}

.ath-btn-seg.ativo {
  background: var(--ath-primary, #314F79) !important;
  color: #FFFFFF !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 6px rgba(49, 79, 121, 0.25) !important;
}

.ath-btn-seg.ativo svg {
  stroke: #FFFFFF !important;
}

/* Chips de Estilos de Texto */
.ath-estilos-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.ath-chip-estilo {
  padding: 4px 10px;
  border-radius: var(--ath-radius-full);
  border: 1px solid var(--ath-line);
  background: var(--ath-surface);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ath-chip-estilo:hover {
  border-color: var(--ath-primary);
}

.ath-chip-estilo.ativo {
  background: var(--ath-primary);
  border-color: var(--ath-primary);
  color: #FFFFFF;
}

/* Modais e Diálogos */
.ath-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  /* sem backdrop-filter para evitar lag de GPU sobre canvas/PDF */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

body:has(.ath-modal-backdrop) #athPillAcoesCursor,
body:has(.ath-modal-backdrop) #athBarraContextualTexto,
body:has(.ath-modal-backdrop) .ath-pill-cursor-acoes,
body:has(.ath-modal-backdrop) .ath-barra-contextual {
  display: none !important;
}

.ath-modal {
  background: var(--ath-surface);
  border-radius: var(--ath-radius);
  box-shadow: var(--ath-shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalEntrar 0.2s ease-out;
}

@keyframes modalEntrar {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.ath-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ath-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.ath-modal-head h2 {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 17px;
  font-weight: 800;
  color: var(--ath-text);
}

.ath-modal-head > .ath-btn-icon {
  display: inline-flex;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  margin-left: 12px;
}

.ath-modal-corpo {
  padding: 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.ath-modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--ath-line);
  background: var(--ath-surface-elevated);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* Rátulos que sáo botáes (seletor de arquivo) mantám texto legável dentro de .ath-prop-grupo */
.ath-prop-grupo label.ath-btn { color: #1F2733; font-size: 12px; font-weight: 700; display: inline-flex; margin: 0; }
.ath-prop-grupo label.ath-btn.ath-btn-primary { color: #FFFFFF; background: #314F79; }
.ath-prop-grupo label.ath-btn.ath-btn-primary svg { stroke: #FFFFFF; }
.ath-btn-primary, .ath-btn-primary svg { color: #FFFFFF; }

/* Biblioteca Zotero: duas colunas (obras | resumo, fichamento e citação longa) quando há largura; uma só em tela estreita */
.ath-zotero-painel { container-type: inline-size; }
.ath-zotero-colunas { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.ath-zotero-col-esq, .ath-zotero-col-dir { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ath-zotero-vazio { font-size: 12px; color: #64748B; padding: 18px 12px; border: 1px dashed #CBD5E1; border-radius: 10px; text-align: center; background: #F8FAFC; }
.ath-zotero-col-dir .ath-leitura-detalhes { margin-top: 0 !important; padding-top: 0 !important; border-top: 0 !important; }
@container (min-width: 460px) {
  .ath-zotero-colunas { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); grid-template-rows: minmax(0, 1fr); align-items: stretch; overflow: hidden; padding-right: 0; }
  .ath-zotero-col-esq, .ath-zotero-col-dir { overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: #B6C3D3 transparent; padding-right: 8px; } /* cada coluna rola sozinha */
  .ath-zotero-col-dir { border-left: 1px solid #E2E8F0; padding-left: 14px; }
}
.ath-zotero-painel textarea { resize: vertical; width: 100% !important; min-height: 48px; max-width: 100%; } /* o tamanho das caixas de texto só muda na vertical */
.ath-zotero-painel textarea { max-height: 45vh; }
.ath-zotero-colunas { scrollbar-width: thin; scrollbar-color: #B6C3D3 transparent; padding-right: 6px; } /* barra de rolagem visível quando o conteúdo passa da janela */
.ath-zotero-col-esq > *, .ath-zotero-col-dir > *, .ath-zotero-lista, .ath-zotero-lista > * { flex-shrink: 0; } /* o conteúdo não se espreme: a coluna rola */
.ath-zotero-col-esq > .ath-zotero-lista { flex: none; overflow: visible; } /* a rolagem é da coluna, não da lista dentro dela */
