/* Barcode label studio + print sheet */

.product-labels-app {
    --labels-gap: 12px;
    padding: 6px clamp(12px, 1.8vw, 20px) 20px;
    display: grid;
    gap: 12px;
}

.product-labels-app > .bq-page-header,
.product-labels-app > .bq-topbar {
    margin: 0;
}

.product-labels-app > .bq-flash {
    margin: 0;
}

.product-labels-app > .bq-panel {
    margin: 0;
    overflow: visible;
}

.product-labels-toolbar .product-labels-toolbar__row {
    align-items: center;
    padding: 12px 16px;
}

.product-labels-toolbar__actions {
    align-items: center;
}

.product-labels-panel-head {
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 14px !important;
}

.product-labels-panel-head > div:first-child h2 {
    margin: 0;
    line-height: 1.25;
    color: var(--pos-text);
}

.product-labels-panel-head > div:first-child p {
    margin: 4px 0 0;
    line-height: 1.35;
    color: var(--pos-muted);
}

.product-labels-bulk-bar {
    margin: 8px 12px 8px !important;
    padding: 8px 12px !important;
    min-height: 40px;
    box-sizing: border-box;
}

.product-labels-table-wrap {
    padding: 0 8px 8px;
}

.product-labels-table thead th {
    padding: 8px 10px !important;
    vertical-align: middle;
    white-space: nowrap;
    color: var(--pos-muted) !important;
    background: var(--pos-pink-soft) !important;
    font-size: 0.68rem !important;
}

.product-labels-table tbody td {
    padding: 8px 10px !important;
    vertical-align: middle;
    color: var(--pos-text);
    border-bottom-color: var(--pos-border) !important;
}

.product-labels-table tbody tr:hover {
    background: color-mix(in srgb, var(--pos-pink-soft) 55%, #fff) !important;
}

.product-labels-table td[data-label="Price"] {
    font-weight: 700;
    color: var(--pos-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.product-labels-table .labels-print-one {
    background: var(--pos-maroon) !important;
    border-color: var(--pos-maroon) !important;
    color: #fff !important;
    min-height: 32px;
    padding: 6px 12px;
}

.product-labels-table .labels-print-one:hover {
    filter: brightness(1.06);
}

.product-labels-head-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.product-labels-visibility {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: var(--pos-pink-soft, #fce4ef);
    border: 1px solid var(--pos-border);
}

.product-labels-visibility__btn {
    border: none;
    background: transparent;
    color: var(--pos-maroon);
    border-radius: 999px;
    padding: 8px 12px;
    min-height: 36px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1.2;
    box-sizing: border-box;
}

.product-labels-visibility__btn span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5em;
    min-height: 1.5em;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.65);
    font-size: 0.75rem;
    line-height: 1;
}

.product-labels-visibility__btn.is-active {
    background: #fff;
    box-shadow: 0 1px 4px rgba(107, 21, 53, 0.12);
}

.product-labels-toolbar__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
}

.product-labels-toolbar__copy strong {
    display: block;
    color: var(--pos-maroon);
    margin-bottom: 4px;
}

.product-labels-toolbar__copy p {
    margin: 0;
    color: var(--pos-muted);
    font-size: 0.9rem;
    max-width: 52ch;
}

.product-labels-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
}

.product-labels-copies-global {
    display: grid;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--pos-muted);
}

.product-labels-copies-global input {
    width: 72px;
    min-height: 38px;
    border: 1px solid var(--pos-border);
    border-radius: 10px;
    padding: 0 10px;
    font: inherit;
}

.product-labels-search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: min(280px, 100%);
    max-width: 100%;
    padding: 0 6px 0 12px;
    min-height: 40px;
    border: 1px solid var(--pos-border);
    border-radius: 999px;
    background: #fff;
    color: var(--pos-muted);
    box-sizing: border-box;
    overflow: visible;
}

.product-labels-search > .fa-search {
    flex: 0 0 auto;
}

.product-labels-search input {
    border: none;
    outline: none;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    font: inherit;
    color: var(--pos-text);
    background: transparent;
}

.product-labels-search .pos-input-btn.pos-input-btn--camera.product-labels-scan-btn,
.product-labels-scan-btn {
    flex: 0 0 auto;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-width: 34px;
    min-height: 34px;
    width: 34px;
    height: 34px;
    padding: 0 !important;
    margin: 0;
    border-radius: 8px !important;
    border: 1px solid var(--pos-maroon) !important;
    background: var(--pos-maroon) !important;
    color: #fff !important;
    box-shadow: 0 1px 3px color-mix(in srgb, var(--pos-maroon) 18%, transparent);
    z-index: 1;
    position: relative;
    cursor: pointer;
}

