/* Print-optimized styles for calendar */
/* Full-screen preview and full A4 print output */

/* ============================================
   BASE STYLES (Screen Preview)
   ============================================ */

/* Scoped to print layout only - prevents affecting other pages */
html:has(.print-body) {
  height: 100%;
  overflow: hidden;
}

body.print-body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 12pt;
  line-height: 1.4;
  color: #000;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.print-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px;
  box-sizing: border-box;
}

/* Header */
.print-header {
  flex-shrink: 0;
  border-bottom: 2px solid #000;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.print-header h1 {
  font-size: 24pt;
  font-weight: bold;
  margin: 0 0 5px 0;
}

.print-header .print-subtitle {
  font-size: 14pt;
  color: #333;
  margin: 0;
}

.print-header .print-meta {
  font-size: 10pt;
  color: #666;
  margin-top: 5px;
}

/* Print actions (hidden when printing) */
.print-actions {
  flex-shrink: 0;
  margin-bottom: 15px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.print-orientation-hint {
  font-size: 10pt;
  color: #666;
  margin-left: auto;
}

/* Content area - fills remaining space */
.print-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Footer */
.print-footer {
  flex-shrink: 0;
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid #ccc;
  font-size: 9pt;
  color: #666;
  text-align: center;
}

/* ============================================
   DAY VIEW
   ============================================ */

.print-day {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.print-day-header {
  flex-shrink: 0;
  font-size: 14pt;
  font-weight: bold;
  border-bottom: 1px solid #ccc;
  padding-bottom: 5px;
  margin-bottom: 10px;
}

.print-day-events {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.print-event {
  display: flex;
  gap: 15px;
  padding: 12px 0;
  border-bottom: 1px dotted #ddd;
  page-break-inside: avoid;
}

.print-event:last-child {
  border-bottom: none;
}

.print-event-time {
  flex-shrink: 0;
  width: 100px;
  font-weight: 500;
  font-size: 11pt;
}

.print-event-details {
  flex: 1;
}

.print-event-title {
  font-weight: 600;
  font-size: 12pt;
}

.print-event-location {
  font-size: 10pt;
  color: #555;
  margin-top: 2px;
}

.print-event-children {
  margin-top: 4px;
}

.print-child-tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 9pt;
  border: 1px solid #000;
  border-radius: 3px;
  margin-right: 4px;
}

.print-event-type {
  font-size: 10pt;
  color: #666;
  text-transform: capitalize;
  flex-shrink: 0;
}

.print-event-notes {
  font-size: 10pt;
  color: #555;
  font-style: italic;
  margin-top: 4px;
}

/* ============================================
   WEEK VIEW
   ============================================ */

.print-week-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto 1fr;
  gap: 1px;
  background: #000;
  border: 1px solid #000;
  min-height: 0;
}

.print-week-day {
  background: #fff;
  padding: 5px;
  font-size: 10pt;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.print-week-day-header {
  flex-shrink: 0;
  font-weight: bold;
  font-size: 9pt;
  text-align: center;
  padding: 5px;
  border-bottom: 1px solid #ccc;
  margin-bottom: 5px;
  background: #f5f5f5;
}

.print-week-day-date {
  font-size: 14pt;
  display: block;
}

.print-week-day-content {
  flex: 1;
  overflow: hidden;
}

.print-week-event {
  padding: 3px;
  margin-bottom: 3px;
  border-left: 3px solid #000;
  font-size: 9pt;
  page-break-inside: avoid;
}

.print-week-event-time {
  font-size: 8pt;
  color: #555;
}

/* ============================================
   MONTH VIEW
   ============================================ */

.print-month-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto repeat(6, 1fr);
  gap: 1px;
  background: #000;
  border: 1px solid #000;
  min-height: 0;
}

.print-month-header {
  background: #eee;
  font-weight: bold;
  text-align: center;
  padding: 8px;
  font-size: 10pt;
}

.print-month-day {
  background: #fff;
  padding: 5px;
  font-size: 9pt;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.print-month-day.outside {
  background: #f9f9f9;
  color: #999;
}

.print-month-day-number {
  flex-shrink: 0;
  font-weight: bold;
  font-size: 11pt;
  margin-bottom: 3px;
}

.print-month-day-events {
  flex: 1;
  overflow: hidden;
}

.print-month-event {
  padding: 2px 4px;
  margin-bottom: 2px;
  border-left: 2px solid #000;
  font-size: 8pt;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   NO EVENTS MESSAGE
   ============================================ */

.print-no-events {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  color: #666;
  font-style: italic;
  font-size: 14pt;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  /* Hide non-printable elements */
  .print-actions {
    display: none !important;
  }

  /* Reset body for print */
  html, body {
    height: auto;
    overflow: visible;
  }

  .print-body {
    padding: 0;
    height: 100%;
  }

  .print-container {
    padding: 0;
    height: 100%;
  }

  /* Ensure black text for all elements */
  * {
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-child-tag {
    background: #fff !important;
    border: 1px solid #000 !important;
  }

  /* Page break utilities */
  .page-break-before {
    page-break-before: always;
  }

  .page-break-after {
    page-break-after: always;
  }
}

/* Default: Portrait for day and month views */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }
}

/* Landscape for week view */
@media print {
  body[data-view="week"] {
    /* Week view renders better in landscape */
  }
}

/* Week view specific page settings */
@page week {
  size: A4 landscape;
  margin: 10mm;
}

body[data-view="week"] {
  page: week;
}

/* Day view specific page settings */
@page day {
  size: A4 portrait;
  margin: 10mm;
}

body[data-view="day"] {
  page: day;
}

/* Month view specific page settings */
@page month {
  size: A4 portrait;
  margin: 10mm;
}

body[data-view="month"] {
  page: month;
}
