/* ==========================================================================
   POLIKA PLATFORM — SLICER & PLATE STUDIO STYLES
   Direction: High-precision 3D Print Plater & Farm Macro Studio
   ========================================================================== */

/* Authentic Bambu Studio Full Viewport Layout */
.slicer-container {
    display: block;
    position: relative;
    width: 100%;
    height: calc(100vh - 120px);
    min-height: 720px;
    margin: 0;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #3e3e46;
}

@media (max-width: 992px) {
    .slicer-container {
        height: 680px;
    }
}

/* --- Left Viewport (3D Canvas) --- */
.slicer-viewport-card {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: none;
    background: #3e3e46;
}

.slicer-canvas-wrap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: #3e3e46 !important;
    cursor: grab;
    overflow: hidden;
}

.slicer-canvas-wrap:active {
    cursor: grabbing;
}

/* Bucket & Paint Cursors */
.slicer-canvas-wrap.cursor-bucket,
.slicer-canvas-wrap.cursor-bucket #slicer-three-canvas,
.slicer-canvas-wrap.cursor-bucket canvas,
.slicer-canvas-wrap.cursor-bucket:active {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24'%3E%3Cpath d='M19 11L11 3L2.4 11.6a2 2 0 0 0 0 2.8l5.2 5.2a2 2 0 0 0 2.8 0L19 11z' fill='%232563EB' stroke='%23ffffff' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M5 2l5 5' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M2 13h17' stroke='%23ffffff' stroke-width='1.5'/%3E%3Cpath d='M21.5 19.5a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4z' fill='%23EAB308' stroke='%23ffffff' stroke-width='1.2'/%3E%3Ccircle cx='2.5' cy='11.5' r='1.5' fill='%23ffffff'/%3E%3C/svg%3E") 2 12, crosshair !important;
}

.slicer-canvas-wrap.cursor-brush,
.slicer-canvas-wrap.cursor-brush #slicer-three-canvas,
.slicer-canvas-wrap.cursor-brush canvas,
.slicer-canvas-wrap.cursor-brush:active {
    cursor: crosshair !important;
}

#slicer-three-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Viewport HUD Overlays */
.slicer-hud-top {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 10;
}

.slicer-hud-pill {
    pointer-events: auto;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
}

.slicer-hud-actions {
    pointer-events: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.slicer-hud-btn {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #f1f5f9;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.slicer-hud-btn:hover {
    background: rgba(37, 99, 235, 0.9);
    border-color: #60a5fa;
    color: #ffffff;
    transform: translateY(-1px);
}

.slicer-hud-bottom {
    position: absolute;
    bottom: 14px;
    left: 14px;
    right: 14px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    z-index: 10;
}

.slicer-hud-legend {
    pointer-events: auto;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-family: var(--font-mono, monospace);
    line-height: 1.4;
}

.slicer-drop-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 5;
}

.slicer-drop-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

