/* Druckdesigner – Produktseite und Editor */

.bb-dd {
    --bb-dd-accent: var(--bs-primary, #0b6bcb);
    --bb-dd-border: #dde1e6;
    --bb-dd-muted: #6b7280;
    --bb-dd-stage: #eef0f3;
    margin-bottom: 1rem;
}

.bb-dd-headline {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: .25rem;
}

.bb-dd-description {
    color: var(--bb-dd-muted);
    font-size: .9rem;
    margin-bottom: .5rem;
}

.bb-dd-teaser {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: .5rem;
    background: var(--bb-dd-stage);
    border: 1px dashed #c3c9d1;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
}

.bb-dd-teaser:hover,
.bb-dd-teaser:focus-visible {
    border-color: var(--bb-dd-accent);
}

.bb-dd-teaser-preview {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.bb-dd-teaser-preview canvas {
    display: block;
    max-width: 100%;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .15));
}

.bb-dd-teaser-empty {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .85);
    color: var(--bb-dd-muted);
    font-size: .875rem;
    white-space: nowrap;
}

.bb-dd-open {
    width: 100%;
}

.bb-dd-status {
    min-height: 1.25rem;
    margin-top: .35rem;
    font-size: .85rem;
    color: var(--bb-dd-muted);
}

.bb-dd-status.is-busy::before {
    content: "";
    display: inline-block;
    width: .85em;
    height: .85em;
    margin-right: .4em;
    vertical-align: -.1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: bb-dd-spin .8s linear infinite;
}

.bb-dd-error {
    color: var(--bs-danger, #c0392b);
    font-weight: 600;
}

/* ---------------- Editor ---------------- */

body.bb-dd-no-scroll {
    overflow: hidden;
}

.bb-dd-modal {
    --bb-dd-accent: var(--bs-primary, #0b6bcb);
    --bb-dd-border: #dde1e6;
    --bb-dd-muted: #6b7280;
    --bb-dd-stage: #eef0f3;
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: rgba(17, 24, 39, .55);
}

.bb-dd-modal[hidden] {
    display: none;
}

.bb-dd-dialog {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1400px;
    height: 100%;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}

@media (min-width: 992px) {
    .bb-dd-dialog {
        height: calc(100% - 40px);
        margin: 20px;
        border-radius: 10px;
        overflow: hidden;
    }
}

.bb-dd-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--bb-dd-border);
}

.bb-dd-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.bb-dd-title strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bb-dd-tools {
    display: flex;
    gap: 6px;
}

.bb-dd-tool,
.bb-dd-close {
    width: 38px;
    height: 38px;
    border: 1px solid var(--bb-dd-border);
    border-radius: 6px;
    background: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.bb-dd-tool:disabled {
    opacity: .4;
    cursor: default;
}

.bb-dd-close {
    font-size: 26px;
}

.bb-dd-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Oben: Fläche + Elementliste */
.bb-dd-top {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
}

.bb-dd-side {
    padding: 0 16px;
    border-top: 1px solid var(--bb-dd-border);
}

@media (min-width: 992px) {
    .bb-dd-body {
        overflow: hidden;
    }

    .bb-dd-top {
        flex-direction: row;
        min-height: 0;
    }

    .bb-dd-top .bb-dd-stage {
        flex: 1 1 auto;
        min-width: 0;
    }

    .bb-dd-side {
        flex: 0 0 280px;
        min-height: 0;
        overflow-y: auto;
        padding: 0 16px;
        border-top: 0;
        border-left: 1px solid var(--bb-dd-border);
    }
}

.bb-dd-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 160px;
    background: var(--bb-dd-stage);
    overflow: hidden;
}

@media (max-width: 991.98px) {
    .bb-dd-stage {
        flex: 0 0 42vh;
    }
}

.bb-dd-canvas {
    position: absolute;
    inset: 0;
    display: block;
    touch-action: none;
    outline: none;
}

.bb-dd-hint {
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    max-width: calc(100% - 20px);
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .9);
    color: #8a1c27;
    font-size: .75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    pointer-events: none;
}

.bb-dd-toast {
    position: absolute;
    left: 50%;
    top: 12px;
    transform: translate(-50%, -10px);
    max-width: calc(100% - 24px);
    padding: 8px 14px;
    border-radius: 6px;
    background: rgba(17, 24, 39, .92);
    color: #fff;
    font-size: .875rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}

