:root {
    --bim-view-cube_x--bgc: rgba(175, 175, 175, 0.9);
    --bim-view-cube_y--bgc: rgba(175, 175, 175, 0.9);
    --bim-view-cube_z--bgc: rgba(175, 175, 175, 0.9);
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
}

/* Form controls don't inherit the page font by default — make them match. */
input, button, select, textarea {
    font-family: inherit;
}

.full-screen {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Mirrors `.appmap-host .appmap-measure-tooltray` (static/js/appmap/0.0.0/appmap.css)
   so the IFC viewer's bottom toolbar matches the floating-map measure tray. */
.tooltray {
    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.10), 0 1px 2px rgba(15, 23, 42, 0.06);
}

.tooltray__btn {
    width: 34px;
    height: 34px;
    padding: 6px;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #334155;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 120ms ease, transform 80ms ease;
}

.tooltray__btn img {
    width: 20px;
    height: 20px;
    display: block;
    pointer-events: none;
    /* SVG sources are filled white — invert to black for visibility on the
       white tray background. Pressed state un-inverts back to white on blue. */
    filter: invert(1);
    transition: filter 120ms ease;
}

/* Inline <svg> icons (e.g. 3dgs.html) drive their stroke/fill from
   `currentColor`; `.tooltray__btn` sets that to the dark text colour so they
   read on the white tray, and `.pressed` flips it to white over the blue bg. */
.tooltray__btn svg {
    width: 20px;
    height: 20px;
    display: block;
    pointer-events: none;
    transition: color 120ms ease;
}

.tooltray__btn:hover {
    background: #f1f5f9;
}

.tooltray__btn:active {
    transform: translateY(1px);
}

.tooltray__btn.pressed {
    background: #3b82f6;
    color: #ffffff;
}

.tooltray__btn.pressed img {
    filter: none;
}

/* Reset button in frag.html — render del.svg through a red CSS mask so it
   stays red on the white tray. Scoped to `#bottom-tooltray` because other
   viewers (e.g. 3dgs.html) reuse `#btn-reset` for a different "reset view"
   action with its own inline SVG icon. */
#bottom-tooltray #btn-reset img {
    display: none;
}
#bottom-tooltray #btn-reset::before {
    content: '';
    width: 20px;
    height: 20px;
    background-color: #dc2626;
    -webkit-mask: url(/static/svg/del.svg) center / contain no-repeat;
            mask: url(/static/svg/del.svg) center / contain no-repeat;
    transition: background-color 120ms ease;
}
#bottom-tooltray #btn-reset:hover::before {
    background-color: #b91c1c;
}

#context-menu {
    position: fixed;
    display: none;
    background: rgb(200, 200, 200);
    border: 1px solid rgb(175, 175, 175);
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    z-index: 2000;
    min-width: 150px;
    padding: 4px 0;
}

#context-menu button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    color: #222;
    white-space: nowrap;
}

#context-menu button:hover {
    background: rgba(99, 102, 241, 0.2);
}

#properties-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100vh;
    background: rgba(240, 240, 240, 0.95);
    border-left: 1px solid rgb(175, 175, 175);
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}

#properties-panel.open {
    transform: translateX(0);
}

.props-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgb(175, 175, 175);
    background: rgb(200, 200, 200);
    flex-shrink: 0;
}

.props-header span {
    font-weight: 600;
    font-size: 15px;
    color: #222;
}

#properties-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #444;
    padding: 0 4px;
    line-height: 1;
}

#properties-close:hover {
    color: #000;
}

#properties-content {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.props-group {
    margin-bottom: 2px;
}

.props-group-title {
    font-weight: 600;
    font-size: 13px;
    color: #444;
    padding: 8px 16px 4px;
    background: rgba(175, 175, 175, 0.3);
    border-bottom: 1px solid rgba(175, 175, 175, 0.5);
}

.props-row {
    display: flex;
    padding: 3px 16px;
    font-size: 12px;
    border-bottom: 1px solid rgba(200, 200, 200, 0.5);
}

.props-key {
    flex: 0 0 45%;
    color: #555;
    word-break: break-word;
    padding-right: 8px;
}

.props-val {
    flex: 1;
    color: #222;
    word-break: break-word;
}

.props-varies {
    color: #888;
    font-style: italic;
}

.props-loading {
    padding: 16px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

@media (max-width: 500px) {
    #properties-panel {
        width: 100vw;
    }
}

#categories-btn {
    position: absolute;
    top: 10px;
    left: calc(100% + 10px);
    width: 36px;
    height: 36px;
    background: rgb(200, 200, 200);
    border: 1px solid rgb(175, 175, 175);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #333;
}

#categories-btn:hover {
    background: rgb(220, 220, 220);
}

#categories-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: rgba(240, 240, 240, 0.95);
    border-right: 1px solid rgb(175, 175, 175);
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15);
    z-index: 1400;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
}

#categories-panel.open {
    transform: translateX(0);
}

.categories-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgb(175, 175, 175);
    background: rgb(200, 200, 200);
    flex-shrink: 0;
}

.categories-header span {
    font-weight: 600;
    font-size: 15px;
    color: #222;
}

#categories-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #444;
    padding: 0 4px;
    line-height: 1;
}

#categories-close:hover {
    color: #000;
}

.categories-actions {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(175, 175, 175, 0.5);
    flex-shrink: 0;
}

.categories-actions button {
    flex: 1;
    padding: 5px 0;
    border: 1px solid rgb(175, 175, 175);
    background: rgb(210, 210, 210);
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    color: #333;
}

.categories-actions button:hover {
    background: rgb(220, 220, 220);
}

#categories-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.category-item {
    display: flex;
    align-items: center;
    padding: 5px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #222;
    gap: 8px;
    user-select: none;
}

.category-item:hover {
    background: rgba(99, 102, 241, 0.1);
}

.category-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.category-name {
    flex: 1;
    word-break: break-word;
}

.category-count {
    color: #888;
    font-size: 12px;
}

@media (max-width: 500px) {
    #categories-panel {
        width: 100vw;
    }
}