/* ZeyPam — teklif belgesi (A4).
   Hem ekrandaki önizleme hem de yazdırma/PDF çıktısı bu dosyayı kullanır.
   Ölçüler mm cinsindendir; A4 = 210 × 297 mm, kenar boşluğu 18 mm. */

.preview-bg { background: #dfe4e9; padding: 26px; overflow: auto }

.page {
  width: 210mm;
  min-height: 297mm;
  background: #fff;
  margin: 0 auto 20px;
  padding: 18mm;
  box-shadow: 0 5px 24px rgba(0, 0, 0, .18);
  position: relative;
  overflow: hidden;
  color: #14263d;
}

.page-logo { max-width: 46mm; max-height: 18mm; object-fit: contain }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 2px solid var(--navy, #12263f);
  padding-bottom: 8mm;
}

.page-content { padding-top: 16mm; line-height: 1.65 }
.page-content h2 { font-size: 28px }

.doc-footer {
  position: absolute; bottom: 10mm; left: 18mm; right: 18mm;
  display: flex; justify-content: space-between;
  border-top: 1px solid #dde3e8; padding-top: 4mm;
  color: #788697; font-size: 10px;
}

/* ---------- Kapak ---------- */

.cover {
  display: flex; flex-direction: column;
  background: var(--navy, #12263f); color: #fff;
  font-family: "Montserrat", "Nunito", Arial, sans-serif;
  line-height: 1.8;
  text-align: left;
}
.cover * { font-family: inherit }

.cover:after {
  content: "";
  position: absolute; width: 145mm; height: 145mm;
  border: 28mm solid rgba(255, 210, 31, .1);
  border-radius: 50%;
  right: -85mm; bottom: -70mm;
}

.cover-body { margin: auto 0; max-width: 135mm; z-index: 1 }

.cover h1 {
  font-size: 38px;
  line-height: 1.45;
  margin: 0 0 7mm;
  white-space: pre-line;   /* kapak başlığında satır sonlarına izin ver */
  text-transform: none;
}
.cover p { line-height: 1.95; margin: 5mm 0 }
.cover .eyebrow {
  color: var(--yellow, #ffd21f);
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1.7;
  margin-bottom: 4mm;
}
.cover .meta {
  margin-top: 8mm;
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  color: #d7e0e8; line-height: 1.75;
}
.cover .meta div { padding: 2mm 0 }

.cover-hero {
  display: block;
  width: 100%;
  max-width: 174mm;
  max-height: 112mm;
  min-height: 72mm;
  object-fit: contain;
  margin: 3mm auto;
}

.cover-image-empty {
  height: 60mm;
  display: grid; place-items: center;
  color: #8390a0;
  border: 1px dashed #ccd5df; border-radius: 12px;
  margin: 8mm 0;
}

/* Kapak temaları. --cover-accent teklif bazında satır içi atanır. */

.cover.theme-dark { background: var(--navy, #12263f); color: #fff }

.cover.theme-yellow { background: #ffd21f; color: #12263f }
.cover.theme-yellow:after { border-color: rgba(18, 38, 63, .08) }
.cover.theme-yellow .eyebrow { color: #12263f }
.cover.theme-yellow .meta { color: #223c58 }

.cover.theme-classic { background: #fff; color: #172333; text-align: center }
.cover.theme-classic:after { display: none }
.cover.theme-classic .cover-body { margin: 3mm auto 0; max-width: 160mm; width: 100% }
.cover.theme-classic .eyebrow { color: var(--cover-accent, #1769aa) }
.cover.theme-classic h1 { color: var(--cover-accent, #1769aa); font-size: 34px }
.cover.theme-classic .meta {
  color: #4e6073; text-align: left;
  border-top: 2px solid var(--cover-accent, #1769aa);
  padding-top: 7mm;
}

/* Klasik dışı temalarda kapak görseli yoksa boş kutu gösterme */
.cover.theme-dark .cover-image-empty,
.cover.theme-yellow .cover-image-empty { display: none }

/* ---------- Fiyat tablosu ---------- */

.offer-table { font-size: 11px; margin-top: 12mm; border-collapse: collapse; width: 100% }
.offer-table th, .offer-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #e7ebef;
  text-align: left; vertical-align: middle;
}
.offer-table th {
  background: var(--navy, #12263f); color: #fff;
  text-transform: none; letter-spacing: 0;
  font-size: 11px;
}
/* "Tekilleştirilmiş" gösterimde birleştirilen hücreler */
.offer-table td.merged {
  vertical-align: middle; text-align: center;
  font-weight: 800; background: #f3f6f8;
}

.page .totals { margin-left: auto; max-width: 430px }
.page .total-row { display: flex; justify-content: space-between; padding: 9px 0 }
.page .total-row.grand { font-size: 20px; font-weight: 800; border-top: 2px solid #14263d }

.validity-box {
  margin-top: 25mm; padding: 10mm;
  background: #f4f7f9; border-left: 4px solid var(--yellow, #ffd21f);
}

/* İkinci sayfanın altındaki sertifika logoları */
.certificate-strip {
  position: absolute; left: 18mm; right: 18mm; bottom: 27mm;
  display: flex; align-items: center; justify-content: center; gap: 8mm;
  border-top: 1px solid #e1e7ec; padding-top: 5mm;
}
.certificate-logo { width: 25mm; height: 15mm; object-fit: contain }

/* ---------- Yazdırma ---------- */

@page { size: A4; margin: 0 }

@media print {
  html, body { width: 210mm; margin: 0 !important; padding: 0 !important; background: #fff }

  #printArea { display: block !important }

  .preview-bg { margin: 0 !important; padding: 0 !important; background: #fff }

  .page {
    width: 210mm !important;
    /* 297 yerine 296: bazı tarayıcılar tam yükseklikte fazladan boş
       sayfa üretiyor. */
    height: 296mm !important;
    min-height: 296mm !important;
    max-height: 296mm !important;
    margin: 0 !important;
    padding: 18mm !important;
    box-shadow: none !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    break-after: page !important;
    page-break-after: always !important;
  }
  .page:last-child {
    break-after: auto !important;
    page-break-after: auto !important;
  }

  /* Arka plan renkleri (kapak, tablo başlıkları) yazdırmada korunsun */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important }
}
