/* ─────────────────────────────────────────────────────────────────────────────
   Executive City Travel — print, for the portal and the admin area.

   SOURCE OF TRUTH: DESIGN-BRIEF.md §9 — "Print: day sheet at A4 portrait, 11pt,
   repeating table header, page breaks between events, no navy fills (ink)."
   §3.5 — "Print is a first-class output. The day sheet and booking
   confirmations are printed and handed to drivers."

   THIS FILE IS NOT PUBLIC. Everything under wwwroot/portal is served on the
   portal host only (HostRouting/PublicAssets.cs).

   LINK IT AFTER css/print.css, which it adds to and does not replace:

     <link rel="stylesheet" href="~/css/print.css" media="print" />
     <link rel="stylesheet" href="~/portal/css/print.css" media="print" />

   That sheet sets the page, the ink-only rule, the type and the links, and
   undoes the public shell. This one undoes the portal and admin shells and
   prints what only this side has: tables, status pills and the day sheet. The
   two were one file; the rules here are the ones that named this side's
   components, cut from the selector lists they shared and otherwise unchanged.

   A private link is never printed as an address: css/print.css expands no
   URLs, and §3.3 is why. A day sheet is handed to a driver and a confirmation
   is left on a desk; neither should carry a working credential in plain sight.
   ──────────────────────────────────────────────────────────────────────────── */

@media print {

  /* ═══ Ink only ════════════════════════════════════════════════════════════
     Borders stay, but in ink: the table's row lines and the pill's outline are
     what carries structure once the fills are gone. */
  .ect-pill,
  .ect-table,
  .ect-table th,
  .ect-table td,
  .ect-daysheet__event,
  .ect-daysheet__event-head,
  .ect-total {
    border-color: #000 !important;
  }

  /* ═══ No chrome ═══════════════════════════════════════════════════════════
     §4: "no chrome". Hidden here rather than with a class on each element, so a
     new component cannot forget to opt in. */
  .ect-sidebar,
  .ect-sidebartoggle,
  .ect-shell__topbar,
  .ect-portal-header,
  .ect-tabs,
  .ect-breadcrumb,
  .ect-menu,
  .ect-ownermenu,
  .ect-table__actions,
  .ect-table__sort::after,
  .ect-stepper,
  .ect-empty,
  [role='search'] {
    display: none !important;
  }

  /* ═══ Layout ══════════════════════════════════════════════════════════════
     Undo the shells. A printed page has one column and no containers. */
  .ect-shell--admin,
  .ect-shell--portal {
    display: block !important;
    min-height: 0 !important;
    grid-template-columns: none !important;
  }

  .ect-admin-content {
    max-width: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .ect-total {
    border-radius: 0 !important;
    padding: 6pt 8pt !important;
  }

  .ect-daysheet__event-name {
    break-after: avoid-page;
    page-break-after: avoid; /* legacy alias for older engines */
  }

  /* ═══ Tables ══════════════════════════════════════════════════════════════
     §9: "repeating table header".

     The stacked-card layout from components.css must be undone first. A print
     canvas is around 794px wide at 96dpi, so the 720px media query usually
     matches and the table form is already in force — but "usually" is not good
     enough for the one output that gets handed to a driver, so it is forced
     here regardless of how the browser sizes the print viewport. */

  .ect-table {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 10pt;
  }

  .ect-table thead {
    /* This is the line that makes the header repeat on every page. */
    display: table-header-group !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip-path: none !important;
  }

  .ect-table tbody { display: table-row-group !important; }
  .ect-table tr { display: table-row !important; }

  .ect-table th,
  .ect-table td {
    display: table-cell !important;
    padding: 4pt 5pt !important;
    border: 0 !important;
    border-bottom: 0.5pt solid #000 !important;
    vertical-align: top;
  }

  /* The data-label prefixes belong to the card layout only. */
  .ect-table td::before { content: none !important; }

  .ect-table thead th {
    border-bottom: 1pt solid #000 !important;
    font-size: 9pt;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  /* A row must not be split across two pages: half a passenger's details at
     the foot of page one is worse than a slightly short page. */
  .ect-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .ect-table-scroll {
    overflow: visible !important;
    border: 0 !important;
  }

  /* ═══ Status pills ════════════════════════════════════════════════════════
     The tint is gone, so the pill is now an outlined word. It still reads
     correctly because §9 never let colour carry the meaning in the first
     place — the text was always the signal and it survives untouched. */

  .ect-pill {
    border: 0.5pt solid #000 !important;
    border-radius: 2pt !important;
    padding: 0 3pt !important;
    font-size: 9pt;
    font-weight: 600;
  }

  .ect-pill__icon { display: none !important; }

  /* ═══ Day sheet ═══════════════════════════════════════════════════════════
     §9 and §4: "page breaks between events."

     break-before on every event AFTER the first — not break-after on every
     event, which would leave a blank final page. Both the modern property and
     the legacy alias are set: older print engines still only understand
     page-break-before. */

  .ect-daysheet { display: block !important; }

  .ect-daysheet__event {
    border: 0 !important;
    margin: 0 0 6pt !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .ect-daysheet__event + .ect-daysheet__event {
    break-before: page;
    page-break-before: always;
    padding-top: 0 !important;
  }

  .ect-daysheet__event-head {
    padding: 0 0 3pt !important;
    border: 0 !important;
    border-bottom: 1pt solid #000 !important;
    margin-bottom: 5pt !important;
  }

  .ect-daysheet__event-name { font-size: 13pt; font-weight: 600; }

  /* The pickup time is what the owner and the driver scan for. */
  .ect-daysheet__time {
    font-size: 12pt;
    font-weight: 600;
    white-space: nowrap;
  }

  .ect-daysheet__flight { white-space: nowrap; }

  /* A confirmation should not break mid-booking. */
  .ect-datalist {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
