/* ============================================================
   PRINT STYLES - Client-facing PDF output (Enhanced)
   Includes: Terms & Conditions, Signature Block, Service Breakdown
   ============================================================ */

@media print {
  /* Hide interactive elements */
  .app-header,
  .tab-nav,
  .header-actions,
  .sticky-footer,
  .toast-container,
  .btn,
  .phase__add-row,
  .phase__actions .btn--ghost,
  .estimate-builder__toolbar,
  .modal-overlay,
  .dropdown__menu,
  .form-hint,
  .filter-bar,
  .validation-bar,
  .actuals-bar,
  .toolbar,
  .phase--excluded,
  .line-item--excluded,
  .phase__exclude,
  [data-no-print] {
    display: none !important;
  }

  /* Reset layout */
  body {
    background: white !important;
    color: #000 !important;
    font-size: 10pt;
    line-height: 1.4;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .app-main {
    padding: 0;
    max-width: 100%;
  }

  /* Company Header */
  .print-header {
    display: flex !important;
    align-items: flex-start;
    justify-content: space-between;
    padding-bottom: 16pt;
    margin-bottom: 16pt;
    border-bottom: 2pt solid #000;
  }

  .print-header__logo {
    font-size: 20pt;
    font-weight: 700;
    letter-spacing: -0.5pt;
  }

  .print-header__meta {
    text-align: right;
    font-size: 9pt;
    color: #555;
    line-height: 1.6;
  }

  /* Estimate Info */
  .estimate-info-print {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 12pt;
    margin-bottom: 20pt;
    padding: 12pt 16pt;
    background: #f5f5f5 !important;
    border-radius: 4pt;
    border: 0.5pt solid #ddd;
  }

  .estimate-info-print__label {
    font-size: 7pt;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5pt;
    margin-bottom: 2pt;
  }

  .estimate-info-print__value {
    font-size: 10pt;
    font-weight: 600;
  }

  /* Phase sections */
  .phase {
    page-break-inside: avoid;
    margin-bottom: 12pt;
    border: 1pt solid #ddd;
    border-radius: 4pt;
    overflow: hidden;
  }

  .phase__header {
    background: #f0f0f0 !important;
    padding: 8pt 12pt;
    border-bottom: 1pt solid #ddd;
  }

  .phase__name {
    font-size: 11pt;
    font-weight: 600;
  }

  .phase__toggle {
    display: none;
  }

  .phase__subtotal {
    font-size: 10pt;
    font-weight: 700;
  }

  .phase__body {
    display: block !important;
    max-height: none !important;
  }

  /* Tables */
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
  }

  th {
    padding: 6pt 8pt;
    font-size: 7pt;
    font-weight: 600;
    text-transform: uppercase;
    background: #f8f8f8 !important;
    border-bottom: 1pt solid #ccc;
  }

  td {
    padding: 5pt 8pt;
    border-bottom: 0.5pt solid #eee;
  }

  /* Hide Actual Hours column in print */
  th:nth-last-child(2),
  td:nth-last-child(2) {
    display: none;
  }

  /* Hide action column in print */
  th:last-child,
  td:last-child {
    display: none;
  }

  /* Make inline inputs look like text */
  td .cell-input,
  td .cell-select {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0;
    font-size: inherit;
    appearance: none;
    -webkit-appearance: none;
    color: #000 !important;
  }

  /* Totals */
  .print-totals {
    display: block !important;
    margin-top: 20pt;
    padding: 12pt 16pt;
    border: 2pt solid #000;
    border-radius: 4pt;
    page-break-inside: avoid;
  }

  .print-totals__row {
    display: flex;
    justify-content: space-between;
    padding: 3pt 0;
    font-size: 10pt;
  }

  .print-totals__row--grand {
    font-size: 14pt;
    font-weight: 700;
    border-top: 1.5pt solid #000;
    padding-top: 8pt;
    margin-top: 4pt;
  }

  /* Notes */
  .print-notes {
    display: block !important;
    margin-top: 20pt;
    page-break-inside: avoid;
  }

  .print-notes__title {
    font-size: 11pt;
    font-weight: 600;
    margin-bottom: 8pt;
    padding-bottom: 4pt;
    border-bottom: 1pt solid #ddd;
  }

  .print-notes__content {
    font-size: 9pt;
    color: #333;
    line-height: 1.5;
    margin-bottom: 8pt;
  }

  .print-notes__assumptions {
    list-style: disc;
    padding-left: 16pt;
    font-size: 9pt;
    color: #333;
  }

  .print-notes__assumptions li {
    margin-bottom: 2pt;
  }

  /* Terms & Conditions */
  .print-terms {
    display: block !important;
    margin-top: 20pt;
    page-break-inside: avoid;
  }

  .print-terms__title {
    font-size: 11pt;
    font-weight: 600;
    margin-bottom: 8pt;
    padding-bottom: 4pt;
    border-bottom: 1pt solid #ddd;
  }

  .print-terms__list {
    font-size: 8pt;
    color: #555;
    line-height: 1.6;
    padding-left: 16pt;
    margin: 0;
  }

  .print-terms__list li {
    margin-bottom: 3pt;
  }

  /* Signature Block */
  .print-signature {
    display: block !important;
    margin-top: 28pt;
    page-break-inside: avoid;
  }

  .print-signature__title {
    font-size: 11pt;
    font-weight: 600;
    margin-bottom: 16pt;
    padding-bottom: 4pt;
    border-bottom: 1pt solid #ddd;
  }

  .print-signature__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40pt;
  }

  .print-signature__party-label {
    font-size: 10pt;
    font-weight: 600;
    margin-bottom: 20pt;
  }

  .print-signature__line {
    border-bottom: 1pt solid #999;
    height: 30pt;
    margin-bottom: 4pt;
  }

  .print-signature__field {
    font-size: 8pt;
    color: #888;
    margin-bottom: 16pt;
  }

  /* Footer */
  .print-footer {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding-top: 8pt;
    border-top: 1pt solid #ccc;
    font-size: 8pt;
    color: #888;
    text-align: center;
  }

  /* Page settings */
  @page {
    margin: 1.5cm;
    size: A4;
  }

  /* Card styles in print */
  .card {
    border: 0.5pt solid #ddd;
    padding: 10pt 14pt;
    margin-bottom: 12pt;
    border-radius: 4pt;
  }

  .card__title {
    display: none;
  }

  /* Form elements in print - show values as text */
  .form-row {
    display: none;
  }
}

/* Print-only elements (hidden on screen) */
.print-header,
.estimate-info-print,
.print-totals,
.print-notes,
.print-terms,
.print-signature,
.print-footer {
  display: none;
}
