/* Public DSTV NC Viewer — fully self-contained styles.
   Intentionally independent from the admin viewer's dstv-nc-viewer.css so the
   admin tool stays untouched. */

.pubv-titlebar {
    margin: 0.5rem 0 1rem;
}

.pubv-titlerow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.pubv-title {
    font-size: 1.4rem;
    color: var(--primary, #3d436d);
    margin: 0.3rem 0;
}

.pubv-meta {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Language toggle (NL | EN) */
.pubv-lang {
    display: inline-flex;
    border: 1px solid #9aa9c4;
    border-radius: 4px;
    overflow: hidden;
}

.pubv-lang button {
    border: none;
    background: #fff;
    color: #3d436d;
    padding: 0.25rem 0.7rem;
    font-size: 0.82rem;
    cursor: pointer;
}

.pubv-lang button + button {
    border-left: 1px solid #9aa9c4;
}

.pubv-lang button.pubv-lang--active {
    background: #1B5FAA;
    color: #fff;
}

/* Drop / browse zone */
.pubv-dropzone {
    border: 2px dashed #9aa9c4;
    border-radius: 8px;
    background: #f8f9fb;
    padding: 2rem 1rem;
    text-align: center;
    color: #3d436d;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    margin-bottom: 0.8rem;
}

.pubv-dropzone:hover,
.pubv-dropzone:focus {
    background: #eef2f8;
    border-color: #1B5FAA;
    outline: none;
}

.pubv-dropzone--over {
    background: #e3edf9;
    border-color: #1B5FAA;
    border-style: solid;
}

.pubv-dropzone-icon {
    font-size: 2.2rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.pubv-dropzone-text {
    font-size: 1rem;
    line-height: 1.6;
}

.pubv-browse-btn {
    background: #1B5FAA;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.9rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.pubv-browse-btn:hover {
    background: #154d8a;
}

.pubv-errors {
    border: 1px solid #e0b400;
    background: #fff8e1;
    color: #6b5400;
    border-radius: 4px;
    padding: 0.5rem 0.8rem;
    font-size: 0.88rem;
    margin-bottom: 0.8rem;
}

.pubv-filebar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}

.pubv-file-chips {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.pubv-file-chip {
    border: 1px solid #9aa9c4;
    background: #fff;
    color: #3d436d;
    border-radius: 14px;
    padding: 0.2rem 0.7rem;
    font-size: 0.82rem;
    cursor: pointer;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pubv-file-chip:hover {
    border-color: #1B5FAA;
}

.pubv-file-chip--active {
    background: #1B5FAA;
    color: #fff;
    border-color: #1B5FAA;
}

.pubv-clear-btn {
    border: 1px solid #c0392b;
    background: #fff;
    color: #c0392b;
    border-radius: 4px;
    padding: 0.25rem 0.7rem;
    font-size: 0.82rem;
    cursor: pointer;
    margin-left: auto;
}

.pubv-clear-btn:hover {
    background: #c0392b;
    color: #fff;
}

/* Header info bar */
.pubv-headerbar {
    background: #ffffff;
    border: 1px solid #3d436d;
    border-radius: 4px;
    padding: 0.5rem 0.8rem;
    color: #3d436d;
    font-family: Calibri, sans-serif;
    font-size: 0.88rem;
    margin-bottom: 0.6rem;
}

/* 2D / 3D tabs */
.pubv-tabs {
    display: inline-flex;
    border: 1px solid #3d436d;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.6rem;
}

.pubv-tab {
    border: none;
    background: #fff;
    color: #3d436d;
    padding: 0.4rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.pubv-tab + .pubv-tab {
    border-left: 1px solid #3d436d;
}

.pubv-tab.pubv-tab--active {
    background: #1B5FAA;
    color: #fff;
}

/* 2D layout (web/flange grid + source) */
.pubv-layout {
    display: flex;
    gap: 0.6rem;
    align-items: stretch;
    height: calc(100vh - 300px);
    min-height: 460px;
}

.pubv-codepane {
    width: 200px;
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    border: 1px solid #3d436d;
    border-radius: 4px;
    background: #f8f9fb;
    overflow: hidden;
}

.pubv-codepane-title {
    background: #c1d3e8;
    color: #3d436d;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #3d436d;
}

#pubvCodePanel,
#pubvCodePanel3d {
    flex: 1;
    overflow: auto;
    margin: 0;
    padding: 0.4rem 0.5rem;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    line-height: 1.35;
    background: #f8f9fb;
    color: #333;
    white-space: pre;
}

#pubvCodePanel .nc-blok,
#pubvCodePanel3d .nc-blok {
    color: #1B5FAA;
    font-weight: 700;
}

#pubvCodePanel .nc-boring,
#pubvCodePanel3d .nc-boring {
    color: #b53227;
}

/* Each NC source line is one clickable element (code <-> 3D linking). */
#pubvCodePanel .nc-line,
#pubvCodePanel3d .nc-line {
    display: block;
    cursor: pointer;
    border-left: 3px solid transparent;
    padding-left: 3px;
    border-radius: 2px;
}

#pubvCodePanel .nc-line:hover,
#pubvCodePanel3d .nc-line:hover {
    background: #e8eefc;
}

