/* ==========================================================================
   SPATIAL SETUP - Premium CSS Style Sheet
   Glassmorphic & Cyber-Minimalist Theme
   ========================================================================== */

:root {
    --bg-main: #0a0b0e;
    --bg-panel: rgba(18, 20, 26, 0.72);
    --bg-panel-solid: #12141a;
    --border-light: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 240, 255, 0.25);
    
    --text-primary: #f0f3f8;
    --text-secondary: #9aa2b1;
    --text-muted: #626c7e;
    
    --accent: #00f0ff;
    --accent-glow: rgba(0, 240, 255, 0.4);
    --accent-magenta: #ff007f;
    --accent-purple: #9d4edd;
    
    --success: #00e676;
    --danger: #ff1744;
    --warning: #ffc107;
    
    --sidebar-width: 360px;
    --inspector-width: 360px;
    --header-height: 70px;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-drag: none;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 240, 255, 0.3);
}

/* APP CONTAINERS */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* TOP HEADER */
.app-header {
    height: var(--header-height);
    background-color: rgba(10, 11, 14, 0.85);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 10;
    backdrop-filter: blur(12px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 24px;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
    animation: pulseGlow 3s infinite alternate;
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #fff;
    background: linear-gradient(45deg, #fff 40%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.view-selector {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-light);
    padding: 3px;
    border-radius: 30px;
}

.view-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 20px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-btn:hover {
    color: #fff;
}

.view-btn.active {
    background: linear-gradient(135deg, var(--accent) 0%, rgba(0, 180, 255, 0.8) 100%);
    color: #050608;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
    font-weight: 700;
}

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

.header-separator {
    width: 1px;
    height: 20px;
    background-color: var(--border-light);
    margin: 0 4px;
}

/* APP MAIN LAYOUT */
.app-main {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* SIDEBAR & INSPECTOR PANELS */
.sidebar-panel,
.inspector-panel {
    width: var(--sidebar-width);
    height: 100%;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    z-index: 5;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.inspector-panel {
    border-right: none;
    border-left: 1px solid var(--border-light);
}

/* TAB HEADER */
.tab-header {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 16px 0;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.01);
}

.tab-btn.active {
    color: var(--accent);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 15%;
    width: 70%;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

/* TAB CONTENT & PANES */
.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* SETTINGS SECTIONS & GROUPS */
.settings-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.settings-section:last-of-type {
    border-bottom: none;
}

.settings-section h3 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* INPUT SLIDER GROUPS */
.input-slider-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.input-slider-group input[type="range"] {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.input-slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    cursor: pointer;
    transition: transform 0.1s;
}

.input-slider-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.input-slider-group input[type="number"] {
    width: 60px;
    height: 32px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: #fff;
    text-align: center;
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
}

.input-slider-group input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 5px rgba(0, 240, 255, 0.2);
}

.input-slider-group .unit {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    width: 20px;
}

/* COLOR PICKER WRAPPERS */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    padding: 6px 12px;
    border-radius: 8px;
}

.color-picker-wrapper input[type="color"] {
    border: none;
    background: none;
    width: 28px;
    height: 28px;
    cursor: pointer;
    outline: none;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.color-val {
    font-family: monospace;
    color: var(--text-primary);
    font-size: 13px;
}

/* BUTTONS & TOGGLES */
select {
    height: 38px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: #fff;
    padding: 0 12px;
    outline: none;
    font-family: var(--font-body);
    cursor: pointer;
}

select option {
    background-color: var(--bg-panel-solid);
    color: #fff;
}

.btn-toggle-group {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 2px;
}

.toggle-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 0;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn:hover {
    color: #fff;
}

.toggle-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent);
    box-shadow: inset 0 0 1px rgba(255,255,255,0.1);
}

.action-btn {
    border: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
}

.header-btn {
    padding: 8px 16px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.danger-btn {
    border: 1px solid rgba(255, 23, 68, 0.2);
    background: rgba(255, 23, 68, 0.05);
    color: #ff5252;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.danger-btn:hover {
    background: rgba(255, 23, 68, 0.15);
    border-color: #ff1744;
}

/* CATALOG VIEW */
.catalog-filters {
    display: flex;
    gap: 6px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.cat-filter {
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.cat-filter:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.cat-filter.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 700;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    overflow-y: auto;
    padding-top: 12px;
}

.catalog-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.catalog-item:hover {
    background: rgba(0, 240, 255, 0.02);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.05);
}

.catalog-item:active {
    cursor: grabbing;
}

.catalog-item-icon {
    font-size: 20px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.3s;
}

.catalog-item:hover .catalog-item-icon {
    color: var(--accent);
    background: rgba(0, 240, 255, 0.08);
}

.catalog-item-name {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
}

.catalog-item-dims {
    font-size: 10px;
    color: var(--text-muted);
}

/* PRESETS GRID */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.preset-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s;
}

.preset-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-purple);
    box-shadow: 0 4px 12px rgba(157, 78, 221, 0.15);
}

