/* Tipografia base */
html, body {
  font-family: 'Montserrat', 'Roboto', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  margin: 0;
  padding: 0;
  background: #fff;
}

/* Barra superior fixa */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.top-bar__inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: center;
}

.top-bar__group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Certificado centralizado */
#certificado {
  width: 100%;
  max-width: 64rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  border-radius: .5rem;
  padding: 1rem;
  margin: 1rem auto;
}

/* Campos base */
.input-base,
.select-base,
.btn-base,
.label-base,
.table-base th,
.table-base td,
.section-title,
.frase-final,
.rodape-fixo,
.assinatura p,
.help-erro {
  font-size: 0.875rem;
}

.input-base,
.select-base {
  border: 1px solid #ccc;
  border-radius: 0.375rem;
  padding: 0.25rem 0.5rem;
  width: 100%;
  background-color: #fff;
}

.input-base:focus,
.select-base:focus {
  outline: none;
  box-shadow: none;
  border-color: #999;
}

/* Botões interativos */
.btn-base {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, outline 0.2s ease;
  color: #fff;
  font-weight: 500;
}

/* Vermelho técnico */
.bg-red-600 { background-color: #dc2626; }
.bg-red-600:hover { background-color: #b91c1c; }
.bg-red-600:focus { outline: 2px solid #991b1b; outline-offset: 2px; }
.bg-red-600:active { background-color: #991b1b; }

/* Azul técnico */
.bg-blue-600 { background-color: #2563eb; }
.bg-blue-600:hover { background-color: #1d4ed8; }
.bg-blue-600:focus { outline: 2px solid #1e40af; outline-offset: 2px; }
.bg-blue-600:active { background-color: #1e40af; }

/* Cinza escuro neutro */
.bg-gray-800 { background-color: #1f2937; }
.bg-gray-800:hover { background-color: #374151; }
.bg-gray-800:focus { outline: 2px solid #4b5563; outline-offset: 2px; }
.bg-gray-800:active { background-color: #4b5563; }

/* Verde para backup */
.bg-green-600 { background-color: #059669; }
.bg-green-600:hover { background-color: #047857; }
.bg-green-600:focus { outline: 2px solid #065f46; outline-offset: 2px; }
.bg-green-600:active { background-color: #065f46; }

/* Amarelo para restaurar */
.bg-yellow-600 { background-color: #d97706; }
.bg-yellow-600:hover { background-color: #b45309; }
.bg-yellow-600:focus { outline: 2px solid #92400e; outline-offset: 2px; }
.bg-yellow-600:active { background-color: #92400e; }

/* Labels */
.label-base {
  font-weight: 500;
  display: block;
  margin-bottom: 0.25rem;
}

/* Tabelas */
.table-base {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  text-align: center;
}

.table-base th {
  background-color: #f3f4f6;
  font-weight: 600;
  padding: 0.5rem;
  border: 1px solid #ccc;
}

.table-base td {
  padding: 0.25rem;
  border: 1px solid #ccc;
}

.table-base input,
.table-base select {
  width: 100%;
  padding: 0.25rem;
  border-radius: 0.375rem;
  border: 1px solid #ccc;
}

/* Tabela química com 3 colunas (pares elemento/% em 3 grupos) */
.quimica th, .quimica td { width: 12%; }
.quimica td input, .quimica td select { width: 100%; }

/* Feedback de erro */
.input-erro {
  border-color: #b91c1c !important;
  outline: 1px solid #b91c1c !important;
 font-size: 0.65rem !important;
}

.help-erro {
  color: #b91c1c;
  margin-top: 0.25rem;
  font-size: 0.7rem !important;
}

/* Frase final */
.frase-final {
  font-style: italic;
  text-align: center;
  white-space: normal;
}

/* Assinatura */
.assinatura { vertical-align: top; word-wrap: break-word; }
.assinatura img { max-width: 100px; }

/* Rodapé fixo na tela */
.rodape-fixo {
  white-space: pre-line;
  text-align: center;
  margin-top: 0.5rem;
  color: #6b7280;
}

/* Títulos de seção */
.section-title {
  font-weight: 600;
  text-transform: uppercase;
  margin: 1rem 0 0.5rem;
  color: #111827;
  white-space: normal;
  word-break: break-word;
}

/* ========================= */
/* MODAL CRUD AVANÇADO */
/* ========================= */

.modal-crud {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-crud.active {
  display: flex;
}

.modal-crud .modal-content {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

/* Tabs */
.tabs-container {
  border-bottom: 1px solid #e5e7eb;
}

.tab-btn {
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: #2563eb;
}

.tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Lista de itens */
.lista-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
  background: white;
  transition: all 0.2s ease;
}

.lista-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.lista-item.selecionado {
  border-color: #2563eb;
  background-color: #eff6ff;
}

.lista-item-info {
  flex: 1;
}

.lista-item-nome {
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.25rem;
}

.lista-item-detalhes {
  font-size: 0.75rem;
  color: #6b7280;
}

.lista-item-acoes {
  display: flex;
  gap: 0.5rem;
}

.btn-acao {
  padding: 0.25rem 0.5rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.btn-editar {
  background: #dbeafe;
  color: #1e40af;
}

.btn-editar:hover {
  background: #bfdbfe;
}

.btn-excluir {
  background: #fee2e2;
  color: #dc2626;
}

.btn-excluir:hover {
  background: #fecaca;
}

.btn-selecionar {
  background: #dcfce7;
  color: #166534;
}

.btn-selecionar:hover {
  background: #bbf7d0;
}

/* Botão CRUD flutuante */
.btn-crud {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1f2937;
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 100;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-crud:hover {
  background: #374151;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

/* Campos de seleção no certificado */
.cliente-select, .fornecedor-select {
  cursor: pointer;
  background-color: #f9fafb;
}

.cliente-select:hover, .fornecedor-select:hover {
  background-color: #f3f4f6;
}

.cliente-actions, .fornecedor-actions {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cliente-select:focus + .cliente-actions,
.cliente-select:hover + .cliente-actions,
.fornecedor-select:focus + .fornecedor-actions,
.fornecedor-select:hover + .fornecedor-actions {
  opacity: 1;
}

.btn-clear-cliente, .btn-clear-fornecedor {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Estados do formulário */
.form-editando {
  border-left: 4px solid #2563eb;
}

/* Scrollbar personalizada */
#listaClientes::-webkit-scrollbar,
#listaFornecedores::-webkit-scrollbar {
  width: 6px;
}

#listaClientes::-webkit-scrollbar-track,
#listaFornecedores::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

#listaClientes::-webkit-scrollbar-thumb,
#listaFornecedores::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

#listaClientes::-webkit-scrollbar-thumb:hover,
#listaFornecedores::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* ========================= */
/* ESTILOS PARA PDF - BORDAS APENAS NO CQ E DATA */
/* ========================= */

/* Remove bordas de TODOS os inputs durante a captura do PDF */
.capturando-pdf input,
.capturando-pdf textarea,
.capturando-pdf select {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* EXCEÇÃO: SOMENTE os campos CQ Nº e Data mantêm bordas durante a captura do PDF */
.capturando-pdf #cq,
.capturando-pdf #data {
    border: 1px solid #000 !important;
    outline: 1px solid #000 !important;
    background: transparent !important;
}

/* Remove setas dos selects no modo PDF */
.capturando-pdf select {
    background-image: none !important;
}

/* Garante que os spans de substituição não tenham bordas */
.print-only {
    border: none !important;
    background: transparent !important;
}

/* Impressão fiel */
@media print {
  @page { size: A4 portrait; margin: 10mm; }

  html, body {
    font-size: 13px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    font-family: 'Montserrat', 'Roboto', sans-serif !important;
    color: #000 !important;
    line-height: 1.4;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .no-print,
  .top-bar,
  button,
  .acoes,
  .acoes-col,
  th.acoes-col,
  td.acoes-col,
  .modal-crud,
  .btn-crud {
    display: none !important;
  }

  #certificado {
    width: 794px;
    min-height: 1123px;
    margin: 0 auto;
    box-shadow: none !important;
    border-radius: 0 !important;
    page-break-inside: avoid;
    background: #fff !important;
  }

  table {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed;
  }

  th, td {
    border: 1px solid #000 !important;
    padding: 4px 6px !important;
    text-align: center;
    vertical-align: middle;
    word-wrap: break-word;
  }

  /* Remove bordas de TODOS os inputs na impressão/PDF */
  input, textarea, select {
    border: none !important;
    background: transparent !important;
    color: #000 !important;
    font-size: 0.8rem !important;
    padding: 0 !important;
    text-align: center;
    width: 100% !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
  }

  /* EXCEÇÃO: SOMENTE os campos CQ Nº e Data mantêm bordas no PDF */
  #cq, #data {
    border: 1px solid #000 !important;
    outline: 1px solid #000 !important;
    background: transparent !important;
  }

  tr { page-break-inside: avoid; page-break-after: auto; }

  img {
    image-rendering: crisp-edges;
    background: transparent !important;
  }

  .rodape-fixo { display: none !important; }

  .assinatura {
    text-align: center;
    vertical-align: top;
  }

  .assinatura img {
    display: block;
    margin: 0 auto 4px;
    max-width: 90px;
  }

  /* Rodapé dinâmico único para impressão */
  .print-rodape-extra {
    display: block !important;
    position: fixed;
    bottom: 10mm;
    left: 0;
    right: 0;
    font-size: 0.7rem !important;
    text-align: center;
    color: #444;
    background: transparent !important;
    white-space: pre-line;
  }
}

td, th {
  text-align: center;
  vertical-align: middle;
}

/* Oculta campos até hover, mas mantém visível se preenchido */
.dados-certificado td input,
.dados-certificado td select,
.especificacoes-produto td input,
.especificacoes-produto td select {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.dados-certificado td:hover input,
.dados-certificado td:hover select,
.especificacoes-produto td:hover input,
.especificacoes-produto td:hover select,
.dados-certificado td input:not(:placeholder-shown),
.especificacoes-produto td input:not(:placeholder-shown) {
  opacity: 1;
  pointer-events: auto;
}

/* Estilo para mensagens de orientação */
.text-xs { font-size: 0.75rem; }
.text-gray-500 { color: #6b7280; }
.mt-1 { margin-top: 0.25rem; }
.w-32 { width: 8rem; }

/* Toast de mensagem */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: #059669;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  z-index: 1000;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsividade adicional */
@media (max-width: 768px) {
  .top-bar__inner {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  #certificado {
    margin: 0.5rem;
    padding: 0.75rem;
  }
  
  .table-base {
    font-size: 0.8rem;
  }

  .modal-crud .modal-content {
    width: 95%;
    margin: 1rem;
    padding: 1rem;
  }

  .btn-crud {
    bottom: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }
  
  .lista-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .lista-item-acoes {
    align-self: flex-end;
  }
}

/* Animações */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-crud.active .modal-content {
  animation: slideIn 0.3s ease;
}

.lista-item {
  animation: slideIn 0.2s ease;
}

/* APENAS COR EM VOLTA DO SISTEMA - SEM MODIFICAÇÕES */
/* AZUL E CINZA - Combinação profissional para fixadores */
body {
  background: linear-gradient(135deg, #1d1d1d 0%, #3b82f6 50%, #e7e2e2 100%) !important;
  padding: 20px;
  min-height: 100vh;
}

#certificado {
  /*box-shadow: 0 0 0 15px #ffffff !important;*/
  border: 3px solid #ffffff !important;
}




