/* Etiquetas SDPGO: estilos compartidos por el editor de plantillas y la vista de impresion.
   La geometria (posicion/tamano/fuente) llega inline desde LabelHtmlRenderer; aqui solo
   va la presentacion, de modo que editor e impresion se ven identicos. */

.sdpgo-label {
    position: relative;
    background: #fff;
    color: #0f172a;
    overflow: hidden;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, sans-serif;
}

.sdpgo-label * { box-sizing: border-box; }

.sdpgo-label--design {
    outline: 1px solid rgba(196, 198, 207, .7);
    user-select: none;
    touch-action: none;
    background-image:
        linear-gradient(to right, rgba(15, 23, 42, .06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(15, 23, 42, .06) 1px, transparent 1px);
    background-size: 16px 16px;
}

.lbl-box {
    position: absolute;
    border: 1px solid #031f41;
    background: transparent;
    pointer-events: none;
}

.lbl-text {
    position: absolute;
    overflow: hidden;
    line-height: 1.1;
}

.sdpgo-label--design .lbl-text,
.sdpgo-label--design .lbl-qr { cursor: grab; }

.lbl-cap {
    font-weight: 700;
    letter-spacing: .04em;
    color: #031f41;
    text-transform: uppercase;
    line-height: 1.05;
}

.lbl-val {
    color: #0f172a;
    font-weight: 700;
    line-height: 1.12;
    word-break: break-word;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lbl-text--hl .lbl-val { font-weight: 800; }

.lbl-qr { position: absolute; background: #fff; }
.lbl-qr svg { width: 100%; height: 100%; display: block; }

.lbl-barcode {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
}

.lbl-barcode__bars { width: 100%; flex: 1 1 auto; min-height: 0; }
.lbl-barcode__bars svg { width: 100%; height: 100%; display: block; }

.lbl-barcode span { line-height: 1; color: #0f172a; }

.lbl-img { position: absolute; }
.lbl-img img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.sdpgo-label--design .lbl-img { cursor: grab; }

/* ============================================================================================
   Plancha A4 de 4 etiquetas (LabelSheetHtmlRenderer). La geometria llega inline en mm, calculada en
   LabelSheetLayout.Fit: aca solo va la presentacion. Cada hoja es exactamente una pagina A4 y las
   celdas van en posicion absoluta, asi un ajuste fino negativo corre la plancha en vez de romperla.
   ============================================================================================ */
.hoja4-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.hoja4-hoja {
    position: relative;
    flex: none;
    width: 210mm;
    height: 297mm;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 12px rgba(15, 23, 42, .18);
}

.hoja4-celda {
    position: absolute;
    outline: 1px dashed rgba(15, 23, 42, .22);
}

.hoja4-escala {
    position: absolute;
    overflow: hidden;
}

.hoja4-celda__usada {
    align-items: center;
    color: #94a3b8;
    display: flex;
    font-size: .72rem;
    font-weight: 700;
    height: 100%;
    justify-content: center;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* Franja que la impresora no alcanza: solo en pantalla, para que se vea por que la etiqueta no llega
   al borde del papel. El ancho del borde llega inline desde la calibracion. */
.hoja4-noimprimible {
    position: absolute;
    inset: 0;
    z-index: 2;
    border-style: solid;
    border-color: rgba(220, 38, 38, .16);
    pointer-events: none;
}

/* Marcos de calibracion: troquel en linea continua, zona de la etiqueta en discontinua. */
.hoja4-marco {
    position: absolute;
    inset: 0;
    border: .3mm solid #0f172a;
}

.hoja4-marco__zona {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5mm;
    border: .3mm dashed #0f172a;
    color: #0f172a;
    font-family: 'Inter', system-ui, sans-serif;
}

.hoja4-marco__numero {
    font-size: 28pt;
    font-weight: 800;
    line-height: 1;
}

.hoja4-marco__medida {
    font-size: 9pt;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

@media print {
    .hoja4-stack {
        display: block;
    }

    .hoja4-hoja {
        box-shadow: none;
        break-after: page;
        break-inside: avoid;
    }

    /* Sin pagina en blanco al final. */
    .hoja4-hoja:last-child {
        break-after: auto;
    }

    .hoja4-celda {
        outline: none;
    }
}

.label-preview-resize-handle {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: linear-gradient(135deg, transparent 0 30%, #1d3557 30% 40%, transparent 40% 55%, #1d3557 55% 65%, transparent 65% 100%);
    cursor: ew-resize;
    opacity: .85;
}
