/*
 * T3Bootstrap Spacing Stepper — backend FormEngine element
 *
 * Uses TYPO3 v14 --typo3-* design tokens for every theme-adaptive value.
 * Those tokens are defined via the CSS light-dark() function so the
 * stepper picks up the active backend color scheme (light, dark, brand
 * variants) automatically. --bs-* fallbacks are kept only for properties
 * where TYPO3 still relies on Bootstrap's static values (primary color,
 * border radius, font size).
 */

.t3b-spacing-stepper {
    background: var(--typo3-component-bg);
    border: 1px solid var(--typo3-component-border-color);
    border-radius: var(--bs-border-radius, .375rem);
    overflow: hidden;
    color: var(--typo3-component-color);
}

/* ---- Chip primitives ---------------------------------------------------- */

.t3b-spacing-stepper .a-chip {
    position: relative;
    width: 26px;
    height: 24px;
    border: 1px solid var(--typo3-component-border-color);
    background: var(--typo3-component-bg);
    border-radius: var(--bs-border-radius-sm, 4px);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transition: background .12s, border-color .12s;
}
.t3b-spacing-stepper .a-chip:hover {
    border-color: var(--typo3-state-primary-border-color);
    background: var(--typo3-component-hover-bg);
}
.t3b-spacing-stepper .a-chip .bar {
    display: block;
    width: 13px;
    background: var(--typo3-component-secondary-color);
    border-radius: 1px 1px 0 0;
    margin-bottom: 3px;
    transition: background .12s;
}
.t3b-spacing-stepper .a-chip.def {
    background: var(--typo3-state-primary-bg);
    border-color: var(--typo3-state-primary-border-color);
}
.t3b-spacing-stepper .a-chip.def:hover {
    background: color-mix(in srgb, var(--typo3-state-primary-bg) 80%, var(--bs-primary));
}
.t3b-spacing-stepper .a-chip.def .bar {
    background: var(--bs-primary);
}
.t3b-spacing-stepper .a-chip.act {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
}
.t3b-spacing-stepper .a-chip.act:hover {
    background: color-mix(in srgb, var(--bs-primary) 85%, #000);
}
.t3b-spacing-stepper .a-chip.act .bar {
    background: var(--typo3-state-primary-color, #fff);
}

.t3b-spacing-stepper .a-chip.zero {
    align-items: center;
    background: var(--typo3-component-hover-bg);
    border-style: dashed;
}
.t3b-spacing-stepper .a-chip.zero:hover {
    background: var(--typo3-component-active-bg, var(--typo3-component-hover-bg));
}
.t3b-spacing-stepper .a-chip.zero typo3-backend-icon {
    color: var(--typo3-component-secondary-color);
    --icon-color-primary: currentColor;
    --icon-size: 12px;
    transition: color .12s;
}
.t3b-spacing-stepper .a-chip.zero.def {
    background: var(--typo3-state-primary-bg);
    border-style: solid;
}
.t3b-spacing-stepper .a-chip.zero.def typo3-backend-icon {
    color: var(--bs-primary);
}
.t3b-spacing-stepper .a-chip.zero.act {
    background: var(--bs-primary);
    border-style: solid;
}
.t3b-spacing-stepper .a-chip.zero.act typo3-backend-icon {
    color: var(--typo3-state-primary-color, #fff);
}

/* ---- Row layout -------------------------------------------------------- */

.t3b-spacing-stepper .a-stepper {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.t3b-spacing-stepper .a-row {
    border-top: 1px solid var(--typo3-component-border-color);
}
.t3b-spacing-stepper .a-row:first-of-type {
    border-top: none;
}
.t3b-spacing-stepper .a-row.exp {
    background: var(--typo3-component-hover-bg);
}

.t3b-spacing-stepper .a-sum {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px;
    min-height: 40px;
    cursor: pointer;
}
.t3b-spacing-stepper .a-sum:hover {
    background: var(--typo3-component-hover-bg);
}
.t3b-spacing-stepper .a-row.exp .a-stepper,
.t3b-spacing-stepper .a-row.exp .a-val,
.t3b-spacing-stepper .a-row.exp .a-bppill {
    opacity: .5;
    transition: opacity .2s ease;
}
.t3b-spacing-stepper .a-row.exp .a-sum:hover .a-stepper,
.t3b-spacing-stepper .a-row.exp .a-sum:hover .a-val,
.t3b-spacing-stepper .a-row.exp .a-sum:hover .a-bppill {
    opacity: .9;
}

.t3b-spacing-stepper .a-lbl {
    width: 104px;
    font-size: var(--bs-body-font-size, 14px);
    color: var(--typo3-component-secondary-color);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.t3b-spacing-stepper .a-lbl typo3-backend-icon {
    --icon-size: 14px;
    color: currentColor;
}
.t3b-spacing-stepper .a-val {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--typo3-component-color);
    min-width: 68px;
    font-variant-numeric: tabular-nums;
}
.t3b-spacing-stepper .a-val.is-def {
    font-weight: 400;
    color: var(--typo3-component-secondary-color);
}

/* Badge / pill for "+N BP" — match TYPO3 badge styling */
.t3b-spacing-stepper .a-bppill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: var(--typo3-state-primary-bg);
    color: var(--typo3-state-primary-color, var(--bs-primary));
    border-radius: var(--bs-border-radius-pill, 9px);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .2px;
}
.t3b-spacing-stepper .a-acts {
    display: flex;
    gap: 4px;
    margin-left: auto;
    align-items: center;
}

/* Icon buttons styled as TYPO3 ghost icon buttons */
.t3b-spacing-stepper .a-expbtn,
.t3b-spacing-stepper .a-reset,
.t3b-spacing-stepper .a-bp-reset {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--typo3-component-secondary-color);
    border-radius: var(--bs-border-radius-sm, 4px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease, background .12s, color .12s;
}
.t3b-spacing-stepper .a-expbtn:hover,
.t3b-spacing-stepper .a-reset:hover,
.t3b-spacing-stepper .a-bp-reset:hover {
    background: var(--typo3-component-hover-bg);
    color: var(--typo3-component-color);
}
.t3b-spacing-stepper .a-expbtn.open {
    transform: rotate(180deg);
    color: var(--bs-primary);
}
.t3b-spacing-stepper .a-expbtn typo3-backend-icon,
.t3b-spacing-stepper .a-reset typo3-backend-icon {
    --icon-size: 14px;
    color: currentColor;
}
.t3b-spacing-stepper .a-bp-reset {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}
.t3b-spacing-stepper .a-bp-reset typo3-backend-icon {
    --icon-size: 12px;
    color: currentColor;
}
.t3b-spacing-stepper .a-reset.hidden,
.t3b-spacing-stepper .a-bp-reset.hidden {
    visibility: hidden;
}

/* ---- Accordion (breakpoint detail rows) -------------------------------- */

.t3b-spacing-stepper .a-acc {
    padding: 4px 0 8px;
    border-top: 1px dashed var(--typo3-component-border-color);
    background: var(--typo3-component-hover-bg);
}
.t3b-spacing-stepper .a-bp {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 14px 5px 30px;
    min-height: 34px;
    position: relative;
}
.t3b-spacing-stepper .a-bp::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    width: 1.5px;
    background: var(--typo3-state-primary-border-color);
}
.t3b-spacing-stepper .a-bp:first-child::before {
    top: 6px;
}
.t3b-spacing-stepper .a-bp:last-child::before {
    bottom: auto;
    height: 50%;
}
.t3b-spacing-stepper .a-bp::after {
    content: '';
    position: absolute;
    left: 14px;
    top: 50%;
    width: 8px;
    height: 1.5px;
    background: var(--typo3-state-primary-border-color);
}
.t3b-spacing-stepper .a-bplbl {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 90px;
    font-size: 11px;
    flex-shrink: 0;
}
.t3b-spacing-stepper .a-bplbl strong {
    font-weight: 600;
    color: var(--typo3-component-color);
    font-size: 12px;
    letter-spacing: .3px;
}
.t3b-spacing-stepper .a-bplbl .hint {
    color: var(--typo3-component-secondary-color);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}
.t3b-spacing-stepper .a-bp.has-ov .a-bplbl strong {
    color: var(--bs-primary);
}
.t3b-spacing-stepper .a-ovdot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bs-primary);
    flex-shrink: 0;
    margin-right: -2px;
}
.t3b-spacing-stepper .a-status {
    font-size: 10px;
    color: var(--typo3-component-secondary-color);
    font-style: italic;
    margin-left: auto;
    text-align: right;
    padding-right: 2px;
}
.t3b-spacing-stepper .a-bp.has-ov .a-status {
    color: var(--bs-primary);
    font-weight: 500;
    font-style: normal;
}
.t3b-spacing-stepper .a-bp.is-base .a-status {
    color: var(--typo3-component-secondary-color);
    font-style: normal;
    font-weight: 500;
}

