/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Leaflet zoom controls: 25% smaller than default */
.leaflet-control-zoom a {
  width: 22px !important;
  height: 22px !important;
  line-height: 22px !important;
  font-size: 14px !important;
}

/*
 * Print-view (invoice/credit note/estimate) styling for in-app display —
 * mirrored from app/views/shared/invoice_css/invoice_theme.css (the source
 * for the standalone print/PDF render); apply changes there here too.
 * Everything scoped under .print-view-container — prevents bleed into other pages.
 * Not via an inline <style> in the partial: CSP nonces no longer match after
 * a Turbo navigation, which left an invoice's first render unstyled until a
 * full reload.
 * Fonts (Inter/Outfit) are already loaded by the app layout; @font-face is
 * only needed in the standalone print layout.
 */
.print-view-container {
  #invoice img { max-width: none; height: auto; }

  #invoice p, #invoice h2, #invoice h3 { margin: 0; }
  #invoice {
    /* Brand colours as custom properties; InvoicePalette overrides them per
       business profile through the stylesheet this preview links to. These
       are the Defrog profile and apply to a document without one. */
    --invoice-ink: #16414d;
    --invoice-accent: #d97645;
    --tint-surface: #eef3f4;
    --tint-border: #9daeb3;
    --tint-ink: #5b767d;
    font-family: "Inter", Helvetica, Arial, sans-serif;
    color: #1f2937;
    font-size: 9.5pt;
    line-height: 1.45;
    padding: 0.75cm;
    /* A4 width: in a narrower card the whole sheet scrolls horizontally
       instead of just the table overflowing. */
    min-width: 21cm;
  }
  #invoice h2, #invoice h3 {
    font-family: "Outfit", "Inter", Helvetica, Arial, sans-serif;
    color: var(--invoice-ink);
    line-height: 1.2;
  }
  #invoice .amount { font-variant-numeric: tabular-nums; white-space: nowrap; }

  #invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 0.2cm;
  }
  /* .logo has no size rule on purpose: it comes from the width attribute
     (BusinessProfile#logo_width), and a max-width/max-height here would beat
     it and silently cap the setting. */
  #company-address { text-align: right; font-size: 8.5pt; color: #6b7280; line-height: 1.5; }
  #company-address h2 { font-size: 11pt; font-weight: 700; margin-bottom: 2px; }
  #company-address .adr { margin-bottom: 0.4em; }

  #invoice-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin: 0.5cm 0 0.9cm 0;
  }
  #client-details { font-size: 10pt; line-height: 1.5; align-self: flex-end; }
  #client-details .org { font-size: 10.5pt; font-weight: 700; margin-bottom: 1px; }
  #client-details #your-tax-number,
  #client-details #place-of-supply { margin-top: 0.4em; font-size: 8.5pt; color: #6b7280; }

  #invoice-info { text-align: right; }
  #invoice-info .doc-type {
    font-size: 11pt;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--invoice-accent);
    margin-right: 4px;
  }
  #invoice-info h2 {
    font-size: 24pt;
    font-weight: 700;
    margin: 0 0 6px 0;
  }
  #invoice-info .doc-project { font-size: 10pt; font-weight: 600; color: #1f2937; margin-bottom: 6px; }
  #invoice-info .meta-line { font-size: 9pt; color: #6b7280; }
  #invoice-info .meta-line strong { color: #1f2937; font-weight: 600; }

  #invoice table { border-collapse: collapse; width: 100%; }
  #invoice-amount th {
    font-family: "Inter", Helvetica, Arial, sans-serif;
    font-size: 7.5pt;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    text-align: left;
    padding: 0 8px 6px 8px;
    border-bottom: 1.5px solid var(--invoice-ink);
  }
  /* Add icon in the column header the same size as the row icons: the
     th text is smaller (7.5pt) and lucide icons follow the text size */
  #invoice-amount th.actions_th { font-size: 9.5pt; letter-spacing: 0; text-align: right; }
  #invoice-amount td {
    padding: 7px 8px;
    vertical-align: top;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
  }
  #invoice-amount td.item_l { white-space: normal; }
  #invoice-amount td.item_r, #invoice-amount th.item_r,
  #invoice-amount .unitprice_th, #invoice-amount .salestax_th,
  #invoice-amount .subtotal_th { text-align: right; }
  #invoice-amount td.quantity_td { color: #6b7280; }
  #invoice-amount .quantity_th { width: 70px; }
  #invoice-amount .unitprice_th { width: 90px; }
  #invoice-amount .salestax_th { width: 55px; }
  #invoice-amount .subtotal_th { width: 90px; }

  #invoice-totals {
    display: flex;
    justify-content: flex-end;
    margin: 0.4cm 0 0.9cm 0;
  }
  #invoice-totals .totals-block { width: 7.5cm; }
  #invoice-totals .totals-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    font-size: 9.5pt;
  }
  #invoice-totals .totals-row.grand {
    font-family: "Outfit", "Inter", Helvetica, Arial, sans-serif;
    font-size: 13pt;
    font-weight: 700;
    color: var(--invoice-ink);
    border-top: 2px solid var(--invoice-ink);
    margin-top: 4px;
    padding-top: 8px;
  }
  #invoice-totals .totals-row.due {
    font-weight: 700;
    color: var(--invoice-ink);
    border-top: 1px solid #e5e7eb;
    margin-top: 4px;
    padding-top: 8px;
  }

  #reverse-charge-notice { font-size: 8.5pt; color: #6b7280; margin-bottom: 0.6cm; }

  #invoice-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1cm;
  }
  #payment-details {
    display: flex;
    gap: 14px;
    align-items: center;
    background: var(--tint-surface);
    border-radius: 10px;
    padding: 14px 16px;
    flex: 0 1 11.5cm;
  }
  #payment-qr-box { background: #fff; border-radius: 6px; padding: 5px; line-height: 0; }
  #payment-qr-box.pending {
    flex: 0 0 94px;
    width: 94px;
    height: 94px;
    padding: 0;
    background: transparent;
    border: 1.5px dashed var(--tint-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tint-ink);
  }
  #payment-qr-box.pending svg { width: 34px; height: 34px; }
  #payment-lines { font-size: 9pt; line-height: 1.6; }
  #payment-lines h2 { font-size: 10.5pt; font-weight: 700; margin-bottom: 3px; }
  #payment-qr-hint { padding-top: 3px; font-size: 8pt; }
  #payment-qr-hint a { color: var(--invoice-ink); }

  #invoice-other { text-align: right; font-size: 9pt; color: #6b7280; line-height: 1.6; align-self: flex-end; padding-bottom: 14px; }
  #invoice-other h2 { font-size: 10.5pt; font-weight: 700; margin-bottom: 3px; }

  #comments {
    margin-top: 0.9cm;
    padding-top: 0.4cm;
    border-top: 1px solid #e5e7eb;
    font-size: 8.5pt;
    color: #6b7280;
    line-height: 1.5;
  }
}
