/* ============================================================
   Tiskalnica Portal — Proforma (Predračun) generator
   Full-screen preview overlay + print-quality A4 sheet
   ============================================================ */

/* ---- Overlay + toolbar ---- */
.pf-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(16, 21, 33, 0.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; flex-direction: column;
  opacity: 1;
}

.pf-toolbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 13px 20px;
  background: rgba(22, 27, 36, 0.92);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #e9ecf3;
}
.pf-tb-back {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.05);
  color: #e9ecf3; font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 13px; border-radius: 8px; transition: all .12s;
}
.pf-tb-back:hover { background: rgba(255, 255, 255, 0.12); }
.pf-tb-title { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.pf-tb-title .t { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.pf-tb-title .s { font-size: 11.5px; color: #9aa4ba; font-family: 'JetBrains Mono', monospace; }
.pf-tb-spacer { flex: 1 1 auto; }
.pf-tb-acts { display: flex; align-items: center; gap: 9px; }
.pf-tb-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.05); color: #e9ecf3;
  transition: all .12s;
}
.pf-tb-btn:hover { background: rgba(255, 255, 255, 0.12); }
.pf-tb-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.pf-tb-btn.primary:hover { background: var(--accent-600); }
.pf-tb-done {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; padding: 7px 13px; border-radius: 8px;
  background: rgba(47, 158, 107, 0.18); color: #6fe0a8; border: 1px solid rgba(47, 158, 107, 0.4);
}
.pf-tb-status {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.08); color: #c4cbd8; border: 1px solid rgba(255, 255, 255, 0.16);
}