.bb-dd-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.bb-dd-busy {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, .7);
    font-weight: 600;
}

.bb-dd-busy[hidden] {
    display: none;
}

.bb-dd-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--bb-dd-accent);
    border-right-color: transparent;
    border-radius: 50%;
    animation: bb-dd-spin .8s linear infinite;
}

@keyframes bb-dd-spin {
    to {
        transform: rotate(360deg);
    }
}

.bb-dd-panel {
    flex: 0 0 auto;
    padding: 4px 16px 16px;
    border-top: 1px solid var(--bb-dd-border);
}

/* Unten: Form, Hintergrund, Hinzufügen | Einstellungen des gewählten Elements */
@media (min-width: 992px) {
    .bb-dd-panel {
        flex: 1 1 auto;
        min-height: 0;
        display: grid;
        grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.5fr);
        gap: 0 28px;
        padding: 0 20px;
        overflow: hidden;
    }

    .bb-dd-col {
        min-height: 0;
        overflow-y: auto;
        padding-bottom: 12px;
    }

    .bb-dd-col .bb-dd-section:last-child {
        border-bottom: 0;
    }

    .bb-dd-backgrounds {
        grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    }

    .bb-dd-contours {
        grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    }

    .bb-dd-contour-icon {
        height: 30px;
    }
}

.bb-dd-section {
    padding: 12px 0;
    border-bottom: 1px solid var(--bb-dd-border);
}

.bb-dd-section:last-child {
    border-bottom: 0;
}

.bb-dd-section-title {
    margin: 0 0 8px;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--bb-dd-muted);
}

.bb-dd-muted {
    color: var(--bb-dd-muted);
    font-size: .85rem;
}

.bb-dd-backgrounds {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
}

.bb-dd-bg {
    position: relative;
    aspect-ratio: 1;
    padding: 0;
    border: 2px solid var(--bb-dd-border);
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
}

.bb-dd-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bb-dd-bg.is-none span {
    font-size: .75rem;
    color: var(--bb-dd-muted);
}

.bb-dd-bg.is-active {
    border-color: var(--bb-dd-accent);
    box-shadow: 0 0 0 2px var(--bb-dd-accent);
}

.bb-dd-add-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.bb-dd-add {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.bb-dd-add-icon {
    font-weight: 700;
}

.bb-dd-layers {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bb-dd-layer {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 4px;
    margin-bottom: 4px;
    transition: transform .15s ease;
}

.bb-dd-layers.is-sorting {
    user-select: none;
}

.bb-dd-layer.is-dragging {
    z-index: 2;
    transition: none;
    opacity: .92;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
    border-radius: 6px;
}

.bb-dd-layer-handle {
    flex: 0 0 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #8a939c;
    font-size: .8rem;
    letter-spacing: -2px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.bb-dd-layer-handle:hover {
    background: var(--bb-dd-stage);
    color: #333;
}

.bb-dd-layers.is-sorting,
.bb-dd-layers.is-sorting * {
    cursor: grabbing;
}

.bb-dd-layer-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 6px;
}

.bb-dd-layer-tools[hidden],
.bb-dd-layer-hint[hidden] {
    display: none;
}

.bb-dd-layer-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    font-size: .78rem;
}

.bb-dd-layer-tool-icon {
    font-size: .9rem;
    line-height: 1;
}

.bb-dd-layer-hint {
    margin-top: 4px;
    font-size: .74rem;
}

.bb-dd-layer-main {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--bb-dd-border);
    border-radius: 6px;
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.bb-dd-layer.is-active .bb-dd-layer-main {
    border-color: var(--bb-dd-accent);
    background: rgba(11, 107, 203, .06);
}

.bb-dd-layer-icon {
    flex: 0 0 22px;
    height: 22px;
    border-radius: 4px;
    background: var(--bb-dd-stage);
    font-weight: 700;
    font-size: .8rem;
    line-height: 22px;
    text-align: center;
}

.bb-dd-layer-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bb-dd-warn-dot {
    flex: 0 0 18px;
    height: 18px;
    border-radius: 50%;
    background: #f0ad4e;
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.bb-dd-field {
    display: block;
    margin-bottom: 12px;
}

.bb-dd-field-label {
    display: block;
    margin-bottom: 4px;
    font-size: .85rem;
    font-weight: 600;
}

.bb-dd-slider-value {
    font-weight: 400;
    color: var(--bb-dd-muted);
}

.bb-dd-color-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.bb-dd-color {
    width: 44px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--bb-dd-border);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.bb-dd-hex {
    width: 100px;
    font-family: monospace;
}

.bb-dd-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bb-dd-swatch {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, .25);
    border-radius: 50%;
    cursor: pointer;
}

.bb-dd-align .btn {
    font-size: .8rem;
}

.bb-dd-image-name {
    margin-bottom: 10px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.bb-dd-dpi {
    margin: -4px 0 12px;
    font-size: .82rem;
    color: var(--bb-dd-muted);
}

.bb-dd-dpi.is-warning {
    padding: 6px 8px;
    border-radius: 6px;
    background: #fff4e0;
    color: #8a5300;
}

.bb-dd-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bb-dd-select-hint {
    padding: 12px 0;
}

.bb-dd-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--bb-dd-border);
}

