﻿
*, *::before, *::after {
    box-sizing: border-box;
}
.tb-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 16px;
    height: calc(80vh - 187px) !important;
}

.tb-layout.tb-layout-3col {
    grid-template-columns: 220px 1fr 220px;
}

.tb-layout.tb-readonly {
    opacity: 0.6;
}

.tb-layout.tb-readonly * {
    pointer-events: none;
}

.tb-title {
    font-weight: 700;
    margin-bottom: 10px;
}

.tb-toolbox, .tb-board {
    border-radius: 10px;
    padding: 12px;
    overflow: auto;
    background-color: var(--ct-secondary-bg) !important;
    border: 0 solid var(--ct-border-color);
    border-radius: var(--ct-border-radius);
}

.tb-add {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    background-color: var(--ct-secondary-bg) !important;
}

/* Toolbox preview: allow items (e.g., cavité) to align to the bottom */
.tb-add > div {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: flex-end;
}

.tb-row {
    display: flex;
    align-items: stretch;
    /* KEY: do not center a scroll container */
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px; /* left/right padding ensures first item visible */
    min-height: 150px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    max-width: 100%;
    min-width: 0;
    border-top: 1px dashed #eee;
    border-bottom: 1px dashed #eee;
    /* Optional: smoother scrolling */
    -webkit-overflow-scrolling: touch;
}

/* Fake “center when it fits” without breaking scroll */
.tb-row::before,
.tb-row::after {
    content: "";
    flex: 1 0 auto;
    pointer-events: none;
}

.tb-item {
    flex: 0 0 auto;
    border: 0px solid #eee;
    border-radius: 10px;
    padding: 0px;
    cursor: grab;
    user-select: none;
    align-content: end;
}

.tb-item-header {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.tb-item-footer {
    margin-top: auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 6px;
}

.tb-item-title {
    font-weight: 600;
    font-size: 13px;
}

.tb-remove {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
}

/* Rectangle visuals */
.rect-preview {
    width: 50px;
    height: 70px;
    border-radius: 6px;
    display: inline-block;
}

.rect-canvas {
    height: 150px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
}

.rect-blue-outline {
    border: 3px solid skyblue;
    background-color: #d6e4ef;
    width: 50px !important;
    min-width: 50px !important;
}

.rect-orange-filled {
    border: 3px solid #ff8a00;
    background: rgba(255,138,0,0.35);
    width: 25px !important;
    min-width: 25px !important;
}

.rect-green-filled {
    border: 3px solid #1bb55c;
    background: rgba(27,181,92,0.35);
    width: 100px !important;
    min-width: 100px !important;
    height: 55px;
    border-radius: 5px 5px 20px 20px;
}

.rect-blue-outline-slim {
    border: 3px solid skyblue;
    background-color: #d6e4ef;
    width: 25px !important;
    min-width: 25px !important;
}

.rect-orange-filled-slim {
    border: 3px solid #ff8a00;
    background: rgba(255,138,0,0.35);
    width: 12px !important;
    min-width: 12px !important;
}

.rect-green-filled-slim {
    border: 3px solid #1bb55c;
    background: rgba(27,181,92,0.35);
    width: 50px !important;
    min-width: 50px !important;
    height: 25px;
    border-radius: 5px 5px 15px 15px;
}

.rect-blue-outline-selected {
    border: 3px solid skyblue;
    background-color: #d6e4ef;
    width: 50px !important;
    min-width: 50px !important;
    outline: 2px dashed #bbb;
}

.rect-orange-filled-selected {
    border: 3px solid #ff8a00;
    background: rgba(255,138,0,0.35);
    width: 25px !important;
    min-width: 25px !important;
    outline: 2px dashed #bbb;
}

.rect-green-filled-selected {
    border: 3px solid #1bb55c;
    background: rgba(27,181,92,0.35);
    width: 100px !important;
    min-width: 100px !important;
    height: 55px;
    border-radius: 5px 5px 20px 20px;
    outline: 2px dashed #bbb;
}

/* SortableJS helper classes */
.tb-ghost {
    opacity: 0.35;
}

.tb-chosen {
    outline: 2px dashed #bbb;
}

.tb-drag {
    opacity: 0.9;
}

.tb-debug {
    margin-top: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: #444;
}

.tb-editform-card {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--ct-border-color);
    border-radius: 12px;
    background: var(--ct-secondary-bg);
}

.tb-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tb-step {
    display: grid;
    grid-template-columns: 26px 1fr;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 10px;
    background: rgba(0,0,0,0.02);
}

.tb-step-index {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
    color: #fff;
    background: #3b82f6;
}

.tb-step-text {
    font-size: 13px;
    line-height: 1.2;
    font-weight: 600;
    color: var(--ct-body-color, #222);
}

.flex-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

    .flex-row .tb-row {
        flex: 1 1 auto; /* take all remaining space */
        min-width: 0; /* IMPORTANT: allows shrinking instead of overflowing */

        width: 100%;
    }

    .flex-row .i {
        flex: 0 0 auto; /* keep icons fixed */
    }

.board-center {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.tb-board-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.tb-board-params {
    width: 220px;
    padding: 5px;
}

.tb-param {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

    .tb-param:last-child {
        margin-bottom: 0;
    }

@media (max-width: 992px) {
    .tb-board-top {
        justify-content: stretch;
    }

    .tb-board-params {
        width: 100%;
    }
}

.traitement-wrap {
    position: relative;
    width: 460px;
    height: 360px;
    margin: 12px 0;
}

.traitement-rect {
    position: absolute;
    inset: 70px;
    border: 3px solid #333;
    border-radius: 10px;
    background: transparent;
}

.tt-select {
    position: absolute;
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tt-top {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.tt-bottom {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.tt-left {
    left: calc(-220px + 120px);
    top: 50%;
    transform: translateY(-50%);
    width: 220px;
}

.tt-right {
    right: calc(-220px + 120px);
    top: 50%;
    transform: translateY(-50%);
    width: 220px;
}

.tt-rot-90 {
    transform: rotate(90deg);
    transform-origin: center;
}

.tt-rot--90 {
    transform: rotate(-90deg);
    transform-origin: center;
}

.tt-left .form-control,
.tt-right .form-control {
    width: 220px;
}