/* File viewers (3D Viewer, DXF Viewer): the shared shell */

.vw-app {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--glass-shadow);
    padding: 22px;
}

.vw-app h3 {
    font-size: 0.95rem;
    color: var(--text-heading);
    margin: 0 0 10px;
}

.vw-hint {
    font-size: 0.84rem;
    color: var(--text-muted);
    margin: 10px 0 0;
    line-height: 1.5;
}

.vw-hint a {
    color: #ff6b6b;
    font-weight: 600;
}

.vw-alert {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.35);
    color: #e25555;
    font-size: 0.92rem;
    line-height: 1.5;
}

.vw-alert a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

/* ---- start ---- */

.vw-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    min-height: 260px;
    padding: 28px 20px;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.vw-drop:hover,
.vw-drop:focus-visible,
.vw-app.is-over .vw-drop {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.06);
    outline: none;
}

.vw-drop-icon {
    color: #ff6b6b;
}

.vw-drop h2 {
    font-size: 1.25rem;
    color: var(--text-heading);
    margin: 4px 0 0;
}

.vw-drop p {
    margin: 0;
    font-size: 0.92rem;
}

.vw-formats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    padding: 0;
    list-style: none;
}

.vw-formats li {
    padding: 2px 9px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}

/* ---- working ---- */

.vw-work-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 16px;
    color: var(--text-heading);
    margin-bottom: 10px;
}

.vw-work-head span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.vw-bar {
    height: 12px;
    border-radius: 6px;
    background: var(--input-bg);
    overflow: hidden;
}

.vw-bar > div {
    height: 100%;
    width: 0%;
    background: var(--primary-gradient);
    border-radius: 6px;
    transition: width 0.25s ease;
}

.vw-bar.is-busy > div {
    width: 35% !important;
    animation: vw-slide 1.2s ease-in-out infinite alternate;
}

@keyframes vw-slide {
    from { margin-left: 0; }
    to { margin-left: 65%; }
}

.vw-work-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.vw-btn,
.vw-btn-quiet {
    padding: 8px 18px;
    font-size: 0.88rem;
    border-radius: 50px;
    background: transparent;
    color: var(--text-heading);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.vw-btn:hover,
.vw-btn-quiet:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* ---- viewer ---- */

.vw-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 14px;
}

.vw-fileinfo {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    min-width: 0;
}

.vw-fileinfo strong {
    color: var(--text-heading);
    font-size: 1rem;
    overflow-wrap: anywhere;
}

.vw-fileinfo span {
    color: var(--text-muted);
    font-size: 0.86rem;
}

.vw-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(255, 196, 77, 0.12);
    border: 1px solid rgba(255, 196, 77, 0.45);
    color: var(--text-main);
    font-size: 0.88rem;
    line-height: 1.5;
}

.vw-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}

.vw-main {
    min-width: 0;
}

.vw-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

.vw-toolbar .vw-sep {
    width: 1px;
    align-self: stretch;
    margin: 2px 4px;
    background: var(--border-color);
}

.vw-tool-btn {
    padding: 5px 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    white-space: nowrap;
}

.vw-tool-btn:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.vw-tool-btn[aria-pressed="true"] {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: #fff;
}

.vw-star {
    margin-left: 4px;
    color: #e0a422;
    font-size: 0.8rem;
}

.vw-tool-btn[aria-pressed="true"] .vw-star {
    color: #fff;
}

.vw-icon-btn {
    display: inline-flex;
    align-items: center;
}

.vw-icon-btn svg {
    display: block;
    margin: 2px 0;
}

.vw-stage {
    position: relative;
    height: min(68vh, 640px);
    min-height: 320px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    background: #f3f5f9;
    touch-action: none;
}

.vw-stage canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
}

.vw-stage.is-picking canvas {
    cursor: crosshair;
}

.vw-stage:fullscreen {
    height: 100vh;
    border-radius: 0;
    border: none;
}

.vw-stage-hint {
    position: absolute;
    left: 10px;
    bottom: 8px;
    padding: 3px 9px;
    border-radius: 50px;
    background: rgba(20, 24, 34, 0.55);
    color: #fff;
    font-size: 0.74rem;
    pointer-events: none;
    transition: opacity 0.4s;
}

.vw-stage-hint.is-gone {
    opacity: 0;
}

.vw-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.vw-label {
    position: absolute;
    transform: translate(-50%, -50%);
    padding: 2px 8px;
    border-radius: 6px;
    background: #14182a;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.vw-toolbox {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    font-size: 0.88rem;
    color: var(--text-main);
}

.vw-toolbox strong {
    color: var(--text-heading);
}

.vw-toolbox .vw-grow {
    flex: 1 1 160px;
    min-width: 0;
}

.vw-readout {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
}

.vw-readout b {
    color: #ff6b6b;
    font-size: 1rem;
}

.vw-under {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
    align-items: start;
}

.vw-app.is-premium .vw-star {
    display: none;
}

.vw-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.vw-card {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
}

.vw-card h3 .vw-count {
    color: var(--text-muted);
    font-weight: 500;
}

