/* 3D-Beschlagansicht (Vorschau, nur Testseite) */
.b3d-launch { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 14px; border: 1px solid #1d4ed8; border-radius: 6px; background: linear-gradient(180deg, #2563eb, #1d4ed8); color: #fff; font-weight: 700; font-size: 0.85rem; cursor: pointer; box-shadow: 0 2px 6px rgba(37, 99, 235, .25); }
.b3d-launch span { font-weight: 500; font-size: 0.72rem; opacity: .85; background: rgba(255, 255, 255, .18); padding: 2px 6px; border-radius: 4px; }
.b3d-launch:hover { filter: brightness(1.08); }

#beschlag3dOverlay { position: fixed; inset: 0; z-index: 10050; display: none; flex-direction: column; background: #e9edf2; font-family: inherit; color: #0f172a; }
#beschlag3dOverlay .b3d-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; background: #fff; border-bottom: 1px solid #e2e8f0; }
#beschlag3dOverlay .b3d-title { font-weight: 800; font-size: 1rem; }
#beschlag3dOverlay .b3d-title span { font-weight: 500; font-size: 0.78rem; color: #64748b; margin-left: 6px; }
#beschlag3dOverlay .b3d-tools { display: flex; flex-wrap: wrap; gap: 6px; }
#beschlag3dOverlay .b3d-btn { padding: 7px 12px; border: 1px solid #cbd5e1; border-radius: 6px; background: #f8fafc; color: #0f172a; font-weight: 600; font-size: 0.82rem; cursor: pointer; }
#beschlag3dOverlay .b3d-btn:hover:not(:disabled) { background: #eef2f7; }
#beschlag3dOverlay .b3d-btn.active { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }
#beschlag3dOverlay .b3d-btn:disabled { opacity: .45; cursor: not-allowed; }
#beschlag3dOverlay .b3d-btn-accent { background: #0f172a; color: #fff; border-color: #0f172a; }
#beschlag3dOverlay .b3d-btn-accent:hover:not(:disabled) { background: #1e293b; }
#beschlag3dOverlay .b3d-btn-primary { width: 100%; margin-top: 12px; background: #16a34a; border-color: #16a34a; color: #fff; }
#beschlag3dOverlay .b3d-btn-primary:hover:not(:disabled) { background: #15803d; }
#beschlag3dOverlay .b3d-info .b3d-btn:not(.b3d-btn-primary) { width: 100%; margin-top: 6px; }
#beschlag3dOverlay .b3d-close { font-size: 1rem; padding: 6px 11px; }
#beschlag3dOverlay .b3d-stage { position: relative; flex: 1; min-height: 0; }
#beschlag3dOverlay .b3d-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#beschlag3dOverlay .b3d-legend { position: absolute; left: 16px; bottom: 46px; display: flex; flex-direction: column; gap: 6px; }
#beschlag3dOverlay .b3d-legend button { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 6px; background: rgba(255, 255, 255, .92); font-size: 0.8rem; font-weight: 600; cursor: pointer; text-align: left; }
#beschlag3dOverlay .b3d-legend i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
#beschlag3dOverlay .b3d-legend small { color: #64748b; font-weight: 500; }
#beschlag3dOverlay .b3d-info { display: none; position: absolute; right: 16px; top: 74px; width: 250px; padding: 14px; border: 1px solid #e2e8f0; border-radius: 10px; background: rgba(255, 255, 255, .96); box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
#beschlag3dOverlay .b3d-info-tag { width: 34px; height: 5px; border-radius: 3px; margin-bottom: 10px; }
#beschlag3dOverlay .b3d-info-name { font-weight: 800; font-size: 1rem; }
#beschlag3dOverlay .b3d-info-art { margin-top: 2px; font-size: 0.85rem; color: #334155; font-variant-numeric: tabular-nums; }
#beschlag3dOverlay .b3d-info-desc { margin-top: 4px; font-size: 0.78rem; color: #64748b; }
#beschlag3dOverlay .b3d-status { position: absolute; left: 0; right: 0; bottom: 0; padding: 9px 16px; background: rgba(15, 23, 42, .82); color: #fff; font-size: 0.82rem; }
@media (max-width: 640px) {
    #beschlag3dOverlay .b3d-title span { display: none; }
    #beschlag3dOverlay .b3d-info { left: 16px; right: 16px; width: auto; top: auto; bottom: 46px; }
    #beschlag3dOverlay .b3d-legend { display: none; }
}

/* Vorab berechnete Blender-Animation (Demontage/Montage) über der 3D-Ansicht */
#beschlag3dOverlay .b3d-video { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, .55); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .35s ease; }
#beschlag3dOverlay .b3d-video.show { opacity: 1; pointer-events: auto; }
#beschlag3dOverlay .b3d-video-box { position: relative; border-radius: 14px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .08); background: #3b3f45; }
#beschlag3dOverlay .b3d-video video { display: block; width: 100%; height: 100%; }
#beschlag3dOverlay .b3d-video.mirror video { transform: scaleX(-1); }
#beschlag3dOverlay .b3d-video.mirror .b3d-hotspots { transform: scaleX(-1); }
#beschlag3dOverlay .b3d-video.mirror .b3d-hotspot span { transform: scaleX(-1); }
#beschlag3dOverlay .b3d-hotspots { position: absolute; inset: 0; }
#beschlag3dOverlay .b3d-hotspot { position: absolute; border: 2px solid transparent; border-radius: 10px; background: transparent; cursor: pointer; transition: border-color .2s, background .2s; }
#beschlag3dOverlay .b3d-hotspot:hover, #beschlag3dOverlay .b3d-hotspot:focus-visible { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); outline: none; }
#beschlag3dOverlay .b3d-hotspot span { position: absolute; left: 50%; bottom: -30px; translate: -50% 0; white-space: nowrap; padding: 3px 9px; border-radius: 6px; background: rgba(15, 23, 42, .78); color: #fff; font-size: .76rem; font-weight: 700; }
#beschlag3dOverlay .b3d-hotspot span small { margin-left: 6px; font-weight: 500; opacity: .8; }
#beschlag3dOverlay .b3d-final { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .25s ease; pointer-events: none; }
#beschlag3dOverlay .b3d-video.final .b3d-final { opacity: 1; }
#beschlag3dOverlay .b3d-video.mirror .b3d-final { transform: scaleX(-1); }

/* 360°-Fotoansicht (Blender-Bilder) */
#beschlag3dOverlay .b3d-spin { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, .55); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
#beschlag3dOverlay .b3d-spin.show { opacity: 1; pointer-events: auto; }
#beschlag3dOverlay .b3d-spin-box { position: relative; border-radius: 14px; overflow: hidden; background: #3b3f45; box-shadow: 0 24px 60px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .08); }
#beschlag3dOverlay .b3d-spin canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#beschlag3dOverlay .b3d-spin.mirror canvas { transform: scaleX(-1); }
#beschlag3dOverlay .b3d-spin-hint { position: absolute; left: 50%; bottom: 12px; translate: -50% 0; padding: 4px 10px; border-radius: 6px; background: rgba(15, 23, 42, .6); color: #fff; font-size: .76rem; pointer-events: none; }
#beschlag3dOverlay .b3d-spin-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: rgba(15, 23, 42, .6); color: #fff; font-size: 1rem; cursor: pointer; }
#beschlag3dOverlay .b3d-spin-load { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; color: #e2e8f0; font-size: .9rem; }
#beschlag3dOverlay .b3d-spin.loading .b3d-spin-load { display: flex; }
#beschlag3dOverlay .b3d-info, #beschlag3dOverlay .b3d-legend, #beschlag3dOverlay .b3d-status { z-index: 5; }

/* Umschalter 2D/3D über dem Zeichnungs-Kästchen */
/* Für Mitarbeiter ausgeblendet: 2D/3D-Umschalter und "Testfall laden" im Aufmaß-Pilot */
html[data-role="employee"] :is(.b3d-switch, #avTestfaelle) { display: none !important; }
.b3d-switch { display: inline-flex; gap: 0; margin: 0 0 10px; border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; background: #f8fafc; }
.b3d-switch button { padding: 7px 14px; border: 0; background: transparent; color: #334155; font-weight: 700; font-size: .82rem; cursor: pointer; }
.b3d-switch button + button { border-left: 1px solid #cbd5e1; }
.b3d-switch button.active { background: #1d4ed8; color: #fff; }
.b3d-switch button span { font-weight: 500; font-size: .7rem; opacity: .8; margin-left: 4px; }

/* 3D-Ansicht im Kästchen der Seite (kompakt) */
#beschlag3dOverlay.b3d-inline { position: relative; inset: auto; z-index: 1; height: min(72vh, 600px); min-height: 420px; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
#beschlag3dOverlay.b3d-inline .b3d-top { padding: 6px 8px; gap: 6px; }
#beschlag3dOverlay.b3d-inline .b3d-title { font-size: .85rem; }
#beschlag3dOverlay.b3d-inline .b3d-title span { display: none; }
#beschlag3dOverlay.b3d-inline .b3d-tools { gap: 4px; }
#beschlag3dOverlay.b3d-inline .b3d-btn { padding: 5px 8px; font-size: .74rem; }
#beschlag3dOverlay.b3d-inline .b3d-legend { display: none; }
#beschlag3dOverlay.b3d-inline .b3d-info { top: 52px; right: 8px; width: 210px; padding: 10px; }
#beschlag3dOverlay.b3d-inline .b3d-status { padding: 6px 10px; font-size: .74rem; }
#beschlag3dOverlay.b3d-inline .b3d-spin-hint { font-size: .68rem; }
#beschlag3dOverlay .b3d-video-close { z-index: 3; }
