/* Kovara Print Stylesheet
 * Clean output for statements, receipts, and reports
 */

@media print {
  /* Hide navigation and UI elements */
  .sidebar,
  .topbar,
  .no-print,
  .mobile-nav,
  .pagination,
  .btn,
  .btn-primary,
  .btn-secondary,
  .btn-danger,
  nav,
  footer,
  .flash-messages {
    display: none !important;
  }

  /* Reset main content area */
  .main-content,
  main {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Base typography */
  body {
    font-size: 11pt;
    color: #000;
    background: #fff;
    line-height: 1.4;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  }

  /* Remove link underlines and colors */
  a {
    color: #000 !important;
    text-decoration: none !important;
  }

  /* Show link URLs in print (optional - can be useful for statements) */
  a[href^="http"]:after {
    content: none;
  }

  /* Headings */
  h1, h2, h3, h4, h5, h6 {
    color: #000;
    page-break-after: avoid;
    page-break-inside: avoid;
  }

  h1 {
    font-size: 18pt;
    margin-bottom: 12pt;
  }

  h2 {
    font-size: 14pt;
    margin-bottom: 10pt;
  }

  h3 {
    font-size: 12pt;
    margin-bottom: 8pt;
  }

  /* Tables */
  table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 12pt;
  }

  th, td {
    border: 1px solid #ccc;
    padding: 4pt 8pt;
    text-align: left;
    font-size: 10pt;
  }

  th {
    background-color: #f0f0f0 !important;
    font-weight: 600;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  thead {
    display: table-header-group;
  }

  tr {
    page-break-inside: avoid;
  }

  /* Cards - print as simple bordered boxes */
  .card,
  .stat-card {
    border: 1px solid #ccc;
    padding: 8pt;
    margin-bottom: 12pt;
    page-break-inside: avoid;
    box-shadow: none !important;
    background: #fff !important;
  }

  /* Status badges - print in grayscale */
  .badge,
  .badge-active,
  .badge-pending,
  .badge-rejected,
  .badge-closed {
    background: #f0f0f0 !important;
    color: #000 !important;
    border: 1px solid #999;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Financial amounts - ensure they're visible */
  .amount-positive,
  .amount-negative,
  .amount-pending {
    color: #000 !important;
    font-weight: 600;
  }

  /* Add visual indicator for positive/negative amounts */
  .amount-positive:before {
    content: "+ ";
  }

  .amount-negative:before {
    content: "- ";
  }

  /* Page breaks */
  .page-break-before {
    page-break-before: always;
  }

  .page-break-after {
    page-break-after: always;
  }

  .no-page-break {
    page-break-inside: avoid;
  }

  /* Images */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  /* Institution header for statements */
  .print-header {
    text-align: center;
    margin-bottom: 24pt;
    padding-bottom: 12pt;
    border-bottom: 2px solid #000;
  }

  .print-header .institution-name {
    font-size: 16pt;
    font-weight: 700;
    margin-bottom: 4pt;
  }

  .print-header .institution-address {
    font-size: 9pt;
    color: #333;
  }

  /* Statement/receipt specific */
  .statement-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16pt;
    font-size: 10pt;
  }

  .statement-total {
    font-size: 14pt;
    font-weight: 700;
    text-align: right;
    margin-top: 12pt;
    padding-top: 8pt;
    border-top: 2px solid #000;
  }

  /* Footer for printed pages */
  .print-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 8pt;
    color: #666;
    padding: 8pt;
    border-top: 1px solid #ccc;
  }

  /* Account numbers - keep monospace */
  .font-mono {
    font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
    font-size: 10pt;
  }

  /* Ensure charts don't print broken */
  .chart-container,
  canvas {
    page-break-inside: avoid;
    max-height: 300pt;
  }

  /* Transaction rows */
  .transaction-row {
    border-bottom: 1px solid #eee;
    padding: 4pt 0;
  }

  /* Margins for A4 paper */
  @page {
    margin: 1.5cm;
    size: A4;
  }

  /* First page different margin (for letterhead) */
  @page :first {
    margin-top: 2cm;
  }
}
