/* =============================================================
   3D Builder Mascold — Frontend Viewer (Three.js / WebGL)
   ============================================================= */

.tdb-frontend-wrap {
    padding: 16px 0;
}

/* ─── Stage wrapper ─────────────────────────────────────────── */

.tdb-viewer-stage-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 640px;
}

/* Stage: altura fija para que Three.js pueda leer clientHeight */
.tdb-viewer-stage {
    position: relative;
    width: 100%;
    height: 480px;
    background: #edf0f5;
    border-radius: 10px;
    overflow: hidden;
    cursor: grab;
    border: 1px solid #dde1e8;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tdb-viewer-stage:active { cursor: grabbing; }

/* El canvas de Three.js ocupa todo el stage */
.tdb-viewer-stage canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* ─── Loading indicator ─────────────────────────────────────── */

.tdb-viewer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #6b7280;
    font-size: 13px;
}

.tdb-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #d1d5db;
    border-top-color: #6b7280;
    border-radius: 50%;
    animation: tdb-spin .8s linear infinite;
}

@keyframes tdb-spin {
    to { transform: rotate(360deg); }
}

.tdb-viewer-error {
    color: #cc0000;
    padding: 20px;
    font-size: 13px;
}

/* ─── Botones de control ─────────────────────────────────────── */

.tdb-viewer-controls {
    position: absolute;
    bottom: 14px;
    right: 14px;
    display: flex;
    gap: 6px;
    z-index: 10;
}

.tdb-ctrl-btn {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(0,0,0,.16);
    border-radius: 7px;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(6px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    transition: background .15s, transform .1s, box-shadow .15s;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.tdb-ctrl-btn:hover {
    background: #fff;
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.tdb-ctrl-btn svg { display: block; flex-shrink: 0; }

/* ─── Hint ──────────────────────────────────────────────────── */

.tdb-viewer-hint {
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 8px;
}

/* ─── Responsive ────────────────────────────────────────────── */

@media (max-width: 480px) {
    .tdb-viewer-stage { height: 340px; }
}
