/* ============================================================
   Roster — print.css
   Loaded only when printing (media="print" in base.html).
   Optimised for A4 portrait, browser print-to-PDF.
   Compact print mode: compresses rest/leave runs, trims header.
   ============================================================ */

@media print {

  @page {
    size: A4 portrait;
    margin: 8mm 6mm 8mm 6mm;
  }

  /* ── Base reset for print ── */
  html {
    font-size: 10.5px;
    background: white;
    color: black;
  }

  body {
    margin: 0;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  .page {
    width: 194mm;
    max-width: 194mm;
    padding: 0;
    margin: 0 auto;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  /* ── Hide navigation and non-printable elements ── */
  .month-nav,
  .no-print {
    display: none !important;
  }

  /* ── Compact header: remove subtitle, shrink name ── */
  .pilot-name {
    font-size: 13px;
  }

  .pilot-subtitle {
    display: none;
  }

  .month-label {
    font-size: 12px;
    font-weight: 600;
  }

  .header-sep {
    margin: 0 0 0.25rem;
  }

  /* ── Metrics: compact, 4 columns ── */
  .metrics {
    gap: 6px;
    margin-bottom: 0.4rem;
  }

  .metric-card {
    padding: 4px 6px;
  }

  .metric-value { font-size: 16px; }
  .metric-label { font-size: 8px; }

  /* ── Section title ── */
  .section-title {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .calendar-grid {
    gap: 2px;
  }

  .cal-weekday {
    font-size: 9px;
    padding-bottom: 3px;
  }

  /* ── Avoid page breaks inside calendar cells and table rows ── */
  .cal-cell {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
  }

  .metric-card,
  .calendar-grid,
  .detail-table tbody tr {
    break-inside: avoid;
  }

  /* ── Section separator ── */
  .section-sep {
    border-top: 1px solid #ccc;
    margin: 0.4rem 0;
  }

  /* ── Flight/activity blocks: reduce padding ── */
  .activity-block {
    min-height: 20px;
    padding: 3px 6px 3px 5px;
  }

  /* ── Detail table: tighter rows ── */
  .detail-table {
    table-layout: auto;
  }

  .detail-table thead th {
    font-size: 9px;
    padding: 4px 6px;
  }

  td.td-date,
  td.td-type,
  td.td-activity {
    padding-top: 2px;
    padding-bottom: 2px;
  }

  td.td-date {
    padding-left: 8px;
    padding-right: 6px;
  }

  td.td-type {
    padding-left: 6px;
    padding-right: 6px;
  }

  td.td-activity {
    padding-right: 4px;
  }

  .date-num { font-size: 11px; }
  .date-num.continuation { font-size: 10px; }
  .date-wd { font-size: 8px; }
  .badge-type { font-size: 8px; padding: 1px 5px; }

  .activity-blocks {
    gap: 3px;
    padding: 1px 0;
  }

  /* ── Row hover suppressed in print ── */
  .detail-table tbody tr:hover {
    background: transparent;
  }
  .detail-table tbody tr.weekend-row {
    background: rgba(0, 0, 0, 0.015);
  }
  .detail-table tbody tr.continuation-vol { background: transparent; }
  .detail-table tbody tr.continuation-sol { background: rgba(250, 236, 231, 0.2); }

  /* ── Compact REST rows in print ──
     Repos and Congé rows are compressed: smaller padding, muted text.
     This reduces the visual bulk of rest-only periods.
  ── */
  .detail-table tbody tr:has(.rest-text) td {
    padding-top: 1px;
    padding-bottom: 1px;
  }

  .rest-text {
    font-size: 8.5px;
    opacity: 0.62;
    padding: 1px 0;
  }

  .detail-table tbody tr.pdf-rest-row {
    background: rgba(0, 0, 0, 0.012);
  }

  .detail-table tbody tr.pdf-rest-repeat td.td-type .badge-type {
    opacity: 0.35;
  }

  .detail-table tbody tr.pdf-rest-repeat .rest-text {
    visibility: hidden;
  }

  /* ── Calendar cell: smaller in print ── */
  .cal-cell        { min-height: 42px; padding: 2px 4px 2px; gap: 1px; }
  .cal-cell-placeholder { min-height: 42px; }
  .cal-day-num     { font-size: 9px; }
  .cal-tag         { font-size: 6px; padding: 1px 3px; }
  .cal-tl          { gap: 1px; }
  .tl-time         { font-size: 8px; }
  .tl-plus1        { font-size: 6px; }
  .cal-tl-track    { height: 6px; --tl-dot-size: 3px; }
  .tl-stop         { font-size: 6px; }
  .tl-stop-dot     { display: block; }
  .cal-below-text  { display: none; }
  .cal-escale-row  { margin-top: 3px; gap: 3px; }
  .cell-decoucher {
    top: 2px;
    right: 3px;
  }
  .cell-decoucher:not(.cell-decoucher-pdf),
  .cell-decoucher:not(.cell-decoucher-pdf) .decoucher-icon {
    width: 10px;
    height: 9.5px;
  }
  .cell-decoucher:not(.cell-decoucher-pdf) .decoucher-icon {
    font-size: 6px;
    line-height: 1;
    transform: translateY(-0.5px);
  }
  .cell-decoucher-pdf {
    min-width: 16px;
    height: 10px;
    font-size: 6px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--vol-text);
  }
  .cal-escale-city { font-size: 7px; }
  .cal-text-main   { font-size: 7px; }
  .cal-text-main-pdf-rest { opacity: 0.55; font-weight: 600; letter-spacing: 0.04em; }
  .cal-sol-label   { font-size: 6.8px; opacity: 0.88; }
  .cal-sol-hours   { font-size: 6.5px; }
  .cal-arr-text    { font-size: 6.5px; }
  .sol-continuation-text { font-size: 6px; opacity: 0.24; }
  .cal-cell.repos,
  .cal-cell.conge {
    background: rgba(234, 243, 222, 0.72);
  }
  .cal-cell.conge {
    background: rgba(192, 221, 151, 0.74);
  }
  .cal-cell.repos .cal-text-main,
  .cal-cell.conge .cal-text-main,
  .cal-cell.repos .cal-day-num,
  .cal-cell.conge .cal-day-num {
    opacity: 0.72;
  }
}
