/* ==========================================================================
   RAH. SOLUÇÕES EM TI - Estilos do PDF Executivo (Proposta Comercial & Ficha OS)
   Otimizado para visualização na tela e impressão A4 de alta qualidade
   ========================================================================== */

.pdf-preview-container {
  background: #ffffff;
  color: #1e293b;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 44px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  border-radius: 12px;
  position: relative;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 22px;
  gap: 16px;
}

.pdf-brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pdf-logo {
  height: 50px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
  object-position: left;
  filter: invert(1) brightness(0.2);
}

.pdf-company-info {
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.45;
}

.pdf-doc-info {
  text-align: right;
  flex-shrink: 0;
}

.pdf-doc-badge {
  display: inline-block;
  background: #ff5722;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.76rem;
  padding: 4px 12px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.pdf-doc-badge.os-badge {
  background: #0f172a;
}

.pdf-doc-number {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
}

.pdf-doc-date {
  font-size: 0.82rem;
  color: #475569;
  margin-top: 3px;
}

/* Grid de Informações Cliente & Projeto */
.pdf-client-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 24px;
}

.pdf-info-block h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #c2410c;
  margin-bottom: 6px;
  font-weight: 700;
}

.pdf-info-block p {
  font-size: 0.88rem;
  color: #334155;
  margin: 3px 0;
}

.pdf-info-block strong {
  color: #0f172a;
}

/* Checklist de OS no PDF */
.pdf-checklist-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 18px;
}

.pdf-checklist-box h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #0f172a;
  margin-bottom: 8px;
}

.pdf-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pdf-tag-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #0f172a;
  font-weight: 600;
}

.pdf-text-section {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 18px;
  background: #ffffff;
}

.pdf-text-section h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  color: #c2410c;
  margin-bottom: 6px;
}

.pdf-text-section pre {
  font-family: inherit;
  white-space: pre-wrap;
  font-size: 0.86rem;
  color: #334155;
  line-height: 1.5;
}

/* Tabela de Itens */
.pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 22px;
}

.pdf-table th {
  background: #0f172a;
  color: #ffffff;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  text-align: left;
}

.pdf-table th.text-center { text-align: center; }
.pdf-table th.text-right { text-align: right; }

.pdf-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.86rem;
  color: #334155;
}

.pdf-table td.text-center { text-align: center; }
.pdf-table td.text-right { text-align: right; font-weight: 600; }

.pdf-table tr:nth-child(even) {
  background-color: #f8fafc;
}

.pdf-item-type {
  display: inline-block;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}

.pdf-item-type.servico {
  background: #e0f2fe;
  color: #0369a1;
}

.pdf-item-type.peca {
  background: #ffedd5;
  color: #c2410c;
}

/* Totais & Resumo Financeiro */
.pdf-finance-summary {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
}

.pdf-totals-box {
  width: 300px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
}

.pdf-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: #475569;
  margin-bottom: 6px;
}

.pdf-total-row.final {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid #cbd5e1;
  font-size: 1.12rem;
  font-weight: 800;
  color: #c2410c;
}

/* Condições & Observações */
.pdf-conditions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 30px;
}

.pdf-condition-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
}

.pdf-condition-card h4 {
  font-size: 0.8rem;
  color: #0f172a;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pdf-condition-card p {
  font-size: 0.83rem;
  color: #475569;
  line-height: 1.45;
}

/* Assinaturas */
.pdf-signatures-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-top: 34px;
  padding-top: 10px;
}

.pdf-sign-col {
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.pdf-client-signature-img {
  max-height: 55px;
  width: auto;
  margin-bottom: -4px;
  object-fit: contain;
}

.pdf-sign-line {
  width: 100%;
  border-top: 1px solid #94a3b8;
  margin-bottom: 8px;
}

.pdf-sign-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #0f172a;
}

.pdf-sign-role {
  font-size: 0.76rem;
  color: #475569;
}

/* Certificado de Auditoria no PDF */
.pdf-audit-certificate-page {
  page-break-before: always;
  margin-top: 36px;
  padding-top: 22px;
  border-top: 2px dashed #cbd5e1;
}

.pdf-audit-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 18px;
}

.pdf-audit-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdf-audit-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 0.8rem;
  margin-top: 12px;
}

.pdf-footer {
  margin-top: 30px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  font-size: 0.75rem;
  color: #64748b;
}

/* Regras de Impressão A4 */
@media print {
  body {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  body * {
    visibility: hidden;
  }

  .pdf-preview-container, .pdf-preview-container * {
    visibility: visible !important;
  }

  .pdf-preview-container {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 12mm 14mm !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    color: #0f172a !important;
  }

  .no-print, .aceite-container, .admin-sidebar, .admin-topbar, .admin-modal-header {
    display: none !important;
  }

  @page {
    size: A4;
    margin: 0;
  }
}
