/* PLC Simulator 2.0 — параллельные ветви и точки вставки */

.lad-rung-track,
.lad-branch-track {
    gap: 0;
}

.lad-slot {
    position: relative;
    flex: 1 1 34px;
    min-width: 24px;
    height: 30px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: crosshair;
}

.lad-slot::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    background: #40596a;
    transform: translateY(-50%);
    transition: .12s ease;
}

.lad-slot::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border: 2px solid transparent;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: .12s ease;
}

.lad-slot:hover::before,
.lad-slot.is-drop-target::before {
    height: 4px;
    background: #38bdf8;
    box-shadow: 0 0 9px rgba(56, 189, 248, .65);
}

.lad-slot:hover::after,
.lad-slot.is-drop-target::after {
    border-color: #38bdf8;
    background: #0b1720;
}

.lad-slot.is-selected::before {
    height: 4px;
    background: #f59e0b;
    box-shadow: 0 0 9px rgba(245, 158, 11, .55);
}

.lad-slot.is-selected::after {
    border-color: #f59e0b;
    background: #1f1608;
}

.lad-slot.is-powered::before {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, .7);
}

.lad-slot.is-powered::after {
    border-color: #22c55e;
    background: #0a2619;
}

.lad-element {
    flex: 0 0 auto;
    margin: 0 2px;
}

.lad-parallel {
    position: relative;
    z-index: 3;
    flex: 0 1 520px;
    min-width: 330px;
    max-width: 620px;
    margin: 4px 5px;
    border: 1px solid #3c596d;
    border-radius: 10px;
    background: #101a21;
    overflow: hidden;
    cursor: grab;
    user-select: none;
}

.lad-parallel.is-selected {
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, .12);
}

.lad-parallel.is-active {
    border-color: #22c55e;
    box-shadow: 0 0 14px rgba(34, 197, 94, .13);
}

.lad-parallel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 30px;
    padding: 5px 9px;
    border-bottom: 1px solid #29404f;
    background: #14242e;
}

.lad-parallel-head span {
    color: #7dd3fc;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .08em;
}

.lad-parallel-head small {
    color: #8097a8;
    font-size: 9px;
}

.lad-parallel.is-active > .lad-parallel-head small {
    color: #86efac;
}

.lad-branch-list {
    position: relative;
    padding: 5px 0;
}

.lad-branch-list::before,
.lad-branch-list::after {
    content: "";
    position: absolute;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: #587386;
    z-index: 4;
}

.lad-branch-list::before {
    left: 38px;
}

.lad-branch-list::after {
    right: 31px;
}

.lad-parallel.is-active .lad-branch-list::before,
.lad-parallel.is-active .lad-branch-list::after {
    background: #22c55e;
    box-shadow: 0 0 7px rgba(34, 197, 94, .55);
}

.lad-branch {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 31px;
    align-items: center;
    min-height: 62px;
    border-bottom: 1px solid #20333f;
}

.lad-branch:last-child {
    border-bottom: 0;
}

.lad-branch.is-powered {
    background: rgba(34, 197, 94, .045);
}

.lad-branch-label {
    position: relative;
    z-index: 5;
    display: grid;
    place-items: center;
    align-self: stretch;
    color: #688294;
    font: 800 9px Consolas, monospace;
}

.lad-branch.is-powered .lad-branch-label {
    color: #86efac;
}

.lad-branch-track {
    min-width: 0;
    min-height: 60px;
    display: flex;
    align-items: center;
    padding: 5px 0;
    overflow-x: auto;
}

.lad-branch-track .lad-element {
    min-width: 84px;
    min-height: 44px;
}

.lad-branch-track .lad-slot {
    min-width: 28px;
}

.lad-branch-empty {
    flex: 0 0 auto;
    max-width: 180px;
    margin-right: 8px;
    color: #60788a;
    font-size: 9px;
    line-height: 1.3;
    pointer-events: none;
}

.lad-branch-delete {
    position: relative;
    z-index: 5;
    width: 22px;
    height: 22px;
    margin: auto;
    border: 0;
    border-radius: 5px;
    background: #33191b;
    color: #fca5a5;
    font-weight: 900;
    cursor: pointer;
}

.lad-branch-delete:hover {
    background: #5b2025;
}

.lad-parallel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 8px;
    border-top: 1px solid #29404f;
    background: #0c151b;
}

.lad-parallel-footer button {
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid #356179;
    border-radius: 6px;
    background: #132a36;
    color: #a5e4ff;
    font-size: 9px;
    font-weight: 800;
    cursor: pointer;
}

.lad-parallel-footer button:hover {
    border-color: #38bdf8;
    background: #173a4b;
}

.lad-parallel-footer span {
    color: #637b8c;
    font-size: 8px;
}

.lad-rung-track > .lad-slot:first-child,
.lad-rung-track > .lad-slot:last-child {
    min-width: 30px;
}

.lad-rung-track > .lad-slot:first-child {
    flex-grow: .25;
}

.lad-rung-track > .lad-slot:last-child {
    flex-grow: 1;
}

.lad-wire {
    display: none;
}

#deleteParallelBtn {
    width: 100%;
    margin-top: 8px;
}

@media (max-width: 1500px) {
    .lad-parallel {
        min-width: 300px;
        max-width: 520px;
    }

    .lad-branch-track .lad-element {
        min-width: 78px;
    }
}
