/* ==========================================================================
   3D Viewer — container and loading state
   ========================================================================== */

#container {
    width: 100%;
    height: 100%;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, rgba(248, 250, 255, 0.95), rgba(241, 245, 255, 0.9));
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

#container.loading::before {
    content: 'Lade 3D-Modell...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(var(--primary-rgb), 0.6);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.05em;
    animation: pulse 1.5s ease-in-out infinite;
    z-index: 10;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ==========================================================================
   No 3D model placeholder
   ========================================================================== */

.no-3d-placeholder {
    width: 100%;
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, rgba(248, 250, 255, 0.95), rgba(241, 245, 255, 0.9));
    border-radius: 16px;
    padding: 40px 24px;
    box-sizing: border-box;
}

.no-3d-placeholder__card {
    max-width: 420px;
    color: rgba(var(--primary-rgb), 0.75);
}

.no-3d-placeholder__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb), 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(var(--primary-rgb), 0.6);
}

.no-3d-placeholder__title {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 600;
    color: rgba(var(--primary-rgb), 0.85);
}

.no-3d-placeholder__text {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
}

/* ==========================================================================
   Fullscreen toggle and visual-pane fullscreen mode
   ========================================================================== */

.btn-fullscreen {
    padding: 8px 12px;
    border-radius: 999px;
    background-color: rgba(var(--primary-rgb), 0.12);
    color: var(--primary-color);
    border: 1px solid rgba(var(--primary-rgb), 0.18);
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 10px 20px rgba(var(--primary-rgb), 0.12);
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-fullscreen:hover {
    background-color: rgba(var(--primary-rgb), 0.22);
    transform: scale(1.05);
}

.visual-pane.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(180deg, rgba(241, 245, 255, 0.98), rgba(231, 238, 255, 0.95));
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
}

.visual-pane.fullscreen-mode .visual-pane__stage {
    height: calc(100vh - 120px);
    max-height: none;
}

.visual-pane.fullscreen-mode #3dcontainer {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.visual-pane.fullscreen-mode #container,
.visual-pane.fullscreen-mode canvas,
.visual-pane.fullscreen-mode img {
    max-height: 100%;
    max-width: 100%;
    height: auto;
    width: auto;
    object-fit: contain;
}

.btn-fullscreen.exit-fullscreen svg {
    transform: rotate(180deg);
}

/* ==========================================================================
   Floating clip overlay (inside 3D viewer)
   ========================================================================== */

.clip-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

/* ── Trigger button (always visible) ── */
.clip-overlay__trigger {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(var(--neutrals-0-rgb), 0.85);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--textcolor-80contrast, var(--slate-600));
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.clip-overlay__trigger:hover {
    background: var(--neutrals-0);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.clip-overlay__trigger--open {
    background: var(--primary-color);
    color: var(--neutrals-0);
}

.clip-overlay__trigger--open:hover {
    background: var(--primary-color);
    color: var(--neutrals-0);
}

/* ── Panel (expandable card) ── */
.clip-overlay__panel {
    background: rgba(var(--neutrals-0-rgb), 0.92);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    padding: 12px;
    width: 240px;
    animation: clipSlideIn 0.15s ease;
}

@keyframes clipSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Rows ── */
.clip-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.clip-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--textcolor-80contrast, var(--slate-600));
}

/* ── Toggle ── */
.clip-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.clip-toggle input { display: none; }

.clip-toggle__track {
    position: absolute;
    inset: 0;
    background: var(--slate-300);
    border-radius: 10px;
    transition: background 0.2s;
}

.clip-toggle__track::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--neutrals-0);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.clip-toggle input:checked + .clip-toggle__track {
    background: var(--primary-color);
}

.clip-toggle input:checked + .clip-toggle__track::after {
    transform: translateX(16px);
}

/* ── Body (visible when enabled) ── */
.clip-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* ── Axis buttons ── */
.clip-axis {
    display: flex;
    gap: 3px;
    flex: 1;
}

.clip-axis__btn {
    flex: 1;
    padding: 5px 0;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm, 6px);
    font-size: 12px;
    font-weight: 700;
    color: var(--textcolor-50contrast, var(--slate-400));
    cursor: pointer;
    transition: all 0.15s;
}

.clip-axis__btn:hover {
    border-color: rgba(0, 0, 0, 0.2);
    color: var(--textcolor-80contrast, var(--slate-600));
}

.clip-axis__btn--active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--neutrals-0);
}

/* ── Icon button (invert) ── */
.clip-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: transparent;
    color: var(--textcolor-50contrast, var(--slate-400));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.clip-icon-btn:hover {
    border-color: rgba(0, 0, 0, 0.2);
    color: var(--textcolor-80contrast, var(--slate-600));
}

.clip-icon-btn--active {
    background: var(--error-50);
    border-color: var(--error-200);
    color: var(--error-600);
}

/* ── Slider ── */
.clip-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.clip-slider {
    flex: 1;
    height: 4px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    margin: 0;
}

.clip-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--neutrals-0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.clip-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--neutrals-0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.clip-slider__value {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 32px;
    text-align: right;
}

/* ── Fill buttons ── */
.fill-btn {
    flex: 1;
    padding: 5px 10px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: transparent;
    font-size: 11px;
    font-weight: 600;
    color: var(--textcolor-50contrast, var(--slate-400));
    cursor: pointer;
    transition: all 0.15s;
}

.fill-btn:hover { border-color: rgba(0, 0, 0, 0.2); }

.fill-btn--active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--neutrals-0);
}

/* ── Hint text ── */
.clip-hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--textcolor-50contrast, var(--slate-400));
}

/* ── Footer ── */
.clip-footer {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.clip-text-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--textcolor-50contrast, var(--slate-400));
    cursor: pointer;
    transition: color 0.15s;
}

.clip-text-btn:hover {
    color: var(--textcolor-80contrast, var(--slate-600));
}

/* ── Responsive ── */
@media (max-width: 576px) {
    .clip-overlay__panel {
        width: 200px;
    }
}