.slicer-drop-icon {
    font-size: 2.8rem;
    color: var(--ui-accent, #2563EB);
    margin-bottom: 12px;
    animation: floatBounce 2.5s infinite ease-in-out;
}

@keyframes floatBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Viewport Bottom Toolbar */
.slicer-viewport-bar {
    padding: 12px 16px;
    background: var(--ui-surface, #ffffff);
    border-top: 1px solid var(--ui-border, #E2E8F0);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.slicer-model-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--ui-ink, #0f172a);
    font-weight: 600;
}

.slicer-model-badge i {
    color: var(--ui-accent, #2563EB);
}

.slicer-model-dim {
    font-size: 0.74rem;
    color: var(--ui-ink-3, #64748B);
    font-family: var(--font-mono, monospace);
    font-weight: normal;
}

/* --- Right Sidebar Controls --- */
/* Bambu Studio Left Prepare & Settings Drawer (Collapsible) */
.slicer-controls-col {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 380px;
    max-width: 90vw;
    background: rgba(26, 26, 32, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 12px 0 36px rgba(0, 0, 0, 0.6);
    z-index: 50;
    padding: 18px 16px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.slicer-controls-col.open {
    transform: translateX(0);
}

.slicer-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

.slicer-drawer-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.slicer-drawer-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Bambu Studio Top Window Header Bar */
.bambu-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
    padding: 0 16px;
    background: #2b2b30;
    border-bottom: 1px solid #1c1c1f;
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    user-select: none;
    border-radius: 8px 8px 0 0;
}

.bambu-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.bambu-brand-title {
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #f8fafc;
}

.bambu-brand-title svg {
    color: #10b981;
}

.bambu-header-tabs {
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 4px;
    border-radius: 6px;
}

.bambu-header-tab {
    padding: 4px 12px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #94a3b8;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bambu-header-tab:hover {
    color: #ffffff;
}

.bambu-header-tab.active {
    background: #3e3e46;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.bambu-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bambu-slice-btn {
    background: #10b981;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.bambu-slice-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45);
}

.bambu-drawer-trigger-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bambu-drawer-trigger-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.slicer-panel {
    background: var(--ui-surface, #ffffff);
    border: 1px solid var(--ui-border, #E2E8F0);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.slicer-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ui-border-subtle, #f1f5f9);
}

.slicer-panel-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--ui-ink, #0f172a);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.slicer-panel-title i {
    color: var(--ui-accent, #2563EB);
}

/* Quantity & Plater Section */
.slicer-stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--ui-border, #CBD5E1);
    border-radius: 8px;
    overflow: hidden;
    width: 140px;
    background: var(--ui-surface, #ffffff);
}

.slicer-step-btn {
    width: 38px;
    height: 36px;
    background: var(--ui-surface-subtle, #F1F5F9);
    border: none;
    color: var(--ui-ink, #0f172a);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.slicer-step-btn:hover {
    background: var(--ui-border, #E2E8F0);
    color: var(--ui-accent, #2563EB);
}

.slicer-step-input {
    flex: 1;
    width: 100%;
    border: none;
    text-align: center;
    font-weight: 700;
    font-family: var(--font-mono, monospace);
    font-size: 0.95rem;
    color: var(--ui-ink, #0f172a);
    outline: none;
    -moz-appearance: textfield;
}

.slicer-step-input::-webkit-outer-spin-button,
.slicer-step-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* G-code Mode Pills */
.gcode-mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.gcode-mode-card {
    border: 1.5px solid var(--ui-border, #E2E8F0);
    border-radius: 9px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--ui-surface-subtle, #F8FAFC);
}

.gcode-mode-card:hover {
    border-color: var(--ui-accent-border, #BFDBFE);
    background: #ffffff;
}

.gcode-mode-card.active {
    border-color: var(--ui-accent, #2563EB);
    background: var(--ui-accent-soft, #EFF6FF);
    box-shadow: 0 0 0 1px var(--ui-accent, #2563EB);
}

.gcode-mode-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ui-ink, #0f172a);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.gcode-mode-desc {
    font-size: 0.7rem;
    color: var(--ui-ink-3, #64748B);
    line-height: 1.3;
}

/* Stats Metric Grid */
.slicer-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.slicer-stat-box {
    background: var(--ui-surface-subtle, #F8FAFC);
    border: 1px solid var(--ui-border-subtle, #E2E8F0);
    border-radius: 8px;
    padding: 10px 12px;
}

.slicer-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ui-ink-3, #64748B);
    margin-bottom: 4px;
}

.slicer-stat-val {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-heading, var(--font-mono, monospace));
    color: var(--ui-ink, #0F172A);
}

.slicer-stat-unit {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ui-ink-faint, #94A3B8);
    margin-left: 2px;
}

/* Macro Code Area */
.gcode-editor-area {
    width: 100%;
    height: 130px;
    background: #0f172a;
    color: #38bdf8;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 10px;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.73rem;
    line-height: 1.45;
    resize: vertical;
    outline: none;
    white-space: pre;
    box-sizing: border-box;
}

.gcode-editor-area:focus {
    border-color: var(--ui-accent, #2563EB);
}

/* Color Picker Row */
.filament-color-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.color-swatch-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px var(--ui-border, #CBD5E1);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    padding: 0;
}

.color-swatch-btn:hover {
    transform: scale(1.15);
}

.color-swatch-btn.active {
    box-shadow: 0 0 0 2px var(--ui-accent, #2563EB);
    transform: scale(1.18);
}


/* ==========================================================================
   BAMBU AMS MULTICOLOR PAINTING STUDIO
   ========================================================================== */

/* AMS Slots Bar */
.ams-slot-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.ams-slot-card {
    border: 1.5px solid var(--ui-border, #E2E8F0);
    border-radius: 9px;
    padding: 8px 6px;
    cursor: pointer;
    background: var(--ui-surface-subtle, #F8FAFC);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    position: relative;
}

.ams-slot-card:hover {
    border-color: var(--ui-accent-border, #BFDBFE);
    background: #ffffff;
    transform: translateY(-1px);
}

.ams-slot-card.active {
    border-color: var(--ui-accent, #2563EB);
    background: var(--ui-accent-soft, #EFF6FF);
    box-shadow: 0 0 0 2px var(--ui-accent, #2563EB);
}

.ams-slot-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ui-ink-3, #64748B);
    letter-spacing: 0.05em;
}

.ams-color-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    position: relative;
    cursor: pointer;
}

.ams-slot-name {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--ui-ink, #0F172A);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Paint Tools Toolbar */
.paint-tools-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.paint-tool-btn {
    background: var(--ui-surface-subtle, #F8FAFC);
    border: 1px solid var(--ui-border, #CBD5E1);
    color: var(--ui-ink, #0F172A);
    border-radius: 7px;
    padding: 8px 6px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
}

.paint-tool-btn i {
    font-size: 0.9rem;
    color: var(--ui-ink-2, #475569);
}

.paint-tool-btn:hover {
    background: #ffffff;
    border-color: var(--ui-accent, #2563EB);
    color: var(--ui-accent, #2563EB);
}

.paint-tool-btn.active {
    background: var(--ui-accent, #2563EB);
    border-color: var(--ui-accent, #2563EB);
    color: #ffffff;
}

.paint-tool-btn.active i {
    color: #ffffff;
}

/* Paint Control Sliders */
.paint-slider-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.paint-slider-row label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--ui-ink-2, #475569);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.paint-range-input {
    flex: 1;
    accent-color: var(--ui-accent, #2563EB);
    cursor: pointer;
}

.paint-val-badge {
    font-size: 0.75rem;
    font-family: var(--font-mono, monospace);
    font-weight: 700;
    color: var(--ui-ink, #0F172A);
    min-width: 44px;
    text-align: right;
}

/* Painting Active HUD Banner */
.slicer-paint-active-banner {
    display: none;
    background: rgba(37, 99, 235, 0.9);
    backdrop-filter: blur(8px);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    animation: paintPulse 2s infinite ease-in-out;
}

@keyframes paintPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.slicer-paint-active-banner.active {
    display: inline-flex;
}

/* Model Scale & Resize Panel */
.slicer-scale-pct-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.slicer-scale-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--ui-border, #CBD5E1);
    border-radius: 8px;
    background: var(--ui-surface, #ffffff);
    padding: 0 8px;
    flex: 1;
}

.slicer-scale-input-wrap input {
    border: none;
    outline: none;
    width: 100%;
    padding: 6px 4px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: var(--font-mono, monospace);
    color: var(--ui-ink, #0F172A);
    background: transparent;
    text-align: right;
}

.slicer-scale-unit {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ui-ink-3, #64748B);
    margin-left: 2px;
}

.slicer-presets-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.slicer-preset-pill {
    padding: 3px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid var(--ui-border, #E2E8F0);
    background: var(--ui-surface-subtle, #F8FAFC);
    color: var(--ui-ink-2, #475569);
    cursor: pointer;
    transition: all 0.15s ease;
}

.slicer-preset-pill:hover {
    background: var(--ui-accent-soft, #EFF6FF);
    border-color: var(--ui-accent, #2563EB);
    color: var(--ui-accent, #2563EB);
}

.slicer-dim-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.slicer-dim-card {
    background: var(--ui-surface-subtle, #F8FAFC);
    border: 1px solid var(--ui-border, #E2E8F0);
    border-radius: 8px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.slicer-dim-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ui-ink-3, #64748B);
    display: flex;
    justify-content: space-between;
}

.slicer-dim-input {
    border: 1px solid var(--ui-border, #CBD5E1);
    border-radius: 5px;
    padding: 4px 6px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-mono, monospace);
    color: var(--ui-ink, #0F172A);
    background: #ffffff;
    width: 100%;
    text-align: right;
    outline: none;
}

.slicer-dim-input:focus {
    border-color: var(--ui-accent, #2563EB);
    box-shadow: 0 0 0 2px var(--ui-accent-soft, #EFF6FF);
}

.slicer-scale-actions {
    display: flex;
    gap: 8px;
}

/* Print Supports Panel */
.support-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.support-type-card {
    border: 1.5px solid var(--ui-border, #E2E8F0);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    background: var(--ui-surface-subtle, #F8FAFC);
    transition: all 0.2s ease;
}

.support-type-card:hover {
    border-color: var(--ui-accent, #2563EB);
    background: #ffffff;
}

.support-type-card.active {
    border-color: var(--ui-accent, #2563EB);
    background: var(--ui-accent-soft, #EFF6FF);
    box-shadow: 0 0 0 1px var(--ui-accent, #2563EB);
}

.support-type-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ui-ink, #0F172A);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.support-type-card.active .support-type-title {
    color: var(--ui-accent, #2563EB);
}

.support-type-desc {
    font-size: 0.67rem;
    color: var(--ui-ink-3, #64748B);
    line-height: 1.25;
}

/* ==========================================================================
   BAMBU STUDIO AUTHENTIC CAD UI & VIEWPORT OVERLAYS
   ========================================================================== */

.slicer-canvas-wrap {
    background: #3e3e46 !important;
}

/* --- 1. Top Floating Bambu Studio Toolbar --- */
.bambu-top-toolbar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 4px;
    background: #28282e;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    z-index: 30;
    pointer-events: auto;
    user-select: none;
    max-width: calc(100vw - 80px);
    overflow-x: auto;
}

.bambu-tool-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: #c4c4cc;
    cursor: pointer;
    transition: all 0.12s ease;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
}

.bambu-tool-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.3;
    fill: none;
    display: block;
}

.bambu-tool-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.bambu-tool-btn:active {
    transform: scale(0.94);
}

.bambu-tool-btn.active,
.bambu-tool-btn.popover-open {
    background: rgba(0, 174, 66, 0.22) !important;
    border-color: rgba(0, 174, 66, 0.55) !important;
    color: #00ae42 !important;
}

.bambu-tool-btn.dimmed {
    opacity: 0.45;
}

.bambu-tool-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.18);
    margin: 0 4px;
    flex-shrink: 0;
}

/* Top Left Code/Toggle Button */
.bambu-top-left-btn {
    position: absolute;
    top: 12px;
    left: 14px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(28, 28, 34, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #cbd5e1;
    cursor: pointer;
    z-index: 30;
    transition: all 0.15s ease;
}

.bambu-top-left-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* --- 2. Right Floating Action Bar (Vertical) --- */
.bambu-right-floating-bar {
    position: absolute;
    top: 38%;
    right: 22px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px;
    background: rgba(28, 28, 34, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 30;
    pointer-events: auto;
    user-select: none;
}

.bambu-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.bambu-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.bambu-action-btn:active {
    transform: scale(0.94);
}

.bambu-action-btn.active {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.5);
    color: #34d399;
}

/* --- 3. Bottom Left CAD 3D ViewCube --- */
.bambu-viewcube-container {
    position: absolute;
    bottom: 22px;
    left: 22px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    user-select: none;
    pointer-events: auto;
}

.bambu-viewcube-stage {
    width: 50px;
    height: 50px;
    perspective: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bambu-viewcube {
    width: 36px;
    height: 36px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-30deg) rotateY(45deg);
    transition: transform 0.08s linear;
}

.vc-face {
    position: absolute;
    width: 36px;
    height: 36px;
    background: rgba(38, 38, 44, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    color: #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    backface-visibility: visible;
    transition: background 0.15s ease, color 0.15s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.vc-face:hover {
    background: rgba(59, 130, 246, 0.85);
    border-color: #93c5fd;
    color: #ffffff;
}

/* 3D Cube Face Positions */
.vc-face.vc-top    { transform: rotateX(90deg) translateZ(18px); }
.vc-face.vc-bottom { transform: rotateX(-90deg) translateZ(18px); }
.vc-face.vc-front  { transform: translateZ(18px); }
.vc-face.vc-back   { transform: rotateY(180deg) translateZ(18px); }
.vc-face.vc-left   { transform: rotateY(-90deg) translateZ(18px); }
.vc-face.vc-right  { transform: rotateY(90deg) translateZ(18px); }

.bambu-viewcube-axes {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 800;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
}

.bambu-viewcube-axes .vc-x { color: #ef4444; }
.bambu-viewcube-axes .vc-y { color: #10b981; }
.bambu-viewcube-axes .vc-z { color: #3b82f6; }

/* --- 4. Floating CAD Popovers for Bambu Studio Top Toolbar --- */
.bambu-tool-popover {
    position: absolute;
    top: 54px;
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    width: 350px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: rgba(26, 26, 32, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 0, 0, 0.3);
    z-index: 60;
    padding: 14px 16px;
    color: #f1f5f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    pointer-events: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.18s;
}

.bambu-tool-popover.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.bambu-tool-btn.popover-open {
    background: rgba(16, 185, 129, 0.28) !important;
    border-color: rgba(16, 185, 129, 0.6) !important;
    color: #34d399 !important;
}

.bambu-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bambu-popover-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.2px;
}

.bambu-popover-title svg,
.bambu-popover-title i {
    color: #10b981;
}

.bambu-popover-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 1.15rem;
    line-height: 1;
    transition: all 0.15s ease;
}

.bambu-popover-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.bambu-popover-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.bambu-popover-row label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #cbd5e1;
    margin: 0;
}

.bambu-popover-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.bambu-popover-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.bambu-popover-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bambu-popover-input-group label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
}

.bambu-popover-input {
    background: rgba(15, 15, 20, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #f8fafc;
    padding: 5px 8px;
    font-size: 0.82rem;
    font-family: var(--font-mono, monospace);
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    transition: border-color 0.15s;
}

.bambu-popover-input:focus {
    border-color: #10b981;
    outline: none;
}

.bambu-popover-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.bambu-popover-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.bambu-popover-btn.primary {
    background: #10b981;
    border-color: #059669;
    color: #ffffff;
    font-weight: 700;
}

.bambu-popover-btn.primary:hover {
    background: #059669;
}

.bambu-popover-btn.full {
    width: 100%;
}

.quality-preset-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    width: 100%;
    margin-bottom: 6px;
    box-sizing: border-box;
}

.quality-preset-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.quality-preset-btn.active {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    color: #34d399;
}

.quality-preset-title {
    font-size: 0.78rem;
    font-weight: 700;
}

.quality-preset-desc {
    font-size: 0.69rem;
    color: #94a3b8;
}
