body {
  font-family: "DejaVu Sans", Helvetica, Arial, sans-serif;
}

.page {
  padding: 20px;
}

.page img {
  max-width: 100%;
  height: auto;
}

.page td img {
  max-width: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-family: DejaVu Sans, sans-serif;
  font-size: 13px;
  margin: 20px 0;
}

thead {
  background-color: #f0f0f0;
}

th, td {
  border: 1px solid #dddddd;
  padding: 6px 8px;
  word-wrap: break-word;
  vertical-align: middle;
}

th {
  font-weight: bold;
  text-align: left;
}

td:nth-child(3),  /* Örn. Tutar sütunu sağa yaslı */
th:nth-child(3) {
  text-align: right;
}

tr:nth-child(even) {
  background-color: #fafafa;
}


/* ============================================================================ */
/* RAF ETİKETİ - 100mm x 38mm */
/* ============================================================================ */

.shelf-label {
  width: 100mm;
  height: 38mm;
  border: 0.5mm solid #000;
  background: #f4c20026;
  position: relative;
  overflow: hidden;
  page-break-inside: avoid;
  font-family: "DejaVu Sans", sans-serif;
  color: #000;
  padding: 2mm 3mm;
  box-sizing: border-box;
}

/* Arka Plan Logo */
.shelf-label .background-logo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100mm;
  height: 38mm;
  background-image: url('https://www.bpet.com.tr/tr/bpet/logo_2x.png');
  background-size: 60mm auto;
  background-repeat: no-repeat;
  background-position: center center;
  opacity: 0.08;
  z-index: 1;
}

.shelf-label .top-row,
.shelf-label .middle-row,
.shelf-label .bottom-row {
  position: relative;
  z-index: 2;
}

/* ============================================================================ */
/* ÜST SATIR: Logo + Fiyat */
/* ============================================================================ */

.shelf-label .top-row {
  height: 11mm;
  margin-bottom: 1mm;
  position: relative;
}

.shelf-label .logo-area {
  position: absolute;
  left: 0;
  top: 0;
  width: 45mm;
}

.shelf-label .logo-area img {
  height: 10mm;
  width: auto;
  max-width: 45mm;
  display: block;
}

.shelf-label .price-area {
  position: absolute;
  right: 0;
  top: 0;
  text-align: right;
  white-space: nowrap;
}

.shelf-label .price-symbol {
  font-size: 6mm;
  font-weight: 600;
  color: #000;
  display: inline-block;
  vertical-align: top;
  margin-top: 0.5mm;
  margin-right: 1mm;
}

.shelf-label .price-value {
  font-size: 12mm;
  font-weight: 900;
  color: #000;
  line-height: 1;
  letter-spacing: -0.5mm;
  display: inline-block;
  vertical-align: top;
}

/* ============================================================================ */
/* ORTA SATIR: Ürün Bilgisi - TAŞMA ÖNLENDİ */
/* ============================================================================ */

.shelf-label .middle-row {
  height: 13mm;
  margin-bottom: 1mm;
  overflow: hidden;
}

.shelf-label .product-name {
  font-size: 4mm;
  font-weight: 700;
  line-height: 1.2;
  color: #000;
  margin: 0 0 0.5mm 0;
  padding: 0;
  
  /* TAŞMA KONTROLÜ - Maksimum 2 satır */
  display: block;
  max-height: 9.6mm; /* 4mm * 1.2 line-height * 2 satır */
  overflow: hidden;
  word-wrap: break-word;
  word-break: break-word;
}

.shelf-label .product-brand {
  font-size: 3mm;
  font-weight: 600;
  color: #1a73e8;
  text-transform: uppercase;
  letter-spacing: 0.2mm;
  margin: 0.3mm 0;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.shelf-label .product-description {
  font-size: 2.8mm;
  color: #444;
  margin: 0.3mm 0 0 0;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ============================================================================ */
/* ALT SATIR: Barkod */
/* ============================================================================ */

.shelf-label .bottom-row {
  height: 11mm;
  text-align: right;
}

.shelf-label .barcode-img {
  height: 11mm;
  width: auto;
  max-width: 50mm;
  display: inline-block;
  vertical-align: bottom;
}

/* ============================================================================ */
/* YAZDIRMA - YAN YANA DÜZENİ */
/* ============================================================================ */

@page {
  size: A4 portrait;
  margin: 4mm 5mm;
}

@media print {
  body {
    margin: 0;
    padding: 0;
  }
  
  .shelf-label {
    page-break-inside: avoid;
    float: left;
    margin-right: 3mm;
    margin-bottom: 3mm;
  }
  
  /* Her 2 etikette satır sonu */
  .shelf-label:nth-child(2n) {
    margin-right: 0;
  }
  
  /* Her 14 etikette yeni sayfa (7 satır x 2 sütun) */
  .shelf-label:nth-child(14n) {
    page-break-after: always;
  }
  
  .shelf-label .background-logo {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}