/**
 * Print Styles for Receipt Printing
 * Optimized for 80mm thermal printers
 * Ultra-compact layout with scaling for multi-game tickets
 */

/* Receipt Container - Compact 50% size */
.receipt-ticket {
  font-family: 'Courier New', monospace;
  font-size: 5px;
  line-height: 1.0;
  color: #000;
  max-width: 80mm;
  margin: 0 auto;
}

/* Header */
.receipt-header {
  text-align: center;
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
  line-height: 1.0;
}

.receipt-header h1 {
  font-size: 6px;
  font-weight: bold;
  margin: 0;
  padding: 0;
  line-height: 1.0;
  text-transform: uppercase;
}

.receipt-header p {
  font-size: 4px;
  margin: 0;
  padding: 0;
  line-height: 1.0;
}

.receipt-header .receipt-shop-name {
  font-size: 5px;
  font-weight: bold;
  line-height: 1.0;
}

.receipt-header .receipt-date {
  font-weight: bold;
  margin: 0;
  padding: 0;
  line-height: 1.0;
}

/* Ticket Code */
.receipt-ticket-code {
  text-align: center;
  margin: 0;
  padding: 0;
  border-top: none;
  border-bottom: 1px solid #000;
  line-height: 1.0;
}

.receipt-label {
  font-size: 4px;
  font-weight: bold;
  margin: 0;
  padding: 0;
  line-height: 1.0;
}

.receipt-code {
  font-size: 8px;
  font-weight: bold;
  letter-spacing: 1px;
  margin: 0;
  padding: 0;
  line-height: 1.0;
}

/* Barcode */
.receipt-barcode {
  margin: 0;
}

.receipt-barcode-bars {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 12px;
  gap: 1px;
}

.receipt-bar {
  background: #000;
  display: inline-block;
}

.receipt-bar-1 { width: 1px; }
.receipt-bar-2 { width: 2px; }
.receipt-bar-3 { width: 3px; }
.receipt-bar-tall { height: 12px; }
.receipt-bar-short { height: 9px; }

/* Section Title */
.receipt-section-title {
  font-weight: bold;
  font-size: 4px;
  margin: 0;
  text-decoration: underline;
}

.receipt-date-group {
  font-weight: bold;
  font-size: 4px;
  text-align: center;
  background: #ddd;
  padding: 0;
  margin: 0;
  border-top: 1px solid #000;
}

/* Selections */
.receipt-selections {
  margin: 0;
}

.receipt-selection {
  display: flex;
  gap: 1px;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 1px dotted #999;
}

.receipt-selection:last-child {
  border-bottom: none;
}

.receipt-selection-number {
  font-weight: bold;
  min-width: 5px;
  font-size: 4px;
}

.receipt-selection-details {
  flex: 1;
}

.receipt-match {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: 4px;
  margin-bottom: 0;
}

.receipt-match-time {
  font-weight: bold;
  font-size: 4px;
  margin-left: 2px;
}

.receipt-market {
  font-size: 4px;
  margin-bottom: 0;
}

.receipt-odds {
  font-weight: bold;
  font-size: 4px;
}

/* Summary */
.receipt-summary {
  margin: 0;
  padding: 0;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
}

.receipt-summary-row {
  display: flex;
  justify-content: space-between;
  margin: 0;
  font-size: 4px;
}

.receipt-summary-total {
  font-weight: bold;
  font-size: 5px;
  margin-top: 0;
  padding-top: 0;
  border-top: 1px solid #000;
}

/* Payout Header */
.receipt-payout-header {
  text-align: center;
  margin: 0;
}

.receipt-payout-header h2 {
  font-size: 6px;
  font-weight: bold;
  border: 1px solid #000;
  padding: 0;
}

/* Payout Summary */
.receipt-payout-summary {
  margin: 0;
}

.receipt-status-won {
  font-weight: bold;
  text-decoration: underline;
}

/* Payout Amount */
.receipt-payout-amount {
  text-align: center;
  margin: 1px 0;
  padding: 0;
  border: 2px double #000;
}

.receipt-payout-amount .receipt-label {
  font-size: 4px;
  font-weight: bold;
  margin-bottom: 0;
}

.receipt-amount {
  font-size: 9px;
  font-weight: bold;
}

/* Signature */
.receipt-signature {
  margin: 1px 0;
}

.receipt-signature p {
  margin: 0;
  font-size: 4px;
}

.receipt-signature-line {
  border-bottom: 1px solid #000;
  margin: 0;
  height: 5px;
}

.receipt-date-line {
  margin-top: 0;
}

/* Footer */
.receipt-footer {
  text-align: center;
  margin-top: 0;
  padding-top: 0;
  border-top: 1px dashed #000;
  font-size: 4px;
}

.receipt-footer p {
  margin: 0;
}

.receipt-footer-small {
  font-size: 3px;
  color: #666;
}

/* ========================================
   Multi-Game Scaling
   Ticket shrinks further with more games
   ======================================== */

/* 4-6 games: slightly smaller */
.receipt-ticket.games-4-6 {
  font-size: 4px;
  line-height: 0.95;
}
.receipt-ticket.games-4-6 .receipt-header h1 { font-size: 5px; }
.receipt-ticket.games-4-6 .receipt-code { font-size: 7px; }
.receipt-ticket.games-4-6 .receipt-amount { font-size: 8px; }
.receipt-ticket.games-4-6 .receipt-selection { margin-bottom: 0; padding-bottom: 0; }
.receipt-ticket.games-4-6 .receipt-match { font-size: 4px; }
.receipt-ticket.games-4-6 .receipt-match-time { font-size: 4px; }
.receipt-ticket.games-4-6 .receipt-date-group { font-size: 3px; }
.receipt-ticket.games-4-6 .receipt-market { font-size: 3px; }
.receipt-ticket.games-4-6 .receipt-barcode-bars { height: 9px; }
.receipt-ticket.games-4-6 .receipt-bar-tall { height: 9px; }
.receipt-ticket.games-4-6 .receipt-bar-short { height: 6px; }

