/* 
   Ziyad Tracker - Pediatrician Print Stylesheet
   This stylesheet is active ONLY when printing (window.print() or saving as PDF).
*/

@media print {
  /* Hide the web application interface completely */
  .app-container,
  .app-nav,
  .app-header,
  .smart-alerts,
  .connection-badge,
  .modal,
  #success-sound {
    display: none !important;
  }

  /* Show and format the print container */
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-family: 'Cairo', 'Outfit', sans-serif !important;
    margin: 0 !important;
    padding: 20px !important;
    font-size: 11pt !important;
    direction: inherit !important;
  }

  .print-container {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .print-header {
    border-bottom: 2px solid #000000;
    padding-bottom: 10px;
    margin-bottom: 25px;
    text-align: center;
  }

  .print-header h1 {
    font-size: 20pt;
    margin: 0 0 5px 0;
    color: #000000;
    font-weight: 800;
  }

  .print-header p {
    font-size: 10pt;
    margin: 0;
    color: #555555;
  }

  .print-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
  }

  .print-meta-card {
    border: 1px solid #cccccc;
    padding: 15px;
    border-radius: 8px;
    background: #fdfdfd;
  }

  .print-meta-card h3 {
    font-size: 13pt;
    margin: 0 0 10px 0;
    border-bottom: 1px solid #dddddd;
    padding-bottom: 5px;
    font-weight: 700;
  }

  .print-meta-card p {
    margin: 6px 0;
    font-size: 10.5pt;
  }

  h2 {
    font-size: 14pt;
    border-bottom: 1px solid #000000;
    padding-bottom: 5px;
    margin-top: 25px;
    margin-bottom: 15px;
    font-weight: 800;
  }

  /* Table styling for print */
  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
    font-size: 10pt;
  }

  .print-table th, .print-table td {
    border: 1px solid #aaaaaa;
    padding: 8px 10px;
    text-align: start;
  }

  .print-table th {
    background-color: #f2f2f2 !important;
    font-weight: bold;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-table tr {
    page-break-inside: avoid;
  }

  .print-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    border-top: 1px solid #dddddd;
    padding-top: 10px;
    font-size: 8pt;
    color: #666666;
  }

  /* Force page breaks if report gets long */
  .page-break {
    page-break-before: always;
  }

  /* Custom print section layout */
  .print-section {
    margin-bottom: 30px;
    page-break-inside: avoid;
  }

  .print-section-header {
    font-size: 13pt;
    font-weight: 800;
    border-bottom: 2px solid #5c7cfa;
    padding-bottom: 5px;
    margin-top: 20px;
    margin-bottom: 10px;
    color: #2b2b2b;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .print-stats-summary-bar {
    background: #f1f3f5 !important;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 9.5pt;
    font-weight: bold;
    color: #495057;
    margin-bottom: 15px;
    border-left: 4px solid #5c7cfa;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  [direction="rtl"] .print-stats-summary-bar {
    border-left: none;
    border-right: 4px solid #5c7cfa;
  }

  .print-section-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
  }

  .print-chart-wrapper {
    width: 100%;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 220px;
    page-break-inside: avoid;
  }

  .print-chart-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9.5pt;
  }
}
