/* BIMCheck viewer workspace: full-frame BIM inspection surface. */

#tab-viewer3d {
    padding: 0 !important;
    overflow: hidden;
}

.viewer3d-container.viewer-workspace {
    position: relative;
    height: calc(100dvh - 184px);
    min-height: 620px;
    border: 0;
    border-radius: 0;
    background: #dfe5e8;
    box-shadow: none;
}

.viewer-workspace .viewer3d-main-area {
    position: absolute;
    inset: 0;
}

.viewer-workspace .viewer3d-canvas-wrapper {
    background: #dfe5e8;
}

.viewer-workspace #viewer3dCanvas {
    touch-action: none;
}

.viewer-workspace .viewer3d-toolbar {
    position: absolute;
    z-index: 80;
    top: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    min-height: 44px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 6px;
    background: rgba(16, 27, 43, .94);
    box-shadow: 0 10px 26px rgba(16, 27, 43, .18);
    backdrop-filter: blur(14px);
}

.viewer-workspace .viewer3d-toolbar-group {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.viewer-workspace .viewer3d-toolbar-group::-webkit-scrollbar {
    display: none;
}

.viewer-workspace .viewer3d-btn {
    position: relative;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #c5d0da;
}

.viewer-workspace .viewer3d-btn:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.viewer-workspace .viewer3d-btn.active {
    background: #d92d3a;
    color: #fff;
}

.viewer-workspace .viewer3d-btn::after {
    content: attr(data-viewer-label);
    position: absolute;
    z-index: 300;
    top: calc(100% + 8px);
    left: 50%;
    padding: 5px 7px;
    transform: translateX(-50%);
    border-radius: 3px;
    background: #101b2b;
    color: #fff;
    font: 600 10px var(--font-body);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 100ms ease;
}

.viewer-workspace .viewer3d-btn:hover::after {
    opacity: 1;
}

.viewer-workspace .viewer3d-separator {
    height: 20px;
    margin: 0 3px;
    background: rgba(255, 255, 255, .16);
}

.viewer-workspace .viewer3d-fps {
    flex: 0 0 auto;
    border: 0;
    background: rgba(255, 255, 255, .08);
    color: #b9c5d0 !important;
    font: 700 10px var(--font-display);
}

.viewer-commandbar {
    position: absolute;
    z-index: 75;
    top: 66px;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    pointer-events: none;
}

.viewer-search,
.viewer-command-actions {
    pointer-events: auto;
}

.viewer-search {
    position: relative;
    width: min(410px, calc(100vw - 40px));
}

.viewer-search > input {
    width: 100%;
    height: 40px;
    padding: 0 42px 0 38px;
    border: 1px solid rgba(16, 27, 43, .18);
    border-radius: 5px;
    background: rgba(255, 255, 255, .96);
    color: #172437;
    box-shadow: 0 8px 22px rgba(16, 27, 43, .12);
    outline: none;
}

.viewer-search > input:focus {
    border-color: #187c86;
    box-shadow: 0 0 0 3px rgba(24, 124, 134, .16), 0 8px 22px rgba(16, 27, 43, .12);
}

.viewer-search-icon {
    position: absolute;
    z-index: 2;
    top: 12px;
    left: 12px;
    color: #536171;
}

.viewer-search kbd {
    position: absolute;
    top: 10px;
    right: 10px;
    min-width: 20px;
    padding: 2px 5px;
    border: 1px solid #d5dce2;
    border-radius: 3px;
    background: #f4f6f7;
    color: #536171;
    font: 700 11px var(--font-display);
    text-align: center;
}

.viewer-search-results {
    display: none;
    max-height: min(430px, 60vh);
    margin-top: 5px;
    overflow-y: auto;
    border: 1px solid #d5dce2;
    border-radius: 5px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 18px 40px rgba(16, 27, 43, .18);
}

.viewer-search-results.open {
    display: block;
}

.viewer-search-results button {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid #eef1f3;
    background: transparent;
    color: #172437;
    text-align: left;
    cursor: pointer;
}

.viewer-search-results button:hover {
    background: #eef7f7;
}

.viewer-search-results strong,
.viewer-search-results small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewer-search-results small {
    margin-top: 2px;
    color: #63707d;
    font-size: 11px;
}

.viewer-search-results code {
    max-width: 110px;
    overflow: hidden;
    color: #187c86;
    font-size: 10px;
    text-overflow: ellipsis;
}

.viewer-search-results p {
    margin: 0;
    padding: 14px;
    color: #63707d;
    font-size: 12px;
}

.viewer-command-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(16, 27, 43, .14);
    border-radius: 5px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 8px 22px rgba(16, 27, 43, .12);
}