.product-labels-search .pos-input-btn.pos-input-btn--camera.product-labels-scan-btn:hover,
.product-labels-scan-btn:hover {
    filter: brightness(1.06);
    border-color: var(--pos-maroon-dark) !important;
    color: #fff !important;
}

.product-labels-search .pos-input-btn.pos-input-btn--camera.product-labels-scan-btn i,
.product-labels-scan-btn .fa-camera {
    font-size: 0.92rem;
    line-height: 1;
    color: inherit !important;
}

.product-labels-scan-btn .pos-input-btn__label {
    display: none;
}

.product-labels-sku {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    color: var(--pos-text);
    font-weight: 600;
}

.product-labels-row.is-missing-sku {
    background: color-mix(in srgb, #fde8ee 35%, #fff);
}

.labels-preview-barcode {
    display: block;
    width: 150px;
    height: 34px;
    max-width: 180px;
    max-height: 40px;
}

.product-labels-preview-cell {
    min-width: 150px;
    vertical-align: middle;
}

.product-labels-preview-cell .labels-preview-barcode {
    background: #fff;
    border: 1px solid var(--pos-border, #dbe4f5);
    border-radius: 6px;
    padding: 4px 6px;
    box-sizing: content-box;
}

/* Combined SKU text + dark block barcode (gaps) */
.bq-sku-barcode-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.bq-barcode-strip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 168px;
    min-width: 168px;
    max-width: 168px;
    height: 52px;
    padding: 4px 6px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #222;
    overflow: hidden;
    line-height: 0;
    vertical-align: middle;
    box-sizing: border-box;
}

.bq-barcode-strip--short {
    width: 168px;
    min-width: 168px;
    max-width: 168px;
    height: 52px;
}

.bq-barcode-strip__canvas {
    display: block;
    width: auto !important;
    max-width: 100%;
    height: 42px !important;
    object-fit: contain;
}

.bq-barcode-strip__blocks {
    display: block;
    width: auto;
    max-width: 100%;
    height: 42px;
}

.product-labels-preview-cell {
    width: 1%;
    white-space: nowrap;
    vertical-align: middle;
    overflow: visible;
}

.product-labels-preview-cell .bq-barcode-strip {
    margin: 0;
}

.product-labels-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: min(100%, 260px);
    padding: 0 10px;
    border: 1px solid var(--pos-border);
    border-radius: 10px;
    background: #fff;
}

.product-labels-search .fa-search {
    color: var(--pos-muted);
    font-size: 0.85rem;
}

.product-labels-search .pos-input,
.product-labels-search input[type="search"] {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    min-height: 38px;
    flex: 1;
    min-width: 0;
}

.labels-preview-barcode {
    display: block;
    width: 88px;
    height: 28px;
    max-width: 92px;
    max-height: 30px;
}

.labels-row-copies {
    width: 64px;
    min-height: 34px;
    border: 1px solid var(--pos-border);
    border-radius: 8px;
    padding: 0 8px;
    font: inherit;
}

/* Select all bar */
.product-labels-bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 12px !important;
    padding: 8px 12px !important;
    border: 1px solid var(--pos-border);
    border-radius: 10px;
    background: var(--pos-pink-soft);
    position: sticky;
    top: 52px;
    z-index: 4;
    box-sizing: border-box;
    min-height: 40px;
}

.product-labels-select-all {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--pos-maroon);
    cursor: pointer;
    user-select: none;
    line-height: 1.2;
}

.product-labels-select-all input,
.labels-row-check,
.product-labels-table thead input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--pos-maroon);
    cursor: pointer;
}

.labels-row-select {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.labels-row-select:has(input:disabled) {
    opacity: 0.45;
    cursor: not-allowed;
}

.product-labels-item-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.product-labels-item-head__text {
    min-width: 0;
    flex: 1 1 auto;
}

.product-labels-item-head__text .bq-cell-title {
    display: block;
    font-weight: 700;
    color: var(--pos-text);
    line-height: 1.3;
}

.product-labels-item-head__text .bq-cell-meta {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--pos-muted);
    line-height: 1.35;
}

.product-labels-selected-count {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--pos-muted);
    white-space: nowrap;
}

.product-labels-table-wrap {
    padding-top: 0;
    overflow-x: auto;
}

/* Print sheet — Technova 21L */
.barcode-print-body {
    margin: 0;
    background: #f3f4f6;
    color: #111;
    font-family: "Segoe UI", Tahoma, sans-serif;
}

.barcode-print-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #ddd;
}

.barcode-print-toolbar button {
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font: inherit;
}

.barcode-print-hint {
    font-size: 0.85rem;
    color: #555;
}