.bb-dd-done {
    min-width: 160px;
}

/* ---------------- Warenkorb / Bestellung ---------------- */

.bb-dd-summary {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: .25rem;
    font-size: .875rem;
}

.bb-dd-summary-preview img {
    display: block;
    width: 96px;
    max-height: 96px;
    object-fit: contain;
    border: 1px solid #e3e6ea;
    border-radius: 4px;
    background: #fff;
}

.bb-dd-summary-list {
    margin: 0;
    min-width: 0;
}

.bb-dd-summary-row {
    display: flex;
    gap: .35rem;
}

.bb-dd-summary-row dt {
    font-weight: 400;
    color: #6b7280;
    white-space: nowrap;
}

.bb-dd-summary-row dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.bb-dd-summary-swatch {
    display: inline-block;
    width: .85em;
    height: .85em;
    margin-right: .25em;
    border: 1px solid rgba(0, 0, 0, .3);
    border-radius: 50%;
    vertical-align: -.05em;
}

.bb-dd-reuse {
    display: block;
    padding: 0;
    margin-top: .15rem;
    font-size: .875rem;
    text-align: left;
}

.bb-dd-contours {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
}

.bb-dd-contour {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 6px 6px;
    border: 2px solid var(--bb-dd-border);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    text-align: center;
}

.bb-dd-contour.is-active {
    border-color: var(--bb-dd-accent);
    box-shadow: 0 0 0 2px var(--bb-dd-accent);
}

.bb-dd-contour-icon {
    width: 100%;
    height: 44px;
}

.bb-dd-contour-icon path {
    fill: #e9e2d6;
    stroke: #333;
    stroke-width: 1.2;
    stroke-linejoin: round;
}

.bb-dd-contour.is-active .bb-dd-contour-icon path {
    fill: color-mix(in srgb, var(--bb-dd-accent) 22%, #fff);
}

.bb-dd-contour-name {
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.bb-dd-contour-size {
    font-size: .72rem;
    color: var(--bb-dd-muted);
}

/* Farbwähler */

.bb-dd-cp {
    width: 100%;
}

.bb-dd-cp-swatch {
    width: 44px;
    height: 38px;
    flex: 0 0 44px;
    border: 1px solid var(--bb-dd-border);
    border-radius: 6px;
    box-shadow: inset 0 0 0 3px #fff;
    cursor: pointer;
}

.bb-dd-cp-pop {
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--bb-dd-border);
    border-radius: 8px;
    background: #fff;
}

.bb-dd-cp-pop[hidden] {
    display: none;
}

.bb-dd-cp-sv {
    position: relative;
    height: 140px;
    border-radius: 6px;
    background-image: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent);
    cursor: crosshair;
    touch-action: none;
}

