/* Invoice Print & High-Fidelity Preview Stylesheet (German Rechnungen) - Modern Blue & Black */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Open+Sans:ital,wght@0,400;0,600;0,700;1,400&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1e293b;
  background-color: #0f172a;
  line-height: 1.45;
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
}

.print-toolbar {
  max-width: 800px;
  margin: 20px auto;
  padding: 14px 24px;
  background: #1e293b;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  border: 1px solid #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-print {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transition: all 0.2s;
}

.btn-print:hover {
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
  transform: translateY(-1px);
}

.btn-close {
  background: #334155;
  color: #f8fafc;
  border: 1px solid #475569;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-close:hover {
  background: #475569;
  color: #ffffff;
}

/* Printable A4 Page Container */
.invoice-page {
  width: 210mm;
  min-height: 297mm;
  padding: 24mm 24mm 22mm 24mm;
  margin: 0 auto 30px auto;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  position: relative;
  display: flex;
  flex-direction: column;
  color: #1e293b;
}

/* 1. Header */
.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
}

.invoice-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.seller-info p {
  margin: 2px 0;
  color: #334155;
  font-size: 13.5px;
}

.seller-name {
  font-weight: 700;
  color: #0f172a !important;
  font-size: 15px !important;
}

.seller-company {
  font-weight: 600;
  color: #2563eb !important;
}

.seller-contact {
  margin-top: 8px !important;
  font-size: 12.5px !important;
  color: #64748b !important;
}

.invoice-meta {
  text-align: right;
}

.invoice-num {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.invoice-date {
  font-size: 13.5px;
  font-weight: 600;
  color: #475569;
}

/* Divider line */
.header-divider {
  width: 100%;
  height: 2px;
  background-color: #0f172a;
  margin-bottom: 34px;
}

/* 2. Recipient Box with Modern Blue / Black Accent */
.recipient-box {
  border-left: 4.5px solid #2563eb;
  padding-left: 14px;
  margin-bottom: 34px;
  background-color: #f8fafc;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
}

body.theme-black .recipient-box {
  border-left-color: #0f172a;
}

body.theme-blue .recipient-box {
  border-left-color: #2563eb;
}

.recipient-label {
  font-weight: 700;
  font-size: 13px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.recipient-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.recipient-address {
  font-size: 13.5px;
  color: #334155;
  line-height: 1.45;
}

/* 3. Salutation */
.salutation-text {
  font-size: 14px;
  color: #1e293b;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* Optional notes box */
.invoice-notes-box {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #334155;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* 4. Table */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 26px;
}

.invoice-table thead tr {
  background-color: #0f172a;
  color: #ffffff;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.invoice-table th {
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.invoice-table th.col-desc {
  text-align: left;
}

.invoice-table th.col-amount {
  text-align: right;
  width: 140px;
}

.invoice-table td {
  padding: 14px 16px;
  font-size: 13.5px;
  color: #1e293b;
  border-bottom: 1px solid #e2e8f0;
}

.invoice-table tbody tr:nth-child(even) {
  background-color: #f8fafc;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.invoice-table td.desc {
  text-align: left;
}

.invoice-table td.amount {
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

/* 5. Total Sum */
.total-section {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  margin-bottom: 45px;
  padding-right: 16px;
}

.total-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #475569;
}

.total-amount {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  background: #f1f5f9;
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
}

/* 6. Footer (Legal & Bank Details) */
.invoice-footer {
  margin-top: auto;
  text-align: center;
  font-size: 11px;
  color: #64748b;
  line-height: 1.6;
  padding-top: 24px;
  border-top: 1px solid #e2e8f0;
}

.invoice-footer p {
  margin: 3px 0;
}

.footer-thanks {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
}

.footer-terms {
  margin-bottom: 8px !important;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
  color: #334155;
}

.footer-tax {
  margin-top: 6px !important;
  font-weight: 600;
  color: #475569;
}

.footer-tax-id {
  font-weight: 600;
  color: #1e293b;
}

.footer-bank {
  margin-top: 4px !important;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.3px;
}

.footer-custom {
  margin-top: 6px !important;
  font-style: italic;
}

/* Print Setup for Physical Printers / PDF */
@media print {
  body {
    background: transparent !important;
    color: #000000 !important;
  }

  .no-print, .print-toolbar {
    display: none !important;
  }

  .invoice-page {
    width: 100% !important;
    min-height: 100% !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  @page {
    size: A4;
    margin: 18mm 18mm 18mm 18mm;
  }

  .invoice-table thead tr {
    background-color: #0f172a !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .invoice-table th {
    color: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .recipient-box {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.theme-blue .recipient-box {
    border-left: 4.5px solid #2563eb !important;
  }

  body.theme-black .recipient-box {
    border-left: 4.5px solid #0f172a !important;
  }
}
