/* ==========================================================================
   Print Styles - Clean, printable layout for charts and data
   ========================================================================== */

@media print {
  /* Reset and Layout */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  body {
    font-family: "Times New Roman", serif;
    font-size: 12pt;
    line-height: 1.4;
    color: #000;
    background: white;
    margin: 0;
    padding: 0;
  }
  
  /* Hide UI Elements */
  #app-header,
  #status-bar,
  .panel-header .panel-tools,
  .tree-tools,
  .btn,
  .context-menu,
  .mobile-nav,
  .bottom-actions {
    display: none !important;
  }
  
  /* Page Layout */
  #app-container {
    display: block;
    padding: 0;
    margin: 0;
  }
  
  #book-manager {
    display: none;
  }
  
  #editor-panel {
    position: static;
    transform: none;
    width: 100%;
    height: auto;
    border: none;
    border-radius: 0;
    background: white;
  }
  
  .panel {
    border: none;
    border-radius: 0;
    background: white;
    box-shadow: none;
  }
  
  .panel-header {
    border: none;
    background: white;
    padding: 0 0 20pt 0;
    margin-bottom: 20pt;
    border-bottom: 2pt solid #000;
  }
  
  .panel-header h2 {
    font-size: 18pt;
    font-weight: bold;
    margin: 0;
    color: #000;
  }
  
  .panel-content {
    padding: 0;
    max-height: none;
    overflow: visible;
  }
  
  /* Chart Printing */
  .chart-container {
    width: 100%;
    height: 400pt;
    border: 1pt solid #ccc;
    border-radius: 0;
    background: white;
    margin-bottom: 20pt;
    page-break-inside: avoid;
  }
  
  .chart-container svg {
    width: 100% !important;
    height: 100% !important;
  }
  
  /* Data Tables for Print */
  .data-editor {
    background: white;
    border: 1pt solid #ccc;
    border-radius: 0;
    padding: 15pt;
    margin-top: 20pt;
    page-break-inside: avoid;
  }
  
  .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
    margin-top: 15pt;
  }
  
  .data-table th,
  .data-table td {
    border: 1pt solid #ccc;
    padding: 8pt;
    text-align: left;
  }
  
  .data-table th {
    background-color: #f5f5f5;
    font-weight: bold;
  }
  
  .data-table tr:nth-child(even) {
    background-color: #fafafa;
  }
  
  /* Stats for Print */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15pt;
    margin-bottom: 20pt;
    page-break-inside: avoid;
  }
  
  .stat-card {
    border: 1pt solid #ccc;
    border-radius: 0;
    padding: 10pt;
    text-align: center;
    background: white;
  }
  
  .stat-value {
    font-size: 16pt;
    font-weight: bold;
    color: #000;
  }
  
  .stat-label {
    font-size: 9pt;
    color: #666;
    margin-top: 5pt;
  }
  
  /* Typography for Print */
  h1, h2, h3, h4, h5, h6 {
    color: #000;
    page-break-after: avoid;
  }
  
  h1 { font-size: 20pt; }
  h2 { font-size: 16pt; }
  h3 { font-size: 14pt; }
  h4 { font-size: 12pt; }
  
  p {
    orphans: 3;
    widows: 3;
  }
  
  /* Print Header/Footer Content */
  .print-header {
    display: block;
    text-align: center;
    margin-bottom: 30pt;
    padding-bottom: 15pt;
    border-bottom: 2pt solid #000;
  }
  
  .print-title {
    font-size: 24pt;
    font-weight: bold;
    margin-bottom: 10pt;
  }
  
  .print-subtitle {
    font-size: 12pt;
    color: #666;
    margin-bottom: 5pt;
  }
  
  .print-metadata {
    font-size: 10pt;
    color: #666;
    margin-top: 30pt;
    padding-top: 15pt;
    border-top: 1pt solid #ccc;
    text-align: right;
  }
  
  /* Page Breaks */
  .page-break {
    page-break-before: always;
  }
  
  .avoid-break {
    page-break-inside: avoid;
  }
  
  /* Links for Print */
  a {
    color: #000;
    text-decoration: none;
  }
  
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }
  
  /* Form Elements for Print */
  input,
  select,
  textarea {
    border: 1pt solid #ccc;
    background: white;
    font-size: 10pt;
    padding: 3pt;
  }
  
  /* Color Adjustments for Black & White Printing */
  @media print and (monochrome) {
    .chart-container {
      border: 2pt solid #000;
    }
    
    .stat-card {
      border: 2pt solid #000;
    }
    
    .data-table th {
      background-color: #e0e0e0;
    }
    
    .data-table tr:nth-child(even) {
      background-color: #f0f0f0;
    }
  }
  
  /* Landscape Orientation Optimization */
  @media print and (orientation: landscape) {
    .chart-container {
      height: 300pt;
    }
    
    .stats-grid {
      grid-template-columns: repeat(4, 1fr);
    }
  }
}