/**
 * Estilos Térmicos para Tickets de Venta y Cierres de Turno (58mm y 80mm)
 * Diseñado estrictamente para impresión térmica de recibos monospaciados
 */

/* Contenedor de visualización previa en pantalla */
#ticket-print-container {
  display: none;
}

@media print {
  /* Ocultar toda la interfaz de la aplicación */
  body * {
    visibility: hidden;
  }

  /* Mostrar exclusivamente el ticket térmico */
  #ticket-print-container,
  #ticket-print-container * {
    visibility: visible;
  }

  #ticket-print-container {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #fff;
    color: #000;
  }

  @page {
    margin: 0;
    size: auto;
  }

  /* El cabezal térmico (203 dpi) no reproduce trazos finos ni grises: Courier New en
     peso normal sale tenue o cortado, así que en papel todo el texto va en negrita sólida */
  #ticket-print-container .thermal-receipt,
  #ticket-print-container .thermal-receipt * {
    font-weight: 700 !important;
    color: #000 !important;
    -webkit-font-smoothing: none;
    text-rendering: geometricPrecision;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Formato Térmico Estándar */
.thermal-receipt {
  font-family: 'Courier New', Courier, monospace, 'Lucida Console';
  color: #000;
  background: #fff;
  font-size: 13px;
  line-height: 1.3;
  margin: 0;
  padding: 2mm 1.5mm 4mm;
  box-sizing: border-box;
}

/* El ancho del ticket es el área que imprime el cabezal, no el del rollo: si el
   contenido es más ancho, el navegador lo reduce y el texto deja de calzar con los
   puntos del cabezal (203 dpi), que es lo que se ve borroso en papel */

/* Modo 58 mm (cabezal imprime ~48 mm) */
.thermal-58 {
  width: 48mm;
  max-width: 48mm;
  font-size: 12px;
}

/* Modo 80 mm (cabezal imprime ~72 mm) */
.thermal-80 {
  width: 72mm;
  max-width: 72mm;
  font-size: 13px;
}

.ticket-header {
  text-align: center;
  margin-bottom: 6px;
}

.ticket-title {
  font-size: 1.25em;
  font-weight: bold;
  text-transform: uppercase;
  margin: 0 0 2px 0;
}

.ticket-subtitle {
  font-size: 0.95em;
  margin: 1px 0;
}

.ticket-divider {
  border-top: 1px solid #000;
  margin: 6px 0;
}

.ticket-divider-double {
  border-top: 2px solid #000;
  margin: 5px 0;
}

.ticket-meta {
  font-size: 0.95em;
  margin-bottom: 5px;
}

.ticket-meta-row {
  display: flex;
  justify-content: space-between;
}

.ticket-table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0;
}

.ticket-table th {
  border-bottom: 1px solid #000;
  text-align: left;
  font-size: 0.95em;
  padding-bottom: 2px;
}

/* Cantidad con su propio espacio para que no se pegue al nombre (ej. 1.000kg) */
.ticket-table .col-qty {
  width: 1%;
  white-space: nowrap;
  padding-right: 6px;
}

.ticket-table .col-amount {
  white-space: nowrap;
  padding-left: 6px;
}

.ticket-table th.col-right,
.ticket-table td.col-right {
  text-align: right;
}

.ticket-table td {
  padding: 2px 0;
  vertical-align: top;
}

.ticket-item-name {
  word-break: break-word;
}

.ticket-totals {
  margin-top: 6px;
  font-size: 1em;
}

.ticket-total-row {
  display: flex;
  justify-content: space-between;
  margin: 2px 0;
}

.ticket-grand-total {
  font-size: 1.35em;
  font-weight: bold;
  margin: 4px 0;
}

.ticket-footer {
  text-align: center;
  margin-top: 8px;
  font-size: 0.95em;
}

/* Crédito del sistema: discreto, bajo el mensaje del local */
.ticket-footer .ticket-software {
  margin-top: 6px;
  font-size: 0.8em;
  letter-spacing: 0.04em;
}

/* Línea y texto de firma al pie de comprobantes */
.ticket-signature-line {
  border-top: 1px solid #000;
  width: 80%;
  margin: 0 auto 4px;
}

.ticket-signature-label {
  font-size: 0.95em;
}

/* Devoluciones reflejadas en el ticket */
.ticket-item-devuelto .ticket-item-name,
.ticket-item-devuelto .col-right {
  text-decoration: line-through;
}

.ticket-item-devolucion td {
  font-size: 0.95em;
  font-weight: 700;
  padding-top: 0;
}

.ticket-section-title {
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.5px;
  margin: 2px 0 4px;
}

.ticket-devolucion-items {
  font-size: 0.95em;
  margin: 0 0 4px 8px;
}

.ticket-estado-banner {
  text-align: center;
  font-weight: 800;
  margin-bottom: 4px;
}