.bb-dd-cp-sv-knob,
.bb-dd-cp-hue-knob {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.bb-dd-cp-hue {
    position: relative;
    height: 16px;
    margin: 12px 0 10px;
    border-radius: 8px;
    background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
    cursor: pointer;
    touch-action: none;
}

.bb-dd-cp-hue-knob {
    top: 50%;
}

/* Effekte */

.bb-dd-fx {
    margin-bottom: 12px;
}

.bb-dd-fx-item {
    margin-bottom: 6px;
    border: 1px solid var(--bb-dd-border);
    border-radius: 6px;
}

.bb-dd-fx-item.is-on {
    border-color: var(--bb-dd-accent);
}

.bb-dd-fx-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 10px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
}

.bb-dd-fx-head .form-check-input {
    margin: 0;
}

.bb-dd-fx-body {
    padding: 0 10px 4px;
}

.bb-dd-fx-body[hidden] {
    display: none;
}

/* Reiter für Eigenschaften */

.bb-dd-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--bb-dd-border);
}

.bb-dd-tab {
    padding: 6px 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--bb-dd-muted);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}

.bb-dd-tab.is-active {
    border-bottom-color: var(--bb-dd-accent);
    color: inherit;
}

.bb-dd-tab-pane[hidden] {
    display: none;
}

.bb-dd-note {
    margin: -2px 0 8px;
    font-size: .78rem;
}

/* Kompakte Regler: Beschriftung und Regler in einer Zeile */

.bb-dd-slider {
    display: grid;
    grid-template-columns: minmax(8.5em, 11em) 1fr;
    align-items: center;
    column-gap: 10px;
    margin-bottom: 6px;
}

.bb-dd-slider .bb-dd-field-label {
    margin: 0;
    font-size: .8rem;
    line-height: 1.25;
}

.bb-dd-slider .bb-dd-slider-value {
    display: block;
    font-size: .78rem;
}

.bb-dd-slider .form-range {
    margin: 0;
}

.bb-dd-props .bb-dd-field {
    margin-bottom: 8px;
}

.bb-dd-props textarea.form-control {
    min-height: 0;
}

.bb-dd-fx-body .bb-dd-field-label {
    font-size: .8rem;
}

.bb-dd-props-section > .bb-dd-actions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--bb-dd-border);
}

/* KI-Bild */

.bb-dd-add-row {
    flex-wrap: wrap;
}

/* Bild als Hintergrund */
.bb-dd-cover-button {
    display: block;
    width: 100%;
    margin-top: 6px;
    font-size: .8rem;
}

.bb-dd-cover-button[hidden] {
    display: none;
}

/* Handy: Fläche bleibt beim Scrollen oben sichtbar */
@media (max-width: 991.98px) {
    .bb-dd-top {
        display: contents;
    }

    .bb-dd-top .bb-dd-stage {
        position: sticky;
        top: 0;
        z-index: 3;
        border-bottom: 1px solid var(--bb-dd-border);
    }

    .bb-dd-props,
    .bb-dd-side {
        scroll-margin-top: 44vh;
    }
}

/* Größenauswahl oben im Designer */
.bb-dd-sizes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--bb-dd-border);
    background: #fff;
}

.bb-dd-sizes[hidden] {
    display: none;
}

.bb-dd-sizes-label {
    margin-right: 4px;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--bb-dd-muted);
}

.bb-dd-size {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 84px;
    padding: 5px 12px;
    border: 1px solid var(--bb-dd-border);
    border-radius: 8px;
    background: #fff;
    line-height: 1.2;
    cursor: pointer;
}

.bb-dd-size:hover {
    border-color: var(--bb-dd-accent);
}

.bb-dd-size.is-active {
    border-color: var(--bb-dd-accent);
    box-shadow: 0 0 0 2px var(--bb-dd-accent) inset;
    background: color-mix(in srgb, var(--bb-dd-accent) 6%, #fff);
}

.bb-dd-size-name {
    font-weight: 700;
    font-size: .9rem;
}

.bb-dd-size-price {
    font-size: .78rem;
    color: var(--bb-dd-muted);
}

.bb-dd-size.is-active .bb-dd-size-price {
    color: inherit;
}

/* Hinweis, solange noch nicht gestaltet wurde */
.bb-dd-status.is-hint {
    color: var(--bs-danger, #b00000);
    font-weight: 600;
}

.bb-dd-size-dims {
    font-size: .75rem;
    color: var(--bb-dd-muted);
}

.bb-dd-contour-size:empty {
    display: none;
}

/* Grafik spiegeln */
.bb-dd-flip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