/* ---- Group strip ("Innenabstand" / "Außenabstand") --------------------- */

.t3b-spacing-stepper .a-group {
    font-size: 11px;
    font-weight: 500;
    color: var(--typo3-component-secondary-color);
    padding: 9px 14px 3px;
    background: var(--typo3-component-hover-bg);
}

/* ---- Translation sync bar — use TYPO3 alert/info styling --------------- */

.t3b-spacing-stepper .a-trbar {
    padding: 8px 14px;
    border-bottom: 1px solid var(--typo3-component-border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--typo3-state-info-bg, var(--typo3-component-hover-bg));
    color: var(--typo3-state-info-color, var(--typo3-component-color));
}
.t3b-spacing-stepper .a-tog {
    position: relative;
    width: 30px;
    height: 17px;
    border-radius: 9px;
    background: var(--typo3-component-hover-bg);
    border: 1px solid var(--typo3-component-border-color);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .14s, border-color .14s;
    padding: 0;
}
.t3b-spacing-stepper .a-tog::after {
    content: '';
    position: absolute;
    width: 13px;
    height: 13px;
    background: #fff;
    border-radius: 50%;
    top: 1px;
    left: 1px;
    transition: left .15s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}
.t3b-spacing-stepper .a-tog.on {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
}
.t3b-spacing-stepper .a-tog.on::after {
    left: 15px;
}
.t3b-spacing-stepper .a-tricn {
    color: var(--bs-primary);
    display: inline-flex;
    align-items: center;
}
.t3b-spacing-stepper .a-tricn typo3-backend-icon {
    --icon-size: 16px;
    color: currentColor;
}
.t3b-spacing-stepper .a-trtxt {
    font-size: var(--bs-body-font-size, 14px);
    color: var(--typo3-component-color);
    font-weight: 500;
    flex: 1;
}
.t3b-spacing-stepper .a-trtxt.off {
    color: var(--typo3-component-secondary-color);
    font-weight: 400;
}