.barcode-label-sheet {
    --lbl-page-w: 210mm;
    --lbl-page-h: 297mm;
    --lbl-top: 15.1mm;
    --lbl-left: 5.2mm;
    --lbl-col-pitch: 66mm;
    --lbl-row-pitch: 37.85mm;
    --lbl-w: 63.5mm;
    --lbl-h: 37.4mm;
    --lbl-inset-x: 1.25mm;
    position: relative;
    width: var(--lbl-page-w);
    height: var(--lbl-page-h);
    margin: 12px auto;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.barcode-label {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.2mm 2mm;
    border: 1px dashed #bbb;
    border-radius: 2px;
    background: #fff;
    width: var(--lbl-w);
    height: var(--lbl-h);
    max-height: var(--lbl-h);
    box-sizing: border-box;
    overflow: hidden;
    page-break-inside: avoid;
    break-inside: avoid;
}

.barcode-label__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.15mm;
    width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
}

.barcode-label__shop,
.barcode-label__sku {
    display: none;
}

.barcode-label__name {
    width: 100%;
    font-size: 9pt;
    font-weight: 800;
    line-height: 1;
    color: #111;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 0 0 auto;
    margin: 0;
}

.barcode-label__meta {
    width: 100%;
    font-size: 8pt;
    font-weight: 700;
    line-height: 1;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 0 0 auto;
    margin: 0 0 0.15mm;
}

.barcode-label__code-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    flex: 0 0 10mm;
    height: 10mm;
    min-height: 10mm;
    max-height: 10mm;
    margin: 0.2mm 0 0;
    padding: 0 0.6mm;
    box-sizing: border-box;
    background: #fff;
}

.barcode-label__code {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: 10mm !important;
    max-height: 10mm;
    width: auto !important;
    image-rendering: pixelated;
}

.barcode-label__price {
    font-size: 12pt;
    font-weight: 800;
    color: #111;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: 0.02em;
    flex: 0 0 auto;
    margin: 0.35mm 0 0;
}

.barcode-label__error {
    font-size: 6pt;
    color: #c00;
}

.barcode-print-empty {
    min-height: 100vh;
    display: grid;
    place-content: center;
    gap: 8px;
    text-align: center;
    padding: 24px;
}

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

    .no-print {
        display: none !important;
    }

    .barcode-print-body {
        background: #fff;
        margin: 0;
        padding: 0;
    }

    .barcode-label-sheet {
        margin: 0 !important;
        box-shadow: none !important;
        page-break-after: always;
        break-after: page;
    }

    .barcode-label-sheet:last-child {
        page-break-after: auto;
        break-after: auto;
    }

    .barcode-label {
        border: none !important;
        border-radius: 0 !important;
        background: transparent !important;
    }
}

@media screen and (max-width: 900px) {
    .barcode-label-sheet {
        transform: scale(0.72);
        transform-origin: top center;
        margin-bottom: -80px;
    }
}

@media screen and (max-width: 640px) {
    .barcode-label-sheet {
        transform: scale(0.48);
        transform-origin: top center;
        margin-bottom: -150px;
    }
}

