/* ==========================================================================
   DTE FÁCIL SV - ESTILOS DE IMPRESIÓN Y RENDERIZADO ULTRA-PROFESIONAL
   ========================================================================== */

@media print {
  body {
    background-color: #ffffff !important;
    color: #0f172a !important;
    font-size: 10pt;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .no-print,
  nav,
  header,
  aside,
  .sidebar,
  .action-buttons,
  .toast-container,
  #action-bar,
  .studio-sidebar {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  main {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .document-preview-container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .dte-letter {
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }

  .dte-ticket {
    width: 78mm !important;
    max-width: 78mm !important;
    margin: 0 !important;
    padding: 2mm !important;
    box-shadow: none !important;
    border: none !important;
  }

  @page {
    size: letter portrait;
    margin: 8mm 6mm;
  }
}

/* Modo Hoja de Papel Carta (SaaS Preview) */
.dte-letter {
  width: 800px;
  min-width: 800px;
  max-width: 800px;
  min-height: auto;
  margin: 0 auto;
  background: #ffffff;
  color: #0f172a;
  padding: 18px 22px;
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  border-radius: 12px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  border: 1px solid #cbd5e1;
  position: relative;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

/* Tablas y Cajas con Estructura Oficial MH */
.dte-box-mh {
  border: 1px solid #94a3b8;
  border-radius: 6px;
  background-color: #ffffff;
}

.dte-table-mh {
  width: 100%;
  border-collapse: collapse;
}

.dte-table-mh th,
.dte-table-mh td {
  border: 1px solid #94a3b8;
  padding: 3.5px 5px;
}

.dte-table-mh th {
  background-color: #f1f5f9;
  font-weight: 700;
  color: #1e293b;
}

/* Modo Ticket Térmico 80mm */
.dte-ticket {
  width: 80mm;
  max-width: 100%;
  margin: 0 auto;
  font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
  background: #ffffff;
  color: #0f172a;
  padding: 16px;
  font-size: 11px;
  line-height: 1.4;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
}

.dte-ticket .dashed-divider {
  border-top: 1px dashed #64748b;
  margin: 8px 0;
}

.dte-ticket .double-divider {
  border-top: 2px double #0f172a;
  margin: 8px 0;
}

/* Elementos de Tablas */
.table-dte {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-dte th {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  padding: 8px 10px;
}

.table-dte td {
  padding: 8px 10px;
  font-size: 11.5px;
  border-bottom: 1px solid #f1f5f9;
}

.qr-code-img {
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code-img img,
.qr-code-img canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Efecto hover en items */
.table-dte tbody tr:hover {
  background-color: #f8fafc;
}

/* Reglas de corte para PDF */
.table-dte tr,
.dte-box-mh,
.qr-code-img {
  page-break-inside: avoid;
  break-inside: avoid;
}
