/**
 * Commerce Learning Hub - Print Styles
 * 
 * Optimized for printing reports, calculations, and study materials.
 * Applied automatically when user prints (Ctrl+P / Cmd+P).
 */

@media print {
  /* ============================================
     PAGE SETUP
     ============================================ */
  @page {
    size: A4;
    margin: 2cm;
  }
  
  /* ============================================
     GLOBAL RESETS
     ============================================ */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  
  html, body {
    background: white !important;
    color: black !important;
    font-size: 11pt !important;
    line-height: 1.5 !important;
  }
  
  /* ============================================
     HIDE NON-ESSENTIAL UI
     ============================================ */
  .header,
  .sidebar,
  .sidebar-overlay,
  .footer,
  .back-to-top,
  .toast-container,
  .theme-toggle,
  .header__mobile-toggle,
  .header__search,
  .mega-menu__panel,
  .hero,
  .cta-section,
  .no-print,
  [data-no-print] {
    display: none !important;
  }
  
  /* ============================================
     LAYOUT ADJUSTMENTS
     ============================================ */
  .app {
    display: block !important;
  }
  
  .main {
    padding: 0 !important;
    margin: 0 !important;
  }
  
  .main__inner {
    max-width: 100% !important;
  }
  
  .breadcrumbs {
    display: none !important;
  }
  
  /* ============================================
     TYPOGRAPHY
     ============================================ */
  h1 { font-size: 22pt !important; page-break-after: avoid; }
  h2 { font-size: 18pt !important; page-break-after: avoid; }
  h3 { font-size: 14pt !important; page-break-after: avoid; }
  h4 { font-size: 12pt !important; page-break-after: avoid; }
  
  p, li {
    orphans: 3;
    widows: 3;
  }
  
  /* ============================================
     LINKS — Show URL after text
     ============================================ */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555 !important;
    font-weight: normal;
  }
  
  a[href^="#"]::after,
  a[href^="/"]::after {
    content: "";
  }
  
  a {
    color: black !important;
    text-decoration: underline !important;
  }
  
  /* ============================================
     CARDS & PANELS
     ============================================ */
  .card,
  .module-card,
  .stat-card,
  .category-card {
    background: white !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  .card--glass {
    background: white !important;
    backdrop-filter: none !important;
  }
  
  /* ============================================
     TABLES
     ============================================ */
  table {
    border-collapse: collapse !important;
    width: 100% !important;
    page-break-inside: avoid;
  }
  
  th, td {
    border: 1px solid #999 !important;
    padding: 6pt !important;
    text-align: left !important;
  }
  
  th {
    background: #f0f0f0 !important;
    font-weight: bold !important;
  }
  
  tr:nth-child(even) td {
    background: #fafafa !important;
  }
  
  /* ============================================
     CHARTS & IMAGES
     ============================================ */
  canvas,
  img,
  svg {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
  
  /* ============================================
     FORMS
     ============================================ */
  .form-input,
  .form-select,
  .form-textarea {
    border: 1px solid #999 !important;
    background: white !important;
  }
  
  .btn {
    display: none !important;
  }
  
  /* ============================================
     RESULTS SECTION (module-specific)
     ============================================ */
  .result-card,
  .calculation-steps,
  .interpretation {
    background: white !important;
    border: 1px solid #ccc !important;
    padding: 12pt !important;
    margin-bottom: 12pt !important;
    page-break-inside: avoid;
  }
  
  .result-card__title {
    font-weight: bold !important;
    font-size: 13pt !important;
    border-bottom: 1px solid #ccc !important;
    padding-bottom: 6pt !important;
    margin-bottom: 6pt !important;
  }
  
  /* ============================================
     PAGE BREAKS
     ============================================ */
  .page-break-before {
    page-break-before: always !important;
    break-before: page !important;
  }
  
  .page-break-after {
    page-break-after: always !important;
    break-after: page !important;
  }
  
  .avoid-page-break {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  
  /* ============================================
     PRINT HEADER (optional, appears on each page)
     ============================================ */
  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 1cm;
    padding-bottom: 0.5cm;
    border-bottom: 2px solid #333;
  }
  
  .print-header__title {
    font-size: 16pt !important;
    font-weight: bold !important;
  }
  
  .print-header__date {
    font-size: 9pt !important;
    color: #666 !important;
    margin-top: 4pt !important;
  }
  
  /* ============================================
     PRINT FOOTER (page numbers)
     ============================================ */
  .print-footer {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9pt !important;
    color: #666 !important;
    padding-top: 0.5cm;
    border-top: 1px solid #ccc;
  }
}

/* Hide print-only elements on screen */
.print-header,
.print-footer {
  display: none;
}