/*
 * Print is always light, regardless of the on-screen theme.
 */

@media print {
  html,
  html[data-theme="dark"] {
    color-scheme: light;

    --tb-bg: #ffffff;
    --tb-bg-alt: #ffffff;
    --tb-surface: #ffffff;
    --tb-surface-alt: #ffffff;
    --tb-surface-raised: #ffffff;
    --tb-text: #111111;
    --tb-text-muted: #333333;
    --tb-heading: #111111;
    --tb-border: #bbbbbb;
    --tb-border-strong: #999999;
    --tb-table-header-bg: #eeeeee;
    --tb-table-stripe-bg: #f7f7f7;
    --tb-table-hover-bg: #ffffff;
    --tb-table-border: #bbbbbb;
    --tb-input-bg: #ffffff;
    --tb-input-fg: #111111;
    --tb-input-border: #bbbbbb;
    --tb-primary: #375a7f;
    --tb-primary-fg: #ffffff;
  }

  html[data-theme="dark"] {
    --tb-link: #1a4f8a;
    --tb-focus: #1a4f8a;
    --tb-cell-neutral-bg: #ffffff;
    --tb-success: #2f7d32;
    --tb-success-bg: #eef7ee;
    --tb-success-text: #1b5e20;
    --tb-success-border: #9ccc9c;
    --tb-warning: #9a6700;
    --tb-warning-bg: #fff8e1;
    --tb-warning-text: #7a4f00;
    --tb-warning-border: #e0c36a;
    --tb-danger: #b42318;
    --tb-danger-bg: #fdecea;
    --tb-danger-text: #8a1c14;
    --tb-danger-border: #e0a39e;
    --tb-info: #1f6feb;
    --tb-info-bg: #e8f1fd;
    --tb-info-text: #1a4f8a;
    --tb-info-border: #9cc3e8;
  }

  @page {
    margin: 12mm;
  }

  html,
  body {
    background: #ffffff !important;
    color: #111111 !important;
  }

  *,
  *::before,
  *::after {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  #sidebar,
  #sidebarBackdrop,
  .navbar,
  .sticky-top,
  #FooterFAB,
  #FooterScrollToTop,
  .fab,
  .tb-nav-trigger,
  .d-print-none,
  .theme-toggle {
    display: none !important;
  }

  .sticky-top {
    position: static !important;
  }

  .tb-page__actions,
  .tb-page__header,
  .tb-filter-bar,
  .tb-toolbar,
  .tb-row-actions,
  .tb-row-open {
    display: none !important;
  }

  .tb-surface,
  .tb-page,
  .tb-table-scroll {
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
    border: 0 !important;
    padding: 0 !important;
  }

  .tb-table,
  .tb-table > thead th,
  .tb-table > tbody > tr > td {
    width: auto !important;
    border-color: #bbbbbb !important;
  }

  .tb-table > thead {
    display: table-header-group !important;
  }

  .wrapper,
  #content {
    display: block !important;
    width: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  .card,
  .modal-content,
  .dropdown-menu,
  .list-group-item,
  .popover,
  .OverviewSection,
  .OverviewSchedule,
  .OverviewGrades,
  .OverviewAttendance,
  .table,
  table {
    background: #ffffff !important;
    color: #111111 !important;
    border-color: #bbbbbb !important;
  }

  .card-header,
  .card-footer,
  .table thead th,
  thead th {
    background: #eeeeee !important;
    color: #111111 !important;
    border-color: #bbbbbb !important;
  }

  .table,
  .table th,
  .table td,
  table,
  table th,
  table td {
    border-color: #bbbbbb !important;
  }

  .cell {
    background: #ffffff !important;
    border: 1px solid #bbbbbb !important;
    color: #111111 !important;
  }

  a,
  a:hover,
  a:focus {
    color: #111111 !important;
    text-decoration: none !important;
  }
}

@media print {
  .attendance-toolbar,
  .attendance-day-picker {
    display: none !important;
  }

  [data-day] {
    display: table-cell !important;
  }

  .attendance-cell,
  button.attendance-cell {
    display: block !important;
    width: 100% !important;
    min-height: 0 !important;
    padding: 4px 6px !important;
    background: #ffffff !important;
    border: 1px solid #bbbbbb !important;
    color: #111111 !important;
    box-shadow: none !important;
    transform: none !important;
  }

  html[data-theme="dark"] .cell,
  html[data-theme="dark"] .attendance-cell,
  html[data-theme="dark"] button.attendance-cell {
    background: #ffffff !important;
    border: 1px solid #bbbbbb !important;
    color: #111111 !important;
  }

  html[data-theme="dark"] .attendance-cell__state {
    color: #333333 !important;
  }

  html[data-theme="dark"] .attendance-cell__state::before {
    display: none !important;
  }

  html[data-theme="dark"] .schedule-card {
    background: #ffffff !important;
    border: 1px solid #bbbbbb !important;
    border-left: var(--schedule-accent-width) solid #bbbbbb !important;
    color: #111111 !important;
    box-shadow: none !important;
  }

  html[data-theme="dark"] [class*="schedule-color--"] {
    background: #ffffff !important;
    color: #111111 !important;
  }

  html[data-theme="dark"] .schedule-card__meta,
  html[data-theme="dark"] .schedule-card__room {
    color: #333333 !important;
    opacity: 1 !important;
  }
}

/*
 * Report card printing from a panel. The panel script sets body.tb-rc-printing
 * for the duration of window.print(). It un-fixes an open student profile
 * dialog and hides the page behind it, so the card is all that prints.
 */

@media print {
  body.tb-rc-printing {
    overflow: visible !important;
  }

  body.tb-rc-printing .modal-backdrop {
    display: none !important;
  }

  body.tb-rc-printing .modal.show {
    position: static !important;
    display: block !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  body.tb-rc-printing .modal.show .modal-dialog {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    max-width: none !important;
    min-height: 0 !important;
    margin: 0 !important;
  }

  body.tb-rc-printing .modal.show .modal-content {
    max-height: none !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body.tb-rc-printing .modal.show .modal-header,
  body.tb-rc-printing .modal.show .modal-footer,
  body.tb-rc-printing .PrintHeader,
  body.tb-rc-printing .nav-tabs,
  body.tb-rc-printing .plusminussign,
  body.tb-rc-printing .tb-table__identity,
  body.tb-rc-printing #SharedStudentProfileSection,
  body.tb-rc-printing #StudentProfileLoadSpinner,
  body.tb-rc-printing .tb-rc-picker,
  body.tb-rc-printing .family-panel__header,
  body.tb-rc-printing .family-page-header {
    display: none !important;
  }

  body.tb-rc-printing .modal.show .modal-body {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  /* .PageBreakAfter sets a break before and after, which leaves blank pages
     here. Only a real card wrapper breaks the page in this print. */
  body.tb-rc-printing .EachRC {
    min-height: 0 !important;
    page-break-before: auto !important;
    break-before: auto !important;
    page-break-after: auto !important;
    break-after: auto !important;
  }

  body.tb-rc-printing .tb-rc-term-break {
    page-break-after: always;
    break-after: page;
  }

  body.tb-rc-printing.modal-open #content .container-fluid > *:not(.modal) {
    display: none !important;
  }

  body.tb-rc-printing .family-panel:not(.OverviewReportCards) {
    display: none !important;
  }
}
