/* BIMComposites — small additions on top of Bootstrap 5. */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.table td.actions {
    white-space: nowrap;
    text-align: right;
}

.badge-role {
    font-weight: 500;
}

.system-row {
    color: var(--bs-secondary-color);
}

/* A form whose fields sit one per line and need no air between them. */

.form-compact .mb-3 {
    margin-bottom: 0.5rem !important;
}

.form-compact label {
    margin-bottom: 0.15rem;
}

/* The Archicad model's state, on the corner of the button that opens it. */

.archicad-dot {
    position: absolute;
    top: 0;
    left: 100%;
    transform: translate(-50%, -50%);
    width: 0.6rem;
    height: 0.6rem;
    border: 1px solid var(--bs-body-bg);
    border-radius: 50%;
}

/* Catalogue picker: a scrolling list of choices, one of them taken. */

.skin-picker-scroll {
    max-height: 45vh;
    overflow-y: auto;
}

.skin-option {
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--bs-border-radius);
    padding: 0.25rem;
}

.skin-option:hover {
    background: var(--bs-tertiary-bg);
}

/* In a picker the row is the target; the card's link would steal the click. */
.skin-option a {
    pointer-events: none;
    color: inherit;
}

.skin-option:has(input:checked) {
    border-color: var(--bs-primary);
    background: var(--bs-tertiary-bg);
}

/* Composite editor */

.layer-row {
    cursor: default;
}

.layer-row .drag-handle {
    cursor: grab;
    user-select: none;
}

/* A layer in the plane of the one above has no handle of its own — it is
   dragged by the leader of its run, and shows a chain link where the grip
   would be so the tie to the layer above is visible. */

.layer-row.parallel-follower .drag-handle {
    cursor: default;
    color: var(--bs-secondary-color);
}

/* An option is an alternative to the layer above and never adds depth. */
.layer-optional > td {
    color: var(--bs-tertiary-color);
}

.layer-row.is-dragging,
tbody.is-dragging {
    opacity: 0.4;
}

.composite-group .drag-handle {
    cursor: grab;
    user-select: none;
}

.layer-row:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 1px;
}

.layer-swatch {
    width: 0.9rem;
    height: 1.4rem;
    border: 1px solid rgba(0, 0, 0, 0.2);
    flex: 0 0 auto;
}

.layer-drop {
    min-height: 1.5rem;
}

#layer-stack.is-saving {
    opacity: 0.6;
}

#layer-stack.is-error {
    outline: 2px solid var(--bs-danger);
}

.composite-section {
    width: 100%;
    height: auto;
}

.composite-render td {
    vertical-align: top;
}

/* Archicad mapping: the direction a column belongs to. */

.dir-export,
.table > thead > tr > th.dir-export,
.table > tbody > tr > td.dir-export {
    background-color: rgba(13, 110, 253, 0.07);
}

.dir-import,
.table > thead > tr > th.dir-import,
.table > tbody > tr > td.dir-import {
    background-color: rgba(25, 135, 84, 0.08);
}

/* Project view: every composite-type table shares one column grid, so the
   columns line up across sections. */

.composites-table {
    table-layout: fixed;
    min-width: 34rem;
}

.composites-table .col-code {
    width: 7rem;
}

.composites-table .col-layers {
    width: 8rem;
}

.composites-table .col-actions {
    width: 6rem;
}

/* Collapsible detail block inside a card ("Več o debelini"): the toggle carries
   a triangle that points down once open, the panel sits on its own ground. */

.collapse-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

.collapse-toggle::before {
    content: "";
    border-top: 0.3rem solid transparent;
    border-bottom: 0.3rem solid transparent;
    border-left: 0.4rem solid currentcolor;
    transform: rotate(90deg);
    transition: transform 0.15s ease-in-out;
}

.collapse-toggle.collapsed::before {
    transform: rotate(0);
}

.collapse-panel {
    padding: 0.75rem 0.75rem 0.25rem;
    background-color: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.collapse-panel > :last-child {
    margin-bottom: 0.5rem;
}

/* Field hints sit under almost every control; Bootstrap's .875em is loud here. */

.form-text {
    font-size: 0.7em;
}

/* A group heading is a band across the stack, not one more layer row: it gets
   its own ground and a rule above it to close off the group before it. */

.composite-group > td {
    background-color: var(--bs-secondary-bg);
    border-top: 1px solid var(--bs-border-color);
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

.composite-render > tbody:first-child > .composite-group > td {
    border-top: 0;
}

/* The total closes the stack: it stands on the same ground as a group band,
   under a heavier rule than the ones that separate the bands. */

.composite-total > tr > td {
    background-color: var(--bs-secondary-bg);
    border-top: 2px solid var(--bs-body-color);
}
