/* ============================================
   Termal Fiş Yazıcı (80mm) - Baskı stilleri
   Sadece siyah-beyaz, gerçek fiş görünümü
   ============================================ */

/* Sayfa boyutu: 80mm genişlik, termal rulo uyumlu */
@page {
  size: 80mm auto;
  margin: 0;
  padding: 0;
}

/* Ekranda önizleme: 80mm genişlikte kutu */
.receipt-thermal-container {
  width: 80mm;
  min-height: 10mm;
  margin: 0 auto;
  background: #fff;
  color: #000;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.25;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* Güvenli baskı alanı: kenar boşlukları (yazıcı kesim toleransı) */
.receipt-thermal-paper {
  width: 72mm;
  max-width: 72mm;
  margin: 0 auto;
  padding: 2mm 3mm;
  box-sizing: border-box;
}

.receipt-thermal-container * {
  box-sizing: border-box;
}

/* Başlık: mağaza adı */
.receipt-store-name {
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  margin: 0 0 2px 0;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.receipt-store-details {
  text-align: center;
  font-size: 10px;
  margin: 0 0 4px 0;
  color: #000;
}

.receipt-store-details div {
  margin: 1px 0;
}

/* Ayraç */
.receipt-divider {
  border: none;
  border-top: 1px dashed #000;
  margin: 3px 0;
}

.receipt-divider-solid {
  border: none;
  border-top: 1px solid #000;
  margin: 3px 0;
}

/* Bilgi alanı: tarih, fiş no, kasa, personel */
.receipt-info-block {
  font-size: 10px;
  margin: 2px 0;
}

.receipt-info-row {
  display: flex;
  justify-content: space-between;
  margin: 1px 0;
}

.receipt-info-label {
  flex-shrink: 0;
  margin-right: 6px;
}

.receipt-info-value {
  text-align: right;
  word-break: break-all;
}

/* Ürün tablosu: hizalı kolonlar, uzun isim satır kırar */
.receipt-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  margin: 4px 0;
}

.receipt-items-table th {
  text-align: left;
  font-weight: bold;
  padding: 2px 0;
  border-bottom: 1px solid #000;
}

.receipt-items-table th.receipt-th-qty,
.receipt-items-table th.receipt-th-price,
.receipt-items-table th.receipt-th-total {
  text-align: right;
}

.receipt-items-table td {
  padding: 2px 0;
  vertical-align: top;
  border-bottom: 1px dotted #333;
}

.receipt-items-table td.receipt-td-qty,
.receipt-items-table td.receipt-td-price,
.receipt-items-table td.receipt-td-total {
  text-align: right;
  white-space: nowrap;
}

/* Ürün adı: uzun isimler satır kırar, kolonlar kaymaz */
.receipt-product-name {
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 0;
  min-width: 0;
  width: 100%;
}

.receipt-col-qty { width: 10mm; text-align: right; white-space: nowrap; }
.receipt-col-price { width: 18mm; text-align: right; white-space: nowrap; }
.receipt-col-total { width: 20mm; text-align: right; white-space: nowrap; }

/* Toplam bloğu */
.receipt-totals-block {
  margin: 4px 0;
  font-size: 11px;
}

.receipt-totals-row {
  display: flex;
  justify-content: space-between;
  margin: 2px 0;
}

.receipt-totals-row.grand-total {
  font-weight: bold;
  font-size: 12px;
  margin-top: 4px;
  padding-top: 3px;
  border-top: 1px solid #000;
}

.receipt-payment-row {
  margin: 2px 0;
  font-size: 10px;
}

.receipt-change-row {
  font-weight: bold;
  margin-top: 2px;
}

/* Alt bilgi */
.receipt-footer {
  text-align: center;
  font-size: 10px;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px dashed #000;
}

.receipt-thank-you {
  margin: 4px 0;
}

.receipt-note {
  margin: 2px 0;
  word-break: break-word;
}

/* Cari hareket fişi: alt alta blok (tablo yok) */
.receipt-cari-block {
  margin: 4px 0;
  font-size: 10px;
}
.receipt-cari-block .receipt-info-row {
  margin: 1px 0;
}
.receipt-cari-aciklama {
  margin-top: 4px;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}
.receipt-cari-empty {
  text-align: center;
  color: #000;
  font-size: 10px;
  padding: 8px 0;
}

/* Eski cari tablo stilleri (referans) */
.receipt-cari-table { font-size: 9px; }
.receipt-cari-table th { padding: 1px 0; }
.receipt-cari-table td { padding: 1px 0; vertical-align: top; }
.receipt-cari-date { width: 16mm; white-space: nowrap; }
.receipt-cari-table th:nth-child(2),
.receipt-cari-table td:nth-child(2) { width: 20mm; max-width: 20mm; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-cari-table th:nth-child(4),
.receipt-cari-table td:nth-child(4) { width: 18mm; text-align: right !important; white-space: nowrap; }
.receipt-cari-table td:nth-child(3),
.receipt-cari-table td:nth-child(5) { word-break: break-word; overflow-wrap: break-word; max-width: 0; }
.receipt-aciklama-cell { word-break: keep-all; }
.receipt-fis-no-nowrap { white-space: nowrap; }
.receipt-empty-row { text-align: center; color: #000; font-size: 10px; padding: 6px 0; }

/* Yazdırma: sadece fiş alanı, gereksiz boşluk yok (visibility ile; display:none kullanılmaz ki fiş görünsün) */
@media print {
  .no-print,
  nav,
  .navbar,
  .sidebar,
  .modern-topbar,
  .receipt-print-ignore,
  header:not(.receipt-thermal-container) {
    display: none !important;
  }

  body * {
    visibility: hidden !important;
  }

  .receipt-thermal-container,
  .receipt-thermal-container * {
    visibility: visible !important;
  }

  .receipt-thermal-container {
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 80mm !important;
    min-width: 80mm !important;
    max-width: 80mm !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .receipt-thermal-paper {
    width: 72mm !important;
    max-width: 72mm !important;
    margin: 0 auto !important;
    padding: 2mm 3mm !important;
  }

  @page {
    size: 80mm auto;
    margin: 0;
    padding: 0;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 80mm !important;
    min-height: auto !important;
    background: #fff !important;
  }
}
