/* "Print labels" modal (product/view.php) + the hidden area used to
   actually print, shared by backend and frontend. */

.print-labels-modal .modal-body {
  max-height: 60vh;
  overflow-y: auto;
}

.print-label-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #e2e8f0;
}

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

.print-label-row__thumb {
  flex-shrink: 0;
  width: 90px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  background: #fff;
  padding: 4px;
}

.print-label-row__thumb svg {
  max-width: 100%;
  max-height: 100%;
}

.print-label-row__info {
  flex: 1 1 auto;
  min-width: 0;
}

.print-label-row__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
}

.print-label-row__code {
  font-size: 0.8rem;
  color: #64748b;
  word-break: break-all;
}

.print-label-row__qty {
  width: 72px;
  flex-shrink: 0;
}

.print-labels-missing .badge-missing {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  margin: 8px 8px 0 0;
}

/* Populated with cloned label templates right before window.print() —
   invisible the rest of the time, and the only thing left on the page
   once print media kicks in. */
.print-labels-area {
  display: none;
}

@media print {
  /* .print-labels-area sits deep inside the app's sidebar/header chrome, not
     as a direct child of <body> — `visibility` (unlike `display: none`)
     lets a descendant opt back into being shown even though every ancestor
     around it is hidden, which is what makes this work at any nesting
     depth. */
  body * {
    visibility: hidden;
  }

  .print-labels-area,
  .print-labels-area * {
    visibility: visible;
  }

  .print-labels-area {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6mm;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
  }

  .print-labels-area .label {
    width: 50mm;
    height: 32mm;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2mm;
    box-sizing: border-box;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .print-labels-area .label svg {
    max-width: 100%;
    max-height: 75%;
  }

  .print-labels-area .label .code-text {
    font-size: 9px;
    margin-top: 2mm;
    text-align: center;
    word-break: break-all;
  }

  @page {
    margin: 5mm;
  }
}