.vw-info {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px 12px;
    margin: 0;
    font-size: 0.88rem;
}

.vw-info dt {
    color: var(--text-muted);
}

.vw-info dd {
    margin: 0;
    color: var(--text-heading);
    font-weight: 600;
    text-align: right;
}

.vw-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    min-width: 0;
}

.vw-field > span {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.vw-field select,
.vw-field input[type="text"],
.vw-field input[type="number"] {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-main);
    font: inherit;
    font-weight: 500;
}

.vw-field input[type="range"] {
    width: 100%;
    accent-color: #ff6b6b;
}

.vw-field input[type="color"] {
    width: 100%;
    height: 34px;
    padding: 2px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    cursor: pointer;
}

.vw-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.vw-grid .vw-wide {
    grid-column: 1 / -1;
}

.vw-check {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
}

.vw-check input {
    width: 17px;
    height: 17px;
    accent-color: #ff6b6b;
    flex: 0 0 auto;
}

.vw-list {
    position: relative;
    max-height: 260px;
    overflow: auto;
    margin: 0 -6px;
    padding: 0 6px;
}

.vw-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 0.86rem;
    color: var(--text-main);
}

.vw-row:hover {
    background: rgba(255, 107, 107, 0.08);
}

.vw-row.is-selected {
    background: rgba(255, 107, 107, 0.16);
}

.vw-row.is-group {
    font-weight: 600;
    color: var(--text-heading);
}

.vw-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #ff6b6b;
    flex: 0 0 auto;
}

.vw-row .vw-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(128, 128, 128, 0.5);
    flex: 0 0 auto;
}

.vw-row .vw-row-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.vw-row .vw-row-note {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    flex: 0 0 auto;
}

.vw-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.vw-link {
    background: none;
    border: none;
    padding: 0;
    color: #ff6b6b;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.vw-primary {
    width: 100%;
    margin-top: 12px;
}

.vw-result {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 12px;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.vw-plan {
    margin: 10px 0 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-muted);
}

@media (max-width: 980px) {
    .vw-columns {
        grid-template-columns: minmax(0, 1fr);
    }

    .vw-stage {
        height: min(60vh, 520px);
    }
}

@media (max-width: 560px) {
    .vw-app {
        padding: 14px;
    }

    .vw-under {
        grid-template-columns: minmax(0, 1fr);
    }

    .vw-drop {
        min-height: 200px;
    }

    .vw-stage {
        min-height: 280px;
    }

    .vw-stage-hint {
        display: none;
    }
}

/* The site's phone stylesheet makes every button and input a full-width block (with !important).
   These controls are laid out here, so they opt out. */
.vw-app .vw-tool-btn {
    width: auto !important;
    padding: 5px 8px !important;
    font-size: 0.82rem !important;
}

.vw-app .vw-btn,
.vw-app .vw-btn-quiet,
.vw-app .vw-notice .btn {
    width: auto !important;
    padding: 8px 18px !important;
    font-size: 0.88rem !important;
}

.vw-app .vw-link,
.vw-app .vw-row-name,
.vw-app .vw-plan button {
    display: inline !important;
    width: auto !important;
    padding: 0 !important;
}

.vw-app .vw-link {
    font-size: 0.84rem !important;
}

.vw-app .vw-row-name,
.vw-app .vw-plan button {
    font-size: inherit !important;
}

.vw-app .vw-row .vw-row-name {
    display: block !important;
    flex: 1 1 auto !important;
}

.vw-app input[type="range"] {
    padding: 0 !important;
    height: auto !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.vw-app input[type="checkbox"] {
    width: 17px !important;
    height: 17px !important;
    padding: 0 !important;
}

.vw-app .vw-field input[type="color"] {
    width: 100% !important;
    height: 34px !important;
    padding: 2px !important;
}

.vw-app .vw-field select,
.vw-app .vw-field input[type="text"],
.vw-app .vw-field input[type="number"] {
    padding: 8px 10px !important;
}

/* 2D drawings: the engine puts its own canvas in the holder; the measuring marks sit above it */
.vw-holder {
    position: absolute;
    inset: 0;
}

.vw-holder canvas {
    cursor: grab;
    touch-action: none;
}

.vw-stage.is-picking .vw-holder canvas {
    cursor: crosshair;
}

.vw-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.vw-overlay line {
    stroke: #ff6b6b;
    stroke-width: 2;
}

.vw-overlay circle {
    fill: #ff6b6b;
    stroke: #fff;
    stroke-width: 1.5;
}

.vw-overlay rect {
    fill: none;
    stroke: #ff6b6b;
    stroke-width: 2;
}

.vw-coords {
    position: absolute;
    right: 10px;
    bottom: 8px;
    padding: 3px 9px;
    border-radius: 50px;
    background: rgba(20, 24, 34, 0.55);
    color: #fff;
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    white-space: pre;
    pointer-events: none;
}

label.vw-row {
    cursor: pointer;
}

.vw-row .vw-row-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vw-app [hidden] {
    display: none !important;
}
