/* =====================================================================
   Barcode-Designer (PRO-Feature "eigenes Layout")
   =====================================================================
   Der Designer liegt als eigenes Fullscreen-Modal ueber dem Modal
   "Barcode Layout". Damit er sicher darueber liegt, bekommt er einen
   hoeheren z-index als das Standard-Modal von Bootstrap/MDB.
   ===================================================================== */

#ModalBarcodeDesign {
    z-index: 1080;
}

/* Zweispaltiger Aufbau: links die Ausgabeflaeche, rechts Palette und
   Eigenschaften des gewaehlten Elements. */
.bcd-wrap {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    height: 100%;
}

.bcd-stage {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bcd-side {
    flex: 0 0 300px;
    max-height: 78vh;
    overflow-y: auto;
}

.bcd-hint {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
}

/* --- Ausgabeflaeche ------------------------------------------------- */

.bcd-canvas-info {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 6px;
}

/* Die Flaeche selbst. Groesse und Seitenverhaeltnis werden per JS
   gesetzt, weil sie aus der Ausgabegroesse (B x H) berechnet werden. */
.bcd-canvas {
    position: relative;
    background: #fff;
    border: 1px solid #999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    user-select: none;
    touch-action: none;
}

.bcd-canvas.bcd-canvas-dragover {
    border-color: #1266f1;
    box-shadow: 0 0 0 3px rgba(18, 102, 241, 0.25);
}

/* Element auf der Flaeche */
.bcd-el {
    position: absolute;
    box-sizing: border-box;
    border: 1px dashed #b5b5b5;
    overflow: hidden;
    cursor: move;
    display: flex;
    padding: 0;
}

.bcd-el:hover {
    border-color: #1266f1;
}

.bcd-el.bcd-selected {
    border: 1px solid #1266f1;
    box-shadow: 0 0 0 2px rgba(18, 102, 241, 0.25);
}

.bcd-el-text {
    width: 100%;
    line-height: 1.15;
    word-break: break-word;
    white-space: pre-wrap;
    color: #000;
}

.bcd-align-L { text-align: left; }
.bcd-align-C { text-align: center; }
.bcd-align-R { text-align: right; }

.bcd-el-bold .bcd-el-text {
    font-weight: 700;
}

/* Farbstreifen */
.bcd-el-stripe {
    border: 1px dashed #b5b5b5;
}

.bcd-stripe-fill {
    width: 100%;
    height: 100%;
    background: #ff0000;
}

.bcd-stripe-fill.bcd-stripe-border {
    border: 1px solid #000;
}

/* Barcode-Element: nicht loeschbar, nur die Hoehe ist verstellbar */
.bcd-el-barcode {
    cursor: default;
    border: 1px dashed #7a7a7a;
    flex-direction: column;
}

.bcd-barcode-bars {
    flex: 1 1 auto;
    width: 100%;
    background-image: repeating-linear-gradient(90deg, #000 0 2px, #fff 2px 4px, #000 4px 5px, #fff 5px 9px);
    min-height: 2px;
}

.bcd-barcode-number {
    width: 100%;
    text-align: center;
    color: #000;
    line-height: 1;
    overflow: hidden;
}

/* Anfasser */
.bcd-handle {
    position: absolute;
    background: #1266f1;
    border: 1px solid #fff;
}

.bcd-handle-se {
    right: -4px;
    bottom: -4px;
    width: 9px;
    height: 9px;
    cursor: nwse-resize;
}

/* Hoehenschieber des Barcodes: nur unten, ueber die volle Breite */
.bcd-handle-s {
    left: 25%;
    right: 25%;
    bottom: -3px;
    height: 6px;
    border-radius: 3px;
    cursor: ns-resize;
}

/* --- Palette --------------------------------------------------------- */

.bcd-panel-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.bcd-palette {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px;
    margin-bottom: 16px;
}

.bcd-palette-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    margin-bottom: 4px;
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    background: #fafafa;
    cursor: grab;
    font-size: 0.9em;
}

.bcd-palette-item:hover {
    border-color: #1266f1;
    background: #f0f5ff;
}

.bcd-palette-item.bcd-palette-used {
    opacity: 0.55;
}

.bcd-palette-icon {
    color: #888;
}

/* --- Eigenschaften --------------------------------------------------- */

.bcd-props {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
}

.bcd-props-empty {
    color: #888;
    font-size: 0.9em;
}

.bcd-prop-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.bcd-prop-row label {
    flex: 0 0 90px;
    font-size: 0.85em;
    margin: 0;
}

.bcd-prop-row .form-control,
.bcd-prop-row .form-select {
    flex: 1 1 auto;
}

.bcd-prop-pair {
    display: flex;
    gap: 6px;
    flex: 1 1 auto;
}

.bcd-prop-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

/* Schalter im Eigenschaften-Panel wieder in den Fluss bringen.
   Global gilt .form-check-input { position: absolute } (css/style.css),
   dadurch rutscht der Schalter sonst aus dem Panel heraus - vgl. den
   gleichen Fix fuer .kl-foot. */
.bcd-prop-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 0;
    min-height: 0;
    margin-bottom: 8px;
}

/* Bewusst hohe Spezifitaet: die Regel muss sowohl den globalen Override
   in css/style.css als auch die Switch-Regeln aus mdb.min.css schlagen.
   Die Offsets werden mit zurueckgesetzt, falls MDB welche vorgibt.
   Wichtig: relative, nicht static. Der Knopf des Schalters ist bei MDB ein
   ::after mit position:absolute und braucht das Input als Bezugspunkt -
   bei static waere er unsichtbar. relative haelt das Element trotzdem im
   normalen Fluss. */
.bcd-side .bcd-props .bcd-prop-switch input.form-check-input {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    float: none;
    margin: 0;
    flex: 0 0 auto;
    align-self: center;
}

.bcd-side .bcd-props .bcd-prop-switch .form-check-label {
    margin: 0;
    font-size: 0.85em;
    cursor: pointer;
}

/* Zeile mit dem Button "Design bearbeiten" im Modal "Barcode Layout".
   Sie ersetzt bei "- eigenes Layout -" den Splitter-Switch. */
.bcl-design-row-hidden {
    display: none;
}
