/* Mobile-Optimized Print Styles */
@page {
  size: auto;
  margin: 0.25in; /* Smaller margins for mobile */
}

/* Reset for mobile print */
* {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

body { 
  margin: 0; 
  padding: 0; 
  -webkit-text-size-adjust: none; /* Prevent iOS text scaling in print */
}

/* Mobile-specific coloring page image constraints */
.coloring-page-print img,
img.print-coloring {
  /* Multiple fallback strategies for mobile */
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
  
  /* Force single page on mobile - use physical units instead of vh */
  max-height: 9in !important; /* Safe height for most paper sizes */
  
  /* Page break controls with legacy support */
  page-break-inside: avoid !important;
  break-inside: avoid !important;
  page-break-before: auto !important;
  page-break-after: always !important;
  break-before: auto !important;
  break-after: page !important;
  
  /* Mobile-specific display optimizations */
  display: block !important;
  margin: 0 auto !important;
  object-fit: contain !important; /* Ensure image fits within bounds */
  
  /* Force hardware acceleration for better mobile rendering */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* Ensure coloring page container doesn't interfere */
.coloring-page-print {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
  overflow: visible !important;
  height: auto !important;
}

/* Activity print optimizations */
.activity-print .activity-item {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
  margin-bottom: 0.5in !important;
}

/* Word family worksheet mobile optimizations */
.word-family-page {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
  font-size: 14px !important; /* Slightly larger for mobile readability */
}

.word-family-page table {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
  width: 100% !important;
  border-collapse: collapse !important;
}

.word-family-page td {
  padding: 8px !important;
  border: 1px solid #ddd !important;
  font-size: 14px !important;
}

/* Hide print buttons and non-essential elements */
.print-section,
.button-accent,
button,
.no-print {
  display: none !important;
}

/* Mobile print layout fixes */
@media print {
  /* Force single column layout for mobile */
  * {
    float: none !important;
    position: static !important;
  }
  
  /* Ensure proper text rendering on mobile */
  body {
    font-family: Arial, sans-serif !important;
    line-height: 1.4 !important;
    color: #000 !important;
    background: #fff !important;
  }
  
  /* Mobile-specific image handling */
  img {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  
  /* Prevent widows and orphans on mobile */
  p, h1, h2, h3, h4, h5, h6 {
    orphans: 3 !important;
    widows: 3 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
} 