/* 7-10 games: smaller */
.receipt-ticket.games-7-10 {
  font-size: 4px;
  line-height: 0.9;
}
.receipt-ticket.games-7-10 .receipt-header h1 { font-size: 5px; }
.receipt-ticket.games-7-10 .receipt-header p { font-size: 3px; }
.receipt-ticket.games-7-10 .receipt-code { font-size: 6px; letter-spacing: 1px; }
.receipt-ticket.games-7-10 .receipt-amount { font-size: 7px; }
.receipt-ticket.games-7-10 .receipt-selection { margin-bottom: 0; padding-bottom: 0; gap: 0; }
.receipt-ticket.games-7-10 .receipt-match { font-size: 3px; }
.receipt-ticket.games-7-10 .receipt-match-time { font-size: 3px; }
.receipt-ticket.games-7-10 .receipt-date-group { font-size: 3px; }
.receipt-ticket.games-7-10 .receipt-market { font-size: 3px; }
.receipt-ticket.games-7-10 .receipt-odds { font-size: 3px; }
.receipt-ticket.games-7-10 .receipt-summary-row { font-size: 3px; }
.receipt-ticket.games-7-10 .receipt-summary-total { font-size: 4px; }
.receipt-ticket.games-7-10 .receipt-barcode-bars { height: 7px; }
.receipt-ticket.games-7-10 .receipt-bar-tall { height: 7px; }
.receipt-ticket.games-7-10 .receipt-bar-short { height: 5px; }

/* 11+ games: smallest */
.receipt-ticket.games-11-plus {
  font-size: 3px;
  line-height: 0.9;
}
.receipt-ticket.games-11-plus .receipt-header { padding-bottom: 0; margin-bottom: 0; }
.receipt-ticket.games-11-plus .receipt-header h1 { font-size: 5px; margin-bottom: 0; }
.receipt-ticket.games-11-plus .receipt-header p { font-size: 3px; margin: 0; }
.receipt-ticket.games-11-plus .receipt-ticket-code { margin: 0; padding: 0; }
.receipt-ticket.games-11-plus .receipt-label { font-size: 3px; }
.receipt-ticket.games-11-plus .receipt-code { font-size: 5px; letter-spacing: 1px; margin: 0; }
.receipt-ticket.games-11-plus .receipt-amount { font-size: 6px; }
.receipt-ticket.games-11-plus .receipt-selection { margin-bottom: 0; padding-bottom: 0; gap: 0; }
.receipt-ticket.games-11-plus .receipt-selection-number { min-width: 4px; font-size: 3px; }
.receipt-ticket.games-11-plus .receipt-match { font-size: 3px; }
.receipt-ticket.games-11-plus .receipt-match-time { font-size: 3px; }
.receipt-ticket.games-11-plus .receipt-date-group { font-size: 2px; }
.receipt-ticket.games-11-plus .receipt-market { font-size: 2px; }
.receipt-ticket.games-11-plus .receipt-odds { font-size: 3px; }
.receipt-ticket.games-11-plus .receipt-summary { margin: 0; padding: 0; }
.receipt-ticket.games-11-plus .receipt-summary-row { font-size: 3px; margin: 0; }
.receipt-ticket.games-11-plus .receipt-summary-total { font-size: 4px; margin-top: 0; padding-top: 0; }
.receipt-ticket.games-11-plus .receipt-payout-amount { margin: 0; padding: 0; }
.receipt-ticket.games-11-plus .receipt-footer { margin-top: 0; padding-top: 0; font-size: 3px; }
.receipt-ticket.games-11-plus .receipt-barcode-bars { height: 5px; }
.receipt-ticket.games-11-plus .receipt-bar-tall { height: 5px; }
.receipt-ticket.games-11-plus .receipt-bar-short { height: 4px; }

/* Screen-only elements (hidden in print) */
.no-print {
  display: block;
}

/* Print Media Queries */
@media print {
  /* Hide screen-only elements */
  .no-print,
  button,
  nav,
  .sidebar,
  .controls {
    display: none !important;
  }

  /* Page setup for thermal printer */
  @page {
    size: 80mm auto;
    margin: 0;
  }

  body {
    margin: 0;
    padding: 0;
    background: none;
  }

  .receipt-ticket {
    width: 80mm;
    margin: 0;
    padding: 1mm;
  }

  /* Optimize for thermal printing */
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Remove background colors for thermal printer */
  .receipt-header,
  .receipt-summary,
  .receipt-payout-amount {
    background: none !important;
  }

  /* Ensure black text */
  .receipt-ticket {
    color: #000 !important;
  }

  /* Ensure borders are visible */
  .receipt-header,
  .receipt-ticket-code,
  .receipt-summary,
  .receipt-payout-header h2,
  .receipt-payout-amount,
  .receipt-footer {
    border-color: #000 !important;
  }

  /* Barcode optimization */
  .receipt-bar {
    background: #000 !important;
  }
}

/* Print-only styles */
@media screen {
  .print-only {
    display: none;
  }
}

@media print {
  .print-only {
    display: block;
  }
}
