/* Print Styles for Reports */

@media print {
  /* Hide UI elements */
  header,
  nav,
  .no-print,
  button:not(.print-show),
  .filter-panel,
  [role="banner"],
  [role="navigation"],
  .toast-container {
    display: none !important;
  }

  /* Reset page */
  * {
    background: white !important;
    color: black !important;
  }

  html,
  body {
    width: 100%;
    height: auto !important;
    overflow: visible !important;
  }

  body {
    margin: 0;
    padding: 20px;
  }

  /* Reset layout grids that might limit height */
  .grid,
  .grid-rows-\\[auto_1fr\\],
  [class*="grid-rows"] {
    display: block !important;
    height: auto !important;
  }

  /* Page breaks */
  .page-break {
    page-break-after: always;
  }

  .avoid-break {
    page-break-inside: auto;
  }

  /* Override layout containers to allow content to flow */
  .h-full,
  .min-h-0,
  .overflow-auto,
  .overflow-hidden,
  .overflow-scroll,
  .print-content {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* Flex containers should not restrict content */
  .flex,
  .flex-col {
    display: block !important;
  }

  /* Report container */
  .report-container {
    width: 100%;
    max-width: none;
    overflow: visible !important;
    height: auto !important;
  }

  /* Report header */
  .report-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #000;
    page-break-after: avoid;
  }

  .report-header h1 {
    font-size: 18pt;
    font-weight: bold;
    margin: 0 0 5px 0;
  }

  .report-header p {
    font-size: 12pt;
    margin: 3px 0;
  }

  /* Report content */
  .report-content {
    font-size: 10pt;
  }

  /* Tables */
  table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
  }

  table th,
  table td {
    border: 1px solid #000;
    padding: 8px;
    text-align: left;
  }

  table th {
    background-color: #f0f0f0 !important;
    font-weight: bold;
  }

  /* Card sections */
  .section-card {
    border: 1px solid #000;
    margin: 15px 0;
    page-break-inside: auto;
  }

  .section-header {
    background-color: #e0e0e0 !important;
    padding: 10px;
    font-weight: bold;
    border-bottom: 1px solid #000;
    page-break-after: avoid;
  }

  .section-content {
    padding: 10px;
  }

  /* Summary section */
  .summary-section {
    margin-top: 20px;
    padding: 15px;
    border: 2px solid #000;
    background-color: #f9f9f9 !important;
    page-break-inside: avoid;
  }

  /* Hierarchical lines */
  .report-line {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #ddd;
  }

  .report-line.group {
    font-weight: bold;
    background-color: #f5f5f5 !important;
  }

  /* Currency formatting */
  .amount {
    text-align: right;
    font-family: 'Courier New', monospace;
  }

  .amount.positive {
    color: #000 !important;
  }

  .amount.negative {
    color: #000 !important;
  }

  /* Footer */
  @page {
    margin: 1cm;
    @bottom-right {
      content: "Halaman " counter(page) " dari " counter(pages);
    }
  }

  /* Specific for P&L Report */
  .pl-report .report-line {
    padding-left: calc(var(--indent-level, 0) * 15px);
  }

  /* Specific for Balance Sheet */
  .bs-report .section {
    page-break-inside: auto;
  }

  .bs-report .report-line {
    page-break-inside: avoid;
  }

  /* Specific for Cash Flow */
  .cf-report .activity-section {
    margin: 20px 0;
    page-break-inside: auto;
  }

  .cf-report .activity-header {
    font-size: 12pt;
    font-weight: bold;
    background-color: #e0e0e0 !important;
    padding: 8px;
    margin: 10px 0 5px 0;
  }

  /* Adjustments */
  .adjustment-item {
    padding-left: 20px;
    padding: 3px 0;
  }

  /* Hide scroll bars */
  ::-webkit-scrollbar {
    display: none;
  }

  /* Force print in portrait */
  @page {
    size: A4 portrait;
  }
}
