/* ==========================================================================
   Print & PDF Generator Stylesheet
   ========================================================================== */

@media screen {
  .print-view-container {
    padding: 24px;
    max-width: 1100px;
    margin: 0 auto;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 10mm 10mm 10mm;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  }

  /* Hide everything except the print-root */
  nav, header, .app-header, .studio-container, .game-sidebar, .modal-backdrop, .no-print {
    display: none !important;
  }

  .print-root {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .printable-card {
    page-break-inside: avoid;
    break-inside: avoid;
    border: 2px solid #1e293b !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }

  .layout-1-per-page .printable-card {
    page-break-after: always;
    break-after: page;
    height: 94vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
  }

  .layout-2-per-page .printable-card {
    height: 46vh;
    margin-bottom: 20mm;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .layout-2-per-page .printable-card:nth-child(2n) {
    page-break-after: always;
    break-after: page;
    margin-bottom: 0;
  }

  .layout-4-per-page {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    grid-gap: 8mm;
  }

  .layout-4-per-page .printable-card {
    height: 45vh;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .layout-4-per-page .printable-card:nth-child(4n) {
    page-break-after: always;
    break-after: page;
  }
}

/* Base Printable Card Formatting */
.printable-card {
  box-sizing: border-box;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 24px;
  position: relative;
}

.print-card-header {
  text-align: center;
  margin-bottom: 12px;
  position: relative;
}

.print-card-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 4px 0;
  color: #0f172a;
}

.print-card-desc {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0;
}

.print-card-badge {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 0.75rem;
  font-weight: 700;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 6px;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.print-grid {
  display: grid;
  grid-gap: 6px;
  flex: 1;
  margin-bottom: 12px;
}

.print-tile {
  border: 1.5px solid #0f172a;
  border-radius: 6px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 48px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  word-break: break-word;
  line-height: 1.25;
}

.print-tile.is-free-space {
  background: #f8fafc;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 2px dashed #0f172a;
}

.print-tile-img {
  max-width: 40px;
  max-height: 40px;
  object-fit: contain;
  margin-bottom: 4px;
}

.print-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #94a3b8;
  border-top: 1px solid #e2e8f0;
  padding-top: 6px;
}

/* Master Caller Sheet */
.master-call-sheet {
  background: #f8fafc;
}

.call-sheet-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  grid-gap: 8px;
  margin: 16px 0;
}

.call-sheet-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  font-size: 0.85rem;
}

.call-check-box {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1.5px solid #64748b;
  border-radius: 3px;
  flex-shrink: 0;
}

.call-num {
  font-weight: 700;
  color: #64748b;
  font-size: 0.75rem;
}

.call-text {
  font-weight: 500;
  color: #1e293b;
}
