/* ============================================
   Standalone 3D Viewer Styles (Ultra Premium Glass)
   ============================================ */

/* --- Workspace Background --- */
.viewer-workspace {
    height: 100vh;
    width: 100vw;
    padding-top: 80px; 
    overflow: hidden;
    position: relative;
    background: transparent; 
}

/* Ultra-faint grid so it doesn't fight the glowing orbs */
.cad-grid-bg {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 1;
    pointer-events: none;
}

#canvas-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

#canvas-wrapper canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    outline: none;
}

/* ============================================
   Premium Upload Interface
   ============================================ */
.upload-ui {
    position: absolute;
    width: 80%;
    max-width: 700px;
    height: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    
    /* True frosted glass dropzone */
    background: rgba(10, 11, 16, 0.4); 
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1); /* Light catch */
    border-radius: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-ui:hover, .upload-ui.dragover {
    border-color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.03);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(34, 211, 238, 0.1);
    transform: scale(1.02);
}

.upload-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-icon-pulse {
    font-size: 4rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
    from { filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.1)); }
    to { filter: drop-shadow(0 0 25px rgba(168, 85, 247, 0.4)); }
}

.upload-content h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    margin: 0;
}

.upload-content p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 15px;
}

.badge {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--accent-cyan);
    margin-top: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ============================================
   Floating Panels & Glass Toolbars
   ============================================ */
.floating-panel {
    position: absolute;
    z-index: 50;
    padding: 10px;
    
    /* Sleek, high-end glass panel */
    background: rgba(14, 16, 22, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-top: 1px solid rgba(255, 255, 255, 0.08); /* Simulates top edge lighting */
    border-radius: 18px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* Shared Tool Group Styling */
.tool-group { display: flex; flex-direction: column; gap: 4px; }
.tool-label { 
    font-size: 0.6rem; 
    text-transform: uppercase; 
    color: var(--text-muted); 
    letter-spacing: 1.5px; 
    text-align: center; 
    margin-bottom: 6px; 
    font-weight: 600;
}

/* Clean, Minimalist Button Icons */
.floating-panel .btn-icon { 
    width: 38px; 
    height: 38px; 
    border-radius: 12px; 
    background: transparent; 
    color: rgba(255, 255, 255, 0.5); /* Muted by default */
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
}

.floating-panel .btn-icon:hover { 
    color: #fff; 
    background: rgba(255, 255, 255, 0.06); 
    transform: translateY(-2px);
}

/* Glowing active state instead of heavy background */
.floating-panel .btn-icon.active { 
    color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.08);
    box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.2);
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
}

/* Danger Button (Trash) */
.floating-panel .btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Dividers */
.divider { 
    width: 1px; 
    background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.05), transparent); 
    margin: 0 8px; 
}
.divider-horizontal {
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.05), transparent);
    margin: 10px 0;
}

/* --- Specific Panel Positions --- */

/* Left Panel: Inspection */
.left-panel {
    top: 24px;
    left: 24px;
    display: flex;
    flex-direction: column;
}

/* Top Panel: Transform Tools */
.top-panel {
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    border-radius: 999px; /* Pill shape */
    padding: 8px;
}
.top-panel .btn-icon { border-radius: 50%; } 
.btn-sm { 
    padding: 8px 16px; 
    font-size: 0.85rem; 
    margin-left: 8px; 
    border-radius: 999px; 
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    color: #fff;
    cursor: pointer;
    transition: 0.3s ease;
}
.btn-sm:hover {
    background: rgba(255,255,255,0.08);
    transform: translateY(-2px);
}

/* Bottom Panel: Camera */
.bottom-panel {
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    border-radius: 999px;
    padding: 8px;
}
.bottom-panel .btn-icon { border-radius: 50%; }

/* ============================================
   Right Panel: Stats & Sliders
   ============================================ */
.right-panel {
    top: 24px;
    right: 24px;
    width: 280px;
    display: flex;
    flex-direction: column;
}

.panel-section { 
    border-bottom: 1px solid rgba(255,255,255,0.05); 
    padding: 16px 8px; 
}
.panel-section.no-border { border-bottom: none; }
.panel-section h4 { 
    font-size: 0.85rem; 
    color: var(--text-primary); 
    margin-bottom: 15px; 
    font-weight: 600;
    letter-spacing: 0.5px;
}
.section-header-flex { display: flex; justify-content: space-between; align-items: center; }

.stat-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 10px; 
}
.stat-label { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px;}
.stat-value { 
    color: #fff; 
    font-family: 'Space Grotesk', sans-serif; 
    font-size: 1.05rem;
    font-weight: 500;
}
.text-cyan { color: var(--accent-cyan); text-shadow: 0 0 10px rgba(34, 211, 238, 0.3); }

/* Custom Z-Clipper Range Slider */
.custom-range { 
    width: 100%; 
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    margin: 10px 0;
}
.custom-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
}
.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--accent-cyan);
    margin-top: -6px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.6);
    transition: transform 0.1s;
}
.custom-range::-webkit-slider-thumb:hover { transform: scale(1.3); }

/* ============================================
   Precise Transform Popup
   ============================================ */
.transform-popup {
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    padding: 16px;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 0.8rem;
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.axis-inputs {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.axis-badge {
    font-size: 0.65rem;
    font-weight: bold;
    text-align: center;
    padding: 3px 0;
    border-radius: 4px;
    color: #fff;
    width: 100%;
    letter-spacing: 1px;
}
.bg-red { background: rgba(239, 68, 68, 0.7); }
.bg-green { background: rgba(34, 197, 94, 0.7); }
.bg-blue { background: rgba(59, 130, 246, 0.7); }

.custom-input.sm {
    padding: 8px 4px;
    font-size: 0.9rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    transition: all 0.2s ease;
}
.custom-input.sm:focus {
    border-color: var(--accent-cyan);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.3);
    outline: none;
}

.btn-lock {
    width: 36px; 
    height: 36px;
    margin-bottom: 1px;
}

/* ============================================
   Action Panel (Bottom Right)
   ============================================ */
.bottom-right-panel {
    bottom: 30px;
    right: 30px;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    padding: 0;
}

.btn-glow-large {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    padding: 16px 32px;
    border-radius: 12px;
    background: var(--accent-gradient);
    color: #000;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(34, 211, 238, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-glow-large:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(34, 211, 238, 0.4);
}

.hidden { display: none !important; }

/* ============================================
   Toast Notifications & Alerts
   ============================================ */
.toast-container {
    position: fixed;
    top: 100px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: rgba(14, 16, 22, 0.85);
    border-left: 4px solid var(--accent-cyan);
    border-radius: 8px;
    padding: 16px 20px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.error {
    border-left-color: #ef4444;
}
.toast.error i { color: #ef4444; }
.toast.success {
    border-left-color: #22c55e;
}
.toast.success i { color: #22c55e; }

/* Red error glow for colliding parts */
.mesh-error {
    /* Handled via Three.js Emissive color, but we can hook into CSS for UI if needed */
}