/* ---- Scroll stage ---- */
.pf-scroll {
  flex: 1 1 auto; overflow-y: auto; min-height: 0;
  padding: 30px 24px 56px;
  display: flex; justify-content: center; align-items: flex-start;
}
.pf-sheet-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pf-created-banner {
  width: 210mm; max-width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px;
  background: rgba(47, 158, 107, 0.16); border: 1px solid rgba(47, 158, 107, 0.4); color: #d6f3e3;
  font-size: 13px; line-height: 1.45;
}
.pf-created-banner svg { flex: 0 0 auto; color: #6fe0a8; }
.pf-created-banner b { color: #fff; font-weight: 700; }

/* ---- Convert-to-order readiness panel (alternate CTA pattern) ---- */
.pf-order-panel {
  width: 210mm; max-width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 16px 20px; border-radius: 12px;
  background: #fff; border: 1px solid var(--accent-soft-2, #fbd6c9);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
}
.por-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: #1e2433; margin-bottom: 10px;
}
.por-title svg { color: var(--accent-700, #c8472a); }
.por-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.por-check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; }
.por-check .por-ic { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 999px; flex: 0 0 auto; }
.por-check.ok { color: #2f7a55; }
.por-check.ok .por-ic { background: rgba(47, 158, 107, 0.16); color: #2f9e6b; }
.por-check.no { color: #b0563f; }
.por-check.no .por-ic { background: rgba(217, 83, 79, 0.14); color: #d9534f; }
.pf-order-panel .por-cta { flex: 0 0 auto; font-size: 13.5px; padding: 10px 18px; }

/* ---- A4 sheet ---- */
.pf-sheet {
  width: 210mm; min-height: 297mm; flex: 0 0 auto;
  background: #fff; color: #1a2030;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  padding: 16mm 15mm 14mm;
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  display: flex; flex-direction: column;
}
@media (prefers-reduced-motion: reduce) { .pf-sheet { animation: none; } }

/* mono numerals everywhere on the sheet */
.pf-sheet .m { font-family: 'JetBrains Mono', monospace; font-feature-settings: 'tnum'; }

/* ---- Header ---- */
.pf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; }
.pf-head-l { min-width: 0; }
.pf-logo { height: 30px; width: auto; display: block; margin-bottom: 14px; }
.pf-seller .nm { font-size: 14px; font-weight: 800; letter-spacing: -.01em; color: #1a2030; }
.pf-seller .ln { font-size: 11.5px; color: #5b6475; line-height: 1.55; margin-top: 3px; }
.pf-seller .ln b { color: #44506a; font-weight: 600; }

.pf-head-r { text-align: right; flex: 0 0 auto; }
.pf-doc-type { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: #1a2030; line-height: 1; }
.pf-doc-sub { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-700, #c8472a); margin-top: 5px; }
.pf-meta { margin-top: 16px; display: inline-grid; grid-template-columns: auto auto; gap: 5px 16px; text-align: right; }
.pf-meta .k { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #9aa4ba; align-self: center; white-space: nowrap; }
.pf-meta .v { font-size: 12.5px; font-weight: 700; color: #1a2030; }

.pf-rule { height: 3px; background: var(--accent, #f2683f); border-radius: 3px; margin: 18px 0 0; }

/* ---- Parties ---- */
.pf-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
.pf-party { border: 1px solid #e7eaf0; border-radius: 10px; padding: 14px 16px; }
.pf-party.ship { border-color: var(--accent-soft-2, #fbd6c9); background: #fffaf7; }
.pf-party-lbl { display: flex; align-items: center; gap: 7px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #9aa4ba; margin-bottom: 9px; }
.pf-party.ship .pf-party-lbl { color: var(--accent-700, #c8472a); }
.pf-party .co { font-size: 15px; font-weight: 800; color: #1a2030; letter-spacing: -.01em; }
.pf-party .attn { font-size: 12px; color: #6b7790; margin-top: 1px; }
.pf-party .addr { font-size: 12.5px; color: #44506a; line-height: 1.55; margin-top: 7px; }
.pf-party .vat { font-size: 11.5px; color: #6b7790; margin-top: 8px; }
.pf-party .vat b { color: #1a2030; font-weight: 700; font-family: 'JetBrains Mono', monospace; }

/* ---- Items table ---- */
.pf-items { width: 100%; border-collapse: collapse; margin-top: 24px; }
.pf-items thead th {
  font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #9aa4ba;
  text-align: left; padding: 0 10px 8px; border-bottom: 1.5px solid #1a2030;
}
.pf-items th.num, .pf-items td.num { text-align: right; }
.pf-items th.c, .pf-items td.c { text-align: center; }
.pf-items tbody td { padding: 11px 10px; border-bottom: 1px solid #eef1f5; vertical-align: top; font-size: 12.5px; color: #44506a; }
.pf-items tbody tr:last-child td { border-bottom: 1px solid #e7eaf0; }
.pf-idx { color: #9aa4ba; font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; }
.pf-it-name { font-size: 13px; font-weight: 700; color: #1a2030; letter-spacing: -.005em; }
.pf-it-sub { font-size: 10.5px; color: #8a93a6; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.pf-it-sub .tech { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; white-space: nowrap; }
.pf-it-sub > span { white-space: nowrap; }
.pf-it-sub .tech .dot { width: 6px; height: 6px; border-radius: 50%; }
.pf-it-sub .sku { font-family: 'JetBrains Mono', monospace; }
.pf-items td.num { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: #44506a; white-space: nowrap; }
.pf-items td.qty { font-weight: 700; color: #1a2030; }
.pf-items td.amt { font-weight: 700; color: #1a2030; }
.pf-disc { color: var(--accent-700, #c8472a); font-weight: 700; }
.pf-disc.none { color: #c2c9d6; font-weight: 500; }

/* ---- Totals + payment ---- */
.pf-summary { display: grid; grid-template-columns: 1fr 300px; gap: 30px; margin-top: 22px; align-items: start; }

.pf-pay-lbl { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #9aa4ba; margin-bottom: 10px; }
.pf-pay-card { display: flex; align-items: stretch; gap: 16px; }
.pf-qr {
  flex: 0 0 auto; background: #fff; padding: 5px; border: 1px solid #e7eaf0; border-radius: 8px;
}
.pf-qr svg { width: 100%; height: 100%; display: block; }
.pf-qr-fallback { display: grid; place-items: center; font-size: 10px; font-weight: 700; letter-spacing: .1em; color: #c2c9d6; }
.pf-pay-lean { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.pf-pay-line { display: flex; align-items: baseline; gap: 10px; }
.pf-pay-line .k { flex: 0 0 62px; font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: #9aa4ba; }
.pf-pay-line .v { font-size: 12px; font-weight: 700; color: #1a2030; font-family: 'JetBrains Mono', monospace; }
.pf-pay-scan { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 10.5px; color: #8a93a6; }
.pf-pay-scan svg { flex: 0 0 auto; color: var(--accent, #f2683f); }
.pf-pay-note {
  margin-top: 14px; font-size: 10px; line-height: 1.5; color: #9aa4ba;
  border-left: 2px solid var(--accent-soft-2, #fbd6c9); padding-left: 11px;
}

.pf-totals { border: 1px solid #e7eaf0; border-radius: 11px; overflow: hidden; }
.pf-trow { display: flex; align-items: center; justify-content: space-between; padding: 9px 16px; font-size: 12.5px; }
.pf-trow .l { color: #6b7790; font-weight: 600; white-space: nowrap; }
.pf-trow .v { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: #1a2030; }
.pf-trow .v.disc { color: var(--accent-700, #c8472a); }
.pf-trow + .pf-trow { border-top: 1px solid #f1f3f7; }
.pf-trow.grand { background: #1a2030; padding: 14px 16px; border-top: none; }
.pf-trow.grand .l { color: #c4cbd8; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.pf-trow.grand .v { color: #fff; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }

/* ---- Bottom note + signature ---- */
.pf-bottom { margin-top: auto; padding-top: 26px; }
.pf-legal { font-size: 10px; color: #9aa4ba; line-height: 1.6; max-width: 62%; }
.pf-sign { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 24px; }
.pf-thanks { font-size: 12.5px; color: #6b7790; }
.pf-thanks b { color: var(--accent-700, #c8472a); }
.pf-sign-box { text-align: center; }
.pf-sign-line { width: 180px; border-top: 1px solid #c2c9d6; padding-top: 6px; font-size: 10.5px; color: #9aa4ba; }

/* ============================================================
   PRINT — isolate the sheet, A4, no chrome
   ============================================================ */
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; }
  body > #root { display: none !important; }
  .pf-overlay {
    position: static !important; inset: auto !important;
    background: #fff !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    display: block !important; animation: none !important;
  }
  .pf-toolbar { display: none !important; }
  .pf-created-banner { display: none !important; }
  .pf-order-panel { display: none !important; }
  .pf-scroll { overflow: visible !important; padding: 0 !important; display: block !important; }
  .pf-sheet-wrap { display: block !important; gap: 0 !important; }
  .pf-sheet {
    width: 100% !important; min-height: auto !important;
    box-shadow: none !important; margin: 0 !important; animation: none !important;
    padding: 14mm 14mm 12mm !important;
  }
  .pf-trow.grand { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
