/* File: public/css/print.css */

@media print {
  /* =============================================
     1. GLOBAL PAGE SETUP
     ============================================= */
  @page {
    size: A4;
    /* Margins tight rakhe hain taaki maximum content fit ho sake */
    margin: 6mm 8mm 6mm 8mm; 
  }

  body, html {
    margin: 0;
    padding: 0;
    background-color: #ffffff !important;
    font-size: 10pt; /* Global font size */
    font-family: Arial, Helvetica, sans-serif;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* =============================================
     2. PAGE 1 SPECIFIC FIXES (COMPACT MODE)
     ============================================= */
  /* Ye rules sirf Page 1 ko chhota karne ke liye hain taaki 
     Strengths aur Gaps agle page par na bhagein */

  /* LOGO */
  .logo {
    width: 100px !important;
    height: auto !important;
    margin: 0 auto 5px auto !important;
    display: block;
  }

  /* HEADER & TITLE */
  .header {
    margin-bottom: 0 !important;
    padding: 0 !important;
    height: auto !important;
  }
  .titleSection {
    margin-bottom: 5px !important;
    text-align: center;
  }
  .reportTitle {
    font-size: 20px !important;
    font-weight: 700 !important;
    margin: 0 0 2px 0 !important;
    padding: 0 !important;
    color: #0F1A3E !important;
  }
  .preparedFor, .diagnosticDate {
    font-size: 9pt !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #555;
  }

  /* INTRO TEXT (Disclaimer) - Hidden by default */
  .introParagraph {
    margin: 5px 0 !important;
    text-align: center;
  }
  .introParagraph p {
    font-size: 8pt !important;
    margin: 2px 0 !important;
    line-height: 1.1 !important;
    color: #666 !important;
  }
  .preparedBy {
    margin-top: 2px !important;
    font-weight: bold;
    font-size: 9pt !important;
    color: #000;
  }

  /* PILL & SCORES */
  .executiveSummaryWrapper {
    margin: 10px 0 5px 0 !important;
    text-align: center;
  }
  .executiveSummary h3 {
    padding: 6px 30px !important;
    font-size: 14px !important;
    margin: 0 !important;
    display: inline-block;
    border-radius: 20px;
  }

  .scoresSection {
    margin: 10px 0 !important;
    padding: 0 10px !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .scoreItem, .classificationItem, .riskItem {
    margin-bottom: 0 !important;
  }
  .scoreValue, .classificationValue, .riskValue {
    font-size: 12pt !important;
    font-weight: 700 !important;
  }

  /* LISTS (Strengths & Gaps) - Most Important */
  .detailsSection {
    margin-top: 5px !important;
  }
  .detailsSection h4 {
    margin: 8px 0 4px 0 !important;
    font-size: 11pt !important;
    text-transform: uppercase;
    color: #0F1A3E !important;
    font-weight: bold;
  }
  .detailsSection ul {
    margin: 0 !important;
    padding-left: 18px !important;
  }
  .detailsSection li {
    margin-bottom: 3px !important;
    font-size: 9pt !important;
    line-height: 1.25 !important;
    text-align: justify;
    color: #333;
  }

  /* FOOTER WAVE */
  .footerWave {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px !important;
    background-size: cover !important;
    z-index: -1;
    opacity: 0.8;
  }

  /* =============================================
     3. PAGE BREAKER UTILITY
     ============================================= */
  /* Is class wale div ke baad naya page shuru hoga */
  .print-break {
    display: block;
    height: 1px;
    width: 100%;
    border: none;
    background: transparent;
    page-break-after: always !important;
    break-after: page !important;
    margin: 0;
    clear: both;
  }

  /* Is class wale div ke andar page break nahi hoga */
  .avoid-page-break {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    display: block;
  }

  /* =============================================
     4. CONTENT PROTECTION (Other Pages)
     ============================================= */
  
  /* Headings ko uske content se alag hone se bachana */
  h1, h2, h3, h4, .coreHeaderPill, .sectionTitle {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  /* Cards aur Grids ko beech se katne se bachana */
  .chartContainer, 
  .heatmapGrid, 
  .profileGrid, 
  .coreCard, 
  .finalRecSection {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    display: block;
    border: 1px solid #eee !important; /* Shadow hatakar border lagaya */
    box-shadow: none !important;
    margin-bottom: 20px;
    background: #fff;
  }

  /* Sections ko full width dena */
  .charts-section-print, 
  .heatmap-section-print, 
  .profile-section-print {
    display: block !important;
    width: 100% !important;
    margin-top: 10px !important;
  }

  /* =============================================
     5. TABLE FIXES
     ============================================= */
  .tableWrapper {
    overflow: visible !important;
  }
  
  .subIndicatorTable {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  .subIndicatorTable tr {
    page-break-inside: avoid !important;
  }

  .subIndicatorTable th, 
  .subIndicatorTable td {
    padding: 5px !important;
    font-size: 9pt !important;
    border: 1px solid #ddd;
    text-align: left;
  }

  /* =============================================
     6. CLEANUP
     ============================================= */
  
  /* ⭐ HIDE INTRO TEXT: This solves the Page 1 overflow issue! */
  .hide-on-print {
    display: none !important;
  }

  /* Links ke URL print hone se rokna */
  a[href]:after {
    content: none !important;
  }
}