/* Mobile / tablet — responsive cards */
@media (max-width: 1024px) {
    .product-labels-toolbar__row {
        flex-direction: column;
        align-items: stretch;
        padding: 14px;
    }

    .product-labels-toolbar__copy p {
        display: none;
    }

    .product-labels-toolbar__actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .product-labels-copies-global {
        grid-column: 1 / -1;
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .product-labels-toolbar__actions .pos-chip-btn {
        width: 100%;
        justify-content: center;
        min-height: 42px;
    }

    #labels_print_selected {
        grid-column: 1 / -1;
    }

    .product-labels-panel-head {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px;
    }

    .product-labels-head-tools {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .product-labels-visibility {
        width: 100%;
    }

    .product-labels-visibility__btn {
        flex: 1 1 0;
        min-width: 0;
    }

    .product-labels-search {
        width: 100%;
        min-width: 0;
    }

    .product-labels-bulk-bar {
        margin: 12px 14px;
        padding: 10px 12px;
        position: sticky;
        top: 48px;
        z-index: 5;
    }

    .product-labels-table-wrap {
        overflow: visible;
        padding: 0 0 8px;
    }

    .product-labels-table,
    .product-labels-table tbody {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .product-labels-table thead {
        display: none;
    }

    .product-labels-table tbody tr.product-labels-row {
        display: block;
        width: auto;
        margin: 0 12px 12px;
        padding: 12px 14px;
        border: 1px solid var(--pos-border);
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 1px 6px rgba(107, 21, 53, 0.05);
        box-sizing: border-box;
    }

    .product-labels-table tbody tr.product-labels-row td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        margin: 0;
        padding: 9px 0;
        border: none;
        border-bottom: 1px solid rgba(234, 221, 228, 0.9);
        box-sizing: border-box;
        float: none !important;
        position: static !important;
        text-align: left;
        min-width: 0;
    }

    .product-labels-table tbody tr.product-labels-row td:last-child {
        border-bottom: none;
        padding-bottom: 0;
        padding-top: 12px;
    }

    .product-labels-table tbody tr.product-labels-row td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        max-width: 36%;
        font-size: 0.68rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--pos-muted);
        line-height: 1.3;
    }

    .product-labels-table tbody tr.product-labels-row td.product-labels-product-cell {
        display: block;
        padding-top: 0;
        padding-bottom: 12px;
        border-bottom: 1px dashed var(--pos-border);
    }

    .product-labels-table tbody tr.product-labels-row td.product-labels-product-cell::before {
        content: none !important;
        display: none !important;
    }

    .product-labels-item-head {
        width: 100%;
        gap: 12px;
    }

    .product-labels-item-head .labels-row-check {
        width: 20px;
        height: 20px;
        margin-top: 2px;
    }

    .product-labels-table tbody tr.product-labels-row td[data-label="Actions"]::before {
        content: none !important;
        display: none !important;
    }

    .product-labels-table tbody tr.product-labels-row td > .bq-barcode-strip,
    .product-labels-table tbody tr.product-labels-row td > .bq-badge,
    .product-labels-table tbody tr.product-labels-row td > .product-labels-sku,
    .product-labels-table tbody tr.product-labels-row td > .labels-row-copies,
    .product-labels-table tbody tr.product-labels-row td > .labels-preview-barcode,
    .product-labels-table tbody tr.product-labels-row td > .bq-cell-meta {
        margin-left: auto;
        max-width: 62%;
        text-align: right;
        flex: 0 1 auto;
    }

    .product-labels-table tbody tr.product-labels-row .bq-barcode-strip,
    .product-labels-table tbody tr.product-labels-row .labels-preview-barcode {
        width: 168px !important;
        min-width: 168px !important;
        max-width: 168px !important;
        height: 52px !important;
        max-height: 52px !important;
    }

    .product-labels-table tbody tr.product-labels-row .pos-chip-btn {
        width: 100%;
        justify-content: center;
        min-height: 40px;
    }

    .labels-row-copies {
        width: 72px;
        min-height: 36px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .product-labels-toolbar__actions {
        grid-template-columns: 1fr;
    }
}

.labels-align-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(8, 22, 18, 0.55);
}

.labels-align-dialog {
    width: min(920px, 100%);
    max-height: min(92vh, 900px);
    overflow: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
    padding: 16px 18px 20px;
}

.labels-align-dialog__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.labels-align-dialog__head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.labels-align-dialog__head p,
.labels-align-dialog__hint {
    margin: 4px 0 0;
    color: var(--pos-muted);
    font-size: 0.88rem;
    line-height: 1.4;
}

.labels-align-dialog__hint {
    margin: 10px 0 14px;
}

.labels-align-dialog__tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 20px;
    margin-bottom: 14px;
}

.labels-align-print-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.labels-align-nudge {
    display: grid;
    justify-items: center;
    gap: 6px;
}

.labels-align-nudge__mid {
    display: flex;
    gap: 6px;
}

.labels-align-nudge button,
.labels-align-values input {
    min-height: 36px;
    border: 1px solid var(--pos-border);
    border-radius: 8px;
    background: #fff;
    color: var(--pos-text);
}

.labels-align-nudge button {
    min-width: 40px;
    cursor: pointer;
}

.labels-align-values {
    display: flex;
    gap: 12px;
}

.labels-align-values label {
    display: grid;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--pos-muted);
}

.labels-align-values input {
    width: 88px;
    padding: 0 8px;
}

.labels-align-printer {
    display: grid;
    gap: 6px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f3f6f5;
    border: 1px solid #d7e0dc;
}

.labels-align-printer label {
    display: grid;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--pos-muted);
}

.labels-align-printer select {
    width: 100%;
    max-width: 520px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #c5d0cb;
    background: #fff;
    font-size: 0.9rem;
    color: #1a2b24;
}

.labels-align-printer__hint,
.labels-align-printer__error {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.4;
}

.labels-align-printer__hint {
    color: var(--pos-muted);
}

.labels-align-printer__error {
    color: #b42318;
    font-weight: 600;
}

.labels-align-pages {
    display: grid;
    gap: 12px;
    justify-items: center;
    background: #e8edeb;
    border-radius: 10px;
    padding: 16px 12px;
}

.labels-align-page {
    position: relative;
    width: 104mm;
    height: 25mm;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.labels-align-page img {
    display: block;
    width: 104mm;
    height: 25mm;
    image-rendering: pixelated;
}

.labels-align-page__box {
    position: absolute;
    top: 0;
    height: 25mm;
    width: 50mm;
    box-sizing: border-box;
    border: 1px dashed #c2410c;
    pointer-events: none;
}

.labels-align-page__box--left {
    left: 3mm;
    width: 49mm;
}

.labels-align-page__box--right {
    left: 55mm;
    width: 49mm;
}
