/* ==========================================================================
   Estilos Customizados & Regras de Impressão A4 - Tratamento Exo +
   URL: tratamentoexo.online
   ========================================================================== */

@layer base {
  html {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
  }
}

/* Otimização de Teclados e Inputs no Smartphone */
input, select, textarea {
  font-size: 16px !important; /* Previne auto-zoom no iOS Safari */
}

/* Remove flechas de input number padrão */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield;
}

/* Transições suaves */
.transition-smooth {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Formatação Numérica Tabular para Alinhamento Perfeito de Valores */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Folha de Orçamento A4 Estrita (210mm x 297mm a 96DPI = 794px x 1123px)
   ========================================================================== */
.a4-sheet {
  width: 794px !important;
  min-height: 1123px !important;
  max-width: 794px !important;
  margin: 0 auto;
  background-color: #ffffff;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15), 0 8px 12px -6px rgba(0, 0, 0, 0.1);
  padding: 44px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  box-sizing: border-box;
}

/* Container do Modal de Pré-Visualização */
.a4-preview-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px 8px 40px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Regras Críticas para Impressão e Exportação em PDF (@media print)
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 0mm; /* Sem margem do driver: o padding da folha já é a margem real */
  }

  body {
    background: #ffffff !important;
    color: #0f172a !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Ocultar elementos da aplicação não impressos */
  .no-print,
  #app-header,
  #budget-form-container,
  #pwa-install-banner,
  #bottom-action-bar,
  #modal-preview,
  .modal-actions,
  .toast-container {
    display: none !important;
  }

  /* Força a folha A4 a ocupar a página perfeitamente centralizada */
  #a4-print-template {
    display: block !important;
    width: 100% !important;
    min-height: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }

  #a4-print-template .a4-sheet {
    box-shadow: none !important;
    border: none !important;
    margin: 0 auto !important;
  }

  /* Previne quebra de páginas em elementos sensíveis */
  .avoid-break, tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}

/* Animações */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slide-up {
  animation: slideUp 0.25s ease-out forwards;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(2, 132, 199, 0);
  }
}

.pulse-glow {
  animation: pulseGlow 2s infinite;
}