.viewer-coverage-status {
    min-width: 96px;
    padding: 2px 9px 2px 8px;
    border-right: 1px solid #dce2e6;
    color: #536171;
}

.viewer-coverage-status span,
.viewer-coverage-status strong {
    display: block;
    white-space: nowrap;
}

.viewer-coverage-status span {
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
}

.viewer-coverage-status strong {
    margin-top: 1px;
    color: #536171;
    font: 700 11px var(--font-display);
}

.viewer-coverage-status[data-status="complete"] strong {
    color: #17724a;
}

.viewer-coverage-status[data-status="partial"] strong,
.viewer-coverage-status[data-status="incomplete"] strong {
    color: #b4232d;
}

.viewer-command-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 32px;
    padding: 0 9px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: #172437;
    cursor: pointer;
}

.viewer-command-btn:hover {
    background: #eef1f3;
}

.viewer-command-btn.active {
    background: #d92d3a;
    color: #fff;
}

.viewer-orientation {
    position: absolute;
    z-index: 66;
    right: 14px;
    bottom: 14px;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 238px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 5px;
    background: rgba(16, 27, 43, .92);
    color: #fff;
    box-shadow: 0 10px 24px rgba(16, 27, 43, .18);
}

.viewer-compass {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.viewer-compass-ring {
    position: relative;
    display: block;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
}

.viewer-compass-ring::after {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 50%;
}

.viewer-compass-ring i {
    position: absolute;
    z-index: 2;
    top: 5px;
    bottom: 5px;
    left: 50%;
    width: 2px;
    transform-origin: 50% 50%;
    background: linear-gradient(to bottom, #d92d3a 0 48%, #dfe6eb 48% 100%);
}

.viewer-compass-ring b {
    position: absolute;
    z-index: 3;
    top: -5px;
    left: 50%;
    padding: 0 2px;
    transform: translateX(-50%);
    background: #101b2b;
    color: #ff8089;
    font: 800 8px var(--font-display);
}

.viewer-orientation-copy strong,
.viewer-orientation-copy span {
    display: block;
    white-space: nowrap;
}

.viewer-orientation-copy strong {
    font: 700 10px var(--font-display);
}

.viewer-orientation-copy span {
    margin-top: 2px;
    color: #9eafbd;
    font-size: 8px;
}

.viewer-orientation-actions {
    display: flex;
    gap: 2px;
}

.viewer-orientation-actions button {
    min-width: 27px;
    height: 28px;
    padding: 0 5px;
    border: 0;
    border-radius: 3px;
    background: rgba(255, 255, 255, .09);
    color: #fff;
    font-size: 10px;
    cursor: pointer;
}

.viewer-orientation-actions button:hover {
    background: #187c86;
}

.viewer-runtime-hud {
    position: absolute;
    z-index: 65;
    bottom: 14px;
    left: 14px;
    display: flex;
    gap: 1px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 4px;
    background: rgba(16, 27, 43, .9);
    color: #fff;
    box-shadow: 0 8px 22px rgba(16, 27, 43, .14);
    pointer-events: none;
}

.viewer-runtime-hud > div {
    min-width: 78px;
    padding: 7px 9px;
    border-right: 1px solid rgba(255, 255, 255, .1);
}

.viewer-runtime-hud > div:last-child {
    border-right: 0;
}

.viewer-runtime-hud span,
.viewer-runtime-hud strong {
    display: block;
}

.viewer-runtime-hud span {
    margin-bottom: 2px;
    color: #95a6b6;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.viewer-runtime-hud strong {
    font: 700 11px var(--font-display);
}

.viewer-selection-bar {
    position: absolute;
    z-index: 70;
    right: 266px;
    bottom: 14px;
    display: none;
    align-items: center;
    gap: 14px;
    max-width: min(680px, calc(100% - 28px));
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 5px;
    background: rgba(16, 27, 43, .94);
    color: #fff;
    box-shadow: 0 12px 28px rgba(16, 27, 43, .2);
}

.viewer-selection-bar.open {
    display: flex;
}

.viewer-selection-copy {
    min-width: 140px;
    padding: 0 6px;
}

.viewer-selection-copy strong,
.viewer-selection-copy span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewer-selection-copy strong {
    max-width: 220px;
    font-size: 12px;
}

.viewer-selection-copy span {
    margin-top: 2px;
    color: #9eafbd;
    font-size: 10px;
}

.viewer-selection-actions {
    display: flex;
    gap: 3px;
}

.viewer-selection-actions button {
    height: 30px;
    padding: 0 9px;
    border: 0;
    border-radius: 3px;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
}

.viewer-selection-actions button:hover {
    background: #187c86;
}

.viewer-workspace .viewer3d-filters-panel,
.viewer-workspace .viewer3d-properties-panel {
    position: absolute;
    z-index: 72;
    top: 116px;
    bottom: 62px;
    width: 310px;
    border: 1px solid rgba(16, 27, 43, .14);
    border-radius: 5px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 16px 36px rgba(16, 27, 43, .17);
}

.viewer-workspace .viewer3d-filters-panel {
    left: 12px;
}

.viewer-workspace .viewer3d-properties-panel {
    right: 12px;
}

.viewer-workspace .viewer3d-panel-header {
    min-height: 42px;
    padding: 8px 10px;
    background: #172437;
    color: #fff;
}

.viewer-workspace .viewer3d-panel-close {
    border-color: rgba(255, 255, 255, .15);
    color: #fff;
}

.viewer-workspace .viewer3d-info {
    display: none;
}

.viewer-workspace .viewer3d-loading {
    z-index: 100;
    background: rgba(244, 246, 247, .94);
    color: #172437;
}

.viewer-load-progress {
    width: min(320px, 70vw);
    height: 4px;
    overflow: hidden;
    border-radius: 2px;
    background: #d5dce2;
}

.viewer-load-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: #d92d3a;
    transition: width 100ms linear;
}

.measure-active #viewer3dCanvas {
    cursor: crosshair;
}