.preset-card i {
    font-size: 20px;
    color: var(--accent-purple);
}

.preset-card h4 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
}

/* PLACED ITEMS LIST */
.placed-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.placed-list-header span {
    font-size: 12px;
    color: var(--text-secondary);
}

.placed-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-top: 8px;
}

.placed-item-row {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.placed-item-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.placed-item-row.selected {
    border-color: var(--accent);
    background: rgba(0, 240, 255, 0.03);
}

.placed-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.placed-item-info i {
    color: var(--text-secondary);
    font-size: 14px;
}

.placed-item-row.selected .placed-item-info i {
    color: var(--accent);
}

.placed-item-name-text {
    font-size: 12px;
    font-weight: 500;
}

.placed-item-dims-text {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.placed-item-delete-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.placed-item-delete-btn:hover {
    color: var(--danger);
    background: rgba(255, 23, 68, 0.08);
}

.empty-list-msg {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: 24px 0;
}

/* VIEWPORT CONTAINER (CENTER PANEL) */
.viewport-panel {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: #0b0c10;
}

.canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.viewport-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.viewport-container.active {
    opacity: 1;
    pointer-events: auto;
}

/* 2D Grid Canvas */
#canvas-2d {
    width: 100%;
    height: 100%;
    display: block;
    background-color: #0e1017;
}

/* 3D WebGL Canvas Target */
#canvas-3d-target {
    width: 100%;
    height: 100%;
}

.canvas-instructions {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 11, 14, 0.85);
    border: 1px solid var(--border-light);
    border-radius: 30px;
    padding: 8px 20px;
    color: var(--text-secondary);
    font-size: 11px;
    pointer-events: none;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* FLOATING TOOLBAR */
.floating-toolbar {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    background: rgba(18, 20, 26, 0.8);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 6px;
    gap: 4px;
    z-index: 8;
    backdrop-filter: blur(16px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.5), 0 0 1px rgba(255,255,255,0.1);
}

.tool-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 68px;
    transition: all 0.2s;
}

.tool-btn i {
    font-size: 16px;
}

.tool-btn span {
    font-size: 10px;
    font-weight: 500;
}

.tool-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
}

.tool-btn.danger-hover:hover {
    color: var(--danger);
    background: rgba(255, 23, 68, 0.08);
}

.tool-btn.accent-btn {
    background: linear-gradient(135deg, var(--accent) 0%, rgba(0, 180, 255, 0.8) 100%);
    color: #000;
}

.tool-btn.accent-btn span {
    font-weight: 700;
}

.tool-btn.accent-btn:hover {
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
    transform: scale(1.02);
}

.tool-separator {
    width: 1px;
    background: var(--border-light);
    margin: 4px 6px;
}

/* INSPECTOR PANEL (RIGHT PANEL) */
.inspector-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.02);
}

.inspector-header h2 {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.inspector-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.inspector-content.empty {
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
}

.select-arrow-icon {
    font-size: 28px;
    margin-bottom: 16px;
    color: rgba(255, 255, 255, 0.15);
    animation: bounceLeft 2s infinite;
}

.selected-item-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    padding: 16px;
    border-radius: 12px;
}

.summary-icon {
    font-size: 22px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.selected-item-summary h4 {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.badge {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

.property-group-set {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.property-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.property-section h3 {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.control-group-small {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group-small label {
    font-size: 11px;
    color: var(--text-secondary);
}

.control-group-small input {
    height: 34px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: #fff;
    padding: 0 10px;
    outline: none;
    font-size: 13px;
    font-family: var(--font-body);
}

.control-group-small input:focus {
    border-color: var(--accent);
}

.help-text {
    font-size: 10px;
    color: var(--text-muted);
}

/* RGB TOGGLE ROW */
.rgb-toggle-row {
    display: flex;
    gap: 10px;
}

.rgb-toggle-row input[type="color"] {
    width: 38px;
    height: 38px;
    border: none;
    outline: none;
    background: none;
    cursor: pointer;
}

.rgb-toggle-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.rgb-toggle-row input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border-light);
    border-radius: 6px;
}

/* ERGONOMIC WARNINGS PANEL */
.ergo-feedback-panel {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 16px;
    margin-top: 10px;
}

.ergo-feedback-panel h4 {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.ergo-feedback-panel ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ergo-feedback-panel li {
    font-size: 11px;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.ergo-feedback-panel li i {
    font-size: 12px;
    margin-top: 2px;
}

.ergo-feedback-panel li.success {
    color: var(--success);
}

.ergo-feedback-panel li.warning {
    color: var(--warning);
}

.ergo-feedback-panel li.danger {
    color: var(--danger);
}

/* ANIMATIONS */
@keyframes pulseGlow {
    0% {
        text-shadow: 0 0 5px rgba(0, 240, 255, 0.2);
    }
    100% {
        text-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
    }
}

@keyframes bounceLeft {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(0);
    }
    40% {
        transform: translateX(-6px);
    }
    60% {
        transform: translateX(-3px);
    }
}
