/* Google Filament 3D Experience - Modern Studio Theme */

:root {
    --bg-base: #0c0e14;
    --bg-surface: rgba(22, 26, 35, 0.75);
    --bg-surface-hover: rgba(30, 36, 48, 0.85);
    --bg-surface-solid: #161a23;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-focus: rgba(80, 150, 255, 0.4);
    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.35);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-glass: 0 12px 36px 0 rgba(0, 0, 0, 0.4);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
}

/* Main App Container */
#app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Viewport Area */
#viewport-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#viewport-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

/* Top Navigation Bar */
#app-header {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px 18px;
    box-shadow: var(--shadow-glass);
}

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

.brand-icon {
    font-size: 20px;
    background: linear-gradient(135deg, #60a5fa, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text h1 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}

.brand-badge {
    font-size: 10px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.header-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}

.stat-pill {
    background: rgba(0, 0, 0, 0.25);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Floating Toolbar */
#app-toolbar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 40px;
    padding: 6px 10px;
    box-shadow: var(--shadow-glass);
}

.tool-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.tool-btn.active {
    background: var(--accent-primary);
    color: #ffffff;
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Viewport Navigation Helper */
#nav-hints {
    position: absolute;
    bottom: 24px;
    left: 20px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 16px;
    pointer-events: none;
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.hint-key {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 10px;
}

/* Floating Sidebar Panel */
#app-sidebar {
    position: absolute;
    top: 16px;
    right: 16px;
    bottom: 16px;
    width: 380px;
    z-index: 10;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#app-sidebar.collapsed {
    transform: translateX(calc(100% + 20px));
}

#sidebar-toggle {
    position: absolute;
    left: -44px;
    top: 16px;
    width: 36px;
    height: 36px;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: var(--shadow-glass);
}

/* Sidebar Tab Navigation */
.tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: 8px 12px 0 12px;
    gap: 4px;
    background: rgba(0, 0, 0, 0.15);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 10px 4px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    text-align: center;
}

.tab-btn:hover {
    color: var(--text-secondary);
}

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

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 2px;
}

/* Tab Panels Content */
.tabs-content {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tabs-content::-webkit-scrollbar {
    width: 6px;
}
.tabs-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.tab-panel {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.tab-panel.active {
    display: flex;
}

/* UI Form Controls & Groups */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-value {
    font-family: var(--font-mono);
    color: var(--accent-primary);
    font-weight: 600;
}

select, input[type="text"], input[type="number"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 9px 12px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

select:focus, input[type="text"]:focus {
    border-color: var(--border-color-focus);
}

/* Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

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

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

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    box-shadow: 0 0 16px var(--accent-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.input-row {
    display: flex;
    gap: 8px;
}

.input-row input {
    flex: 1;
}

/* Checkbox and Pickers */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.color-row input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 36px;
    height: 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
}

/* Card / Box Info */
.info-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-card-header {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.info-row-label {
    color: var(--text-muted);
}

.info-row-val {
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* Loading Overlay */
#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(12, 14, 20, 0.85);
    backdrop-filter: blur(12px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.loading-bar-track {
    width: 220px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

#loading-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #a855f7);
    transition: width 0.2s ease;
}

/* Drag & Drop Visual Overlay */
#drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(59, 130, 246, 0.2);
    backdrop-filter: blur(8px);
    border: 3px dashed var(--accent-primary);
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s ease;
}

#drop-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.drop-icon {
    font-size: 48px;
}

.drop-title {
    font-size: 18px;
    font-weight: 700;
}

/* Toast Notifications */
#toast-container {
    position: absolute;
    top: 20px;
    right: 420px;
    z-index: 110;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-glass);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    transform: translateY(-15px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--error); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--accent-primary); }

/* Responsive adjustments */
@media (max-width: 900px) {
    #app-sidebar {
        width: calc(100vw - 32px);
        left: 16px;
        right: 16px;
        top: auto;
        bottom: 16px;
        height: 380px;
    }
    #app-sidebar.collapsed {
        transform: translateY(calc(100% + 20px));
    }
    #sidebar-toggle {
        left: auto;
        right: 16px;
        top: -44px;
    }
    #toast-container {
        right: 20px;
    }
    #nav-hints {
        display: none;
    }
}

