/**
 * @file
 * Print stylesheet — A4 portrait, single-column layout.
 */

/* ══════════════════════════════════════════════════════
   PAGE SETUP — A4 portrait
══════════════════════════════════════════════════════ */
@page {
  size: A4 portrait;
  margin: 1cm 1cm 1.8cm;
  @bottom-center {
    content: counter(page) ' / ' counter(pages);
    font-size: 0.65rem;
    color: #666;
    font-family: sans-serif;
  }
}

* {
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

html, body {
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  height: auto !important;
  overflow: visible !important;
}

.dsg-page,
.dsg-right,
.layout-container,
.layout-content,
.stats-dashboard {
  border: none !important;
  border-bottom: none !important;
  outline: none !important;
}

/* ══════════════════════════════════════════════════════
   ΚΡΥΨΕ ΠΛΟΗΓΗΣΗ & UI ΣΤΟΙΧΕΙΑ
══════════════════════════════════════════════════════ */
.dsg-sidebar,
.petitions-header-title,
.layout-highlighted,
#toolbar-bar,
#toolbar-administration,
.toolbar-tab,
.toolbar-tray,
.stats-filter-bar,
.chart-card-menu,
.stats-bottom-bar-top .custom-select-wrapper,
.stats-bottom-bar-top .stats-select-wrapper,
.stats-bg-text {
  display: none !important;
}

/* ══════════════════════════════════════════════════════
   LAYOUT — FULL WIDTH
══════════════════════════════════════════════════════ */
[data-off-canvas-main-canvas] {
  height: auto !important;
  overflow: visible !important;
}

.dsg-page {
  display: block !important;
  width: 100% !important;
  min-height: unset !important;
  height: auto !important;
}

.dsg-right {
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: unset !important;
  height: auto !important;
  overflow: visible !important;
}

.layout-container {
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100% !important;
}

.layout-content {
  padding: 0 !important;
  margin: 0 !important;
}

/* ══════════════════════════════════════════════════════
   PRINT HEADER
══════════════════════════════════════════════════════ */
.stats-dashboard::before {
  content: 'Dashboard Στατιστικων';
  display: block;
  width: 100%;
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-bottom: 0.5rem;
  margin-bottom: 0.7rem;
  border-bottom: 0.125rem solid #2135B2;
}

/* ══════════════════════════════════════════════════════
   DASHBOARD — SINGLE COLUMN
   display:contents flattens columns for individual ordering
══════════════════════════════════════════════════════ */
.stats-dashboard {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.6rem !important;
  width: 100% !important;
  min-height: unset !important;
  background-color: white !important;
  padding: 0.7rem !important;
  box-sizing: border-box !important;
}

.stats-left-col,
.stats-right-col { display: contents !important; }

.stats-category-list                              { order: 1 !important; }
.stats-summary-grid                               { order: 2 !important; }
.stats-monthly-wrap                               { order: 3 !important; }
.stats-right-col > .stats-charts-row:nth-child(2) { order: 4 !important; }
.stats-right-col > .stats-charts-row:nth-child(3) { order: 5 !important; }
.stats-bottom-bar-wrap                            { order: 6 !important; }

/* ══════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════ */
.stats-card {
  box-shadow: none !important;
  border: 0.05rem solid #dde3f5 !important;
  border-radius: 0.5rem !important;
  background: #fff !important;
  padding: 0.7rem 0.9rem !important;
  break-inside: avoid !important;
  page-break-inside: avoid !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

/* ══════════════════════════════════════════════════════
   SUMMARY GRID — 2×2
══════════════════════════════════════════════════════ */
.stats-summary-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 0.5rem !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.summary-card {
  padding: 0.6rem 0.8rem !important;
  break-inside: avoid !important;
}

.summary-icon img {
  width: 36px !important;
  height: 36px !important;
}

.summary-value {
  font-size: 1.5rem !important;
  line-height: 1.2 !important;
}

.summary-label {
  font-size: 0.7rem !important;
  line-height: 1.3 !important;
}

/* ══════════════════════════════════════════════════════
   CHARTS ROWS — δύο charts δίπλα-δίπλα
══════════════════════════════════════════════════════ */
.stats-charts-row {
  display: flex !important;
  flex-direction: row !important;
  gap: 0.5rem !important;
  width: 100% !important;
}

.stats-charts-row .stats-card {
  flex: 1 !important;
  min-width: 0 !important;
}

.chart-card-title {
  font-size: 0.72rem !important;
  min-height: unset !important;
  line-height: 1.3 !important;
}

.chart-canvas-wrap {
  height: 7rem !important;
}

.stats-line-card .chart-canvas-wrap {
  height: 7.5rem !important;
}

/* ══════════════════════════════════════════════════════
   CATEGORY LIST
══════════════════════════════════════════════════════ */
.stats-category-list {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

.stats-category-item {
  min-height: 2.2rem !important;
  padding: 0.15rem 0.6rem !important;
  gap: 1.2rem !important;
  font-size: 0.78rem !important;
}

.cat-name  { font-size: 0.78rem !important; }
.cat-rank  { font-size: 0.78rem !important; }
.cat-count { font-size: 0.8rem !important;  }

/* ══════════════════════════════════════════════════════
   MONTHLY COMPARISON
══════════════════════════════════════════════════════ */
.stats-monthly-wrap {
  height: auto !important;
  gap: 0.6rem !important;
  break-inside: avoid !important;
}

.stats-monthly-header {
  margin-bottom: 0 !important;
}

.stats-monthly-chart-wrap {
  height: 6rem !important;
}

.year-title-main { font-size: 1rem !important; }
.year-title-sub  { font-size: 0.72rem !important; }
.pct-value       { font-size: 1.2rem !important; }
.monthly-sub     { font-size: 0.65rem !important; }

/* ══════════════════════════════════════════════════════
   WORK ORDER CARD
══════════════════════════════════════════════════════ */
.stats-bottom-bar-wrap {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  break-before: page !important;
  page-break-before: always !important;
}

.stats-bottom-bar-top {
  justify-content: flex-end !important;
  position: relative !important;
}

.stats-bottom-bar-header {
  flex-shrink: 0 !important;
}

.bottom-bar-value { font-size: 1.5rem !important; }
.bottom-bar-label { font-size: 0.68rem !important; }

/* Επιλεγμένη κατηγορία — ορατή μόνο στην εκτύπωση, στοιχισμένη αριστερά
   (το select κρύβεται, οπότε δείχνουμε το όνομα ως κείμενο) */
.bottom-bar-print-category {
  display: block !important;
  position: absolute !important;
  left: 0 !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  margin-top: 0 !important;
  max-width: 55% !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  color: #2135B2 !important;
}

.stats-bottom-bar-chart-wrap {
  height: 14rem !important;
  max-height: 14rem !important;
  overflow: hidden !important;
}

.stats-bottom-bar-chart-wrap canvas {
  height: 14rem !important;
  max-height: 14rem !important;
}

/* ══════════════════════════════════════════════════════
   LEGENDS
══════════════════════════════════════════════════════ */
.stats-ring-legend {
  margin-top: 0.35rem !important;
  font-size: 0.68rem !important;
  gap: 0.3rem !important;
}

.ring-legend-item { font-size: 0.68rem !important; }

.stats-pie-legend {
  margin-top: auto !important;
  font-size: 0.68rem !important;
  gap: 0.6rem !important;
}

.legend-item { font-size: 0.68rem !important; }