@media (max-width: 1100px) {
    .viewer3d-container.viewer-workspace {
        height: calc(100dvh - 176px);
        min-height: 520px;
    }

    .viewer-workspace .viewer3d-toolbar {
        overflow-x: auto;
    }

    .viewer-workspace .viewer3d-toolbar > .viewer3d-toolbar-group:last-child {
        display: none;
    }

    .viewer-commandbar {
        top: 62px;
    }

    .viewer-command-btn span {
        display: none;
    }

    .viewer-coverage-status {
        min-width: 82px;
        padding-right: 6px;
        padding-left: 4px;
    }

    .viewer-runtime-hud > div:nth-child(3),
    .viewer-runtime-hud > div:nth-child(4) {
        display: none;
    }

    .viewer-workspace .viewer3d-filters-panel,
    .viewer-workspace .viewer3d-properties-panel {
        top: auto;
        right: 8px;
        bottom: 8px;
        left: 8px;
        width: auto;
        height: min(58vh, 520px);
    }

    .viewer-selection-bar {
        right: 8px;
        bottom: 62px;
        left: 8px;
        max-width: none;
        flex-wrap: wrap;
    }

    .viewer-orientation {
        right: 8px;
        bottom: 8px;
    }
}

@media (max-width: 620px) {
    .viewer3d-container.viewer-workspace {
        height: calc(100dvh - 244px);
        min-height: 500px;
    }

    .viewer-workspace .viewer3d-toolbar {
        top: 8px;
        right: 8px;
        left: 8px;
    }

    .viewer-workspace .viewer3d-btn {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
    }

    .viewer-commandbar {
        top: 58px;
        right: 8px;
        left: 8px;
        flex-direction: column;
        align-items: stretch;
    }

    .viewer-search {
        width: 100%;
    }

    .viewer-search kbd {
        display: none;
    }

    .viewer-command-actions {
        flex: 0 0 auto;
        align-self: flex-end;
        max-width: 100%;
    }

    #viewerMeasureClear {
        display: none;
    }

    .viewer-coverage-status {
        min-width: 86px;
    }

    .viewer-workspace .viewer3d-filters-panel,
    .viewer-workspace .viewer3d-properties-panel {
        height: min(48vh, 440px);
    }

    .viewer-runtime-hud {
        right: 8px;
        bottom: 8px;
        left: 8px;
    }

    .viewer-orientation {
        top: 154px;
        right: 8px;
        bottom: auto;
        min-width: 0;
        grid-template-columns: 36px auto;
    }

    .viewer-orientation-copy,
    .viewer-orientation-actions button:not(#viewerOrientationReset) {
        display: none;
    }

    .viewer-orientation-actions button {
        min-width: 30px;
    }

    .viewer-runtime-hud > div {
        flex: 1;
        min-width: 0;
    }

    .viewer-runtime-hud > div:nth-child(4),
    .viewer-runtime-hud > div:nth-child(5) {
        display: none;
    }

    .viewer-selection-actions {
        width: 100%;
        overflow-x: auto;
    }
}