#pubvCodePanel .nc-line--selected,
#pubvCodePanel3d .nc-line--selected {
    background: #fff2a8;
    border-left-color: #f5a000;
}

.pubv-canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pubv-canvas-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0.4rem;
    min-height: 0;
}

.pubv-canvas-cell {
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    background: #ffffff;
    overflow: hidden;
    position: relative;
}

.pubv-canvas-cell canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* 3D view: NC code side pane next to the model. */
.pubv-layout3d {
    display: flex;
    gap: 0.6rem;
    align-items: stretch;
}

.pubv-codepane--3d {
    min-height: 460px;
}

.pubv-3d-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* 3D view buttons */
.pubv-view3d-bar {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}

.pubv-vbtn {
    border: 1px solid #9aa9c4;
    background: #fff;
    color: #3d436d;
    border-radius: 4px;
    padding: 0.25rem 0.7rem;
    font-size: 0.82rem;
    cursor: pointer;
}

.pubv-vbtn:hover {
    border-color: #1B5FAA;
    background: #eef2f8;
}

/* 3D pane */
.pubv-3d-wrap {
    position: relative;
    border: 1px solid #3d436d;
    border-radius: 4px;
    background: #f0f0f0;
    overflow: hidden;
    height: calc(100vh - 300px);
    min-height: 460px;
}

#pubv3dCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.pubv-3d-gizmo {
    position: absolute;
    left: 8px;
    bottom: 8px;
    width: 128px;
    height: 128px;
    z-index: 5;
    cursor: pointer;
}

.pubv-3d-status {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    color: #3d436d;
    font-size: 0.82rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    border: 1px solid #cbd5e0;
    pointer-events: none;
}

.pubv-3d-hint {
    position: absolute;
    bottom: 0.5rem;
    right: 0.6rem;
    color: #6b748c;
    font-size: 0.78rem;
    background: rgba(255, 255, 255, 0.8);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    pointer-events: none;
}

/* Navigation between files */
.pubv-jobnav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 0;
    margin-top: 0.4rem;
    color: #3d436d;
    font-family: Calibri, sans-serif;
    font-size: 0.95rem;
}

.pubv-navbtn {
    background: #1B5FAA;
    color: #ffffff;
    border: 1px solid #3d436d;
    border-radius: 4px;
    padding: 0.35rem 0.9rem;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
}

.pubv-navbtn:hover {
    background: #154d8a;
}

.pubv-navbtn:active {
    transform: translateY(1px);
}

#pubvJobLabel {
    min-width: 14rem;
    text-align: center;
    font-weight: 600;
}

@media (max-width: 900px) {
    .pubv-layout,
    .pubv-layout3d {
        flex-direction: column;
        height: auto;
    }
    .pubv-codepane {
        width: auto;
        flex: 0 0 200px;
        height: 200px;
    }
    .pubv-codepane--3d {
        flex: 0 0 200px;
        height: 200px;
        min-height: 0;
    }
    .pubv-canvas-grid {
        height: 70vh;
    }
    .pubv-3d-wrap {
        height: 70vh;
    }
}

/* Active view button + compare toggle */
.pubv-vbtn.pubv-vbtn--active {
    background: #1B5FAA;
    color: #fff;
    border-color: #1B5FAA;
}

.pubv-vbtn--cmp {
    margin-left: auto;
    border-color: #1B5FAA;
    color: #1B5FAA;
    font-weight: 600;
}

/* Compare panel: Solid Edge ISO 1 / ISO 2 vs the OCCT render */
.pubv-compare {
    margin-top: 0.6rem;
    border: 1px solid #9aa9c4;
    border-radius: 4px;
    background: #fafbfd;
    padding: 0.6rem;
}

.pubv-compare-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.pubv-compare-title {
    font-weight: 600;
    color: #3d436d;
    margin-right: auto;
}

.pubv-cmp-pick,
.pubv-cmp-clear {
    border: 1px solid #9aa9c4;
    background: #fff;
    color: #3d436d;
    border-radius: 4px;
    padding: 0.25rem 0.7rem;
    font-size: 0.82rem;
    cursor: pointer;
}

.pubv-cmp-pick:hover,
.pubv-cmp-clear:hover {
    border-color: #1B5FAA;
    background: #eef2f8;
}

.pubv-compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.6rem;
}

.pubv-compare-warn {
    margin-bottom: 0.6rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid #e0b400;
    background: #fff8e1;
    color: #7a5b00;
    border-radius: 4px;
    font-size: 0.85rem;
}

.pubv-compare-cell--glb canvas {
    display: block;
    width: 100%;
    height: 320px;
    background: #f0f0f0;
    border: 1px solid #d4dae6;
    border-radius: 4px;
}

.pubv-compare-cell {
    margin: 0;
    text-align: center;
}

.pubv-compare-cell figcaption {
    font-size: 0.8rem;
    color: #5a6079;
    margin-bottom: 0.3rem;
}

.pubv-compare-cell img {
    display: none;
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    background: #f0f0f0;
    border: 1px solid #d4dae6;
    border-radius: 4px;
}

@media (max-width: 700px) {
    .pubv-compare-grid {
        grid-template-columns: 1fr;
    }
}
