* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0066cc;
    --success-color: #28a745;
    --error-color: #dc3545;
    --bg-light-gray: #f0f0f0;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-light: #ffffff;
    --border-color: #dee2e6;
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --radius-md: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-light-gray);
    overflow: hidden;
    height: 100vh;
}

.app-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    position: relative;
}

.container-breadcrumb {
    position: absolute;
    top: 20px;
    left: 320px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 16px 8px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 48px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 200;
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: calc(100vw - 350px);
    width: fit-content;
}

.container-breadcrumb.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.object-breadcrumb {
    position: absolute;
    top: 20px;
    left: 320px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    height: 48px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 199;
    transition: all 0.3s ease;
    max-width: calc(100vw - 350px);
    width: fit-content;
}

.object-breadcrumb.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

/* When container breadcrumb is visible, position object breadcrumb next to it */
.container-breadcrumb:not(.hidden) ~ .object-breadcrumb:not(.hidden) {
    left: calc(320px + var(--container-width, 200px) + 12px);
}

.object-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.back-button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: #f0f0f0;
    color: var(--primary-color);
}

.container-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.object-sidebar {
    width: 300px;
    background: #f9f9f9;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 100;
}

.object-sidebar.hidden {
    transform: translateX(-100%);
    position: absolute;
    height: 100%;
}

.sidebar-header {
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.search-wrapper {
    width: 100%;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
    transform: translateY(-1px);
}

.search-input::placeholder {
    color: #999;
    font-weight: 400;
}

.search-input:hover:not(:focus) {
    border-color: #bbb;
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.clear-search-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.clear-search-btn.visible {
    display: flex;
}

.search-wrapper.has-text .search-input {
    padding-right: 40px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px 10px;
}

.object-tree {
    padding: 0;
}

/* Tree styles - optimized for readability */
.tree-view {
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.3;
}

.tree-item {
    padding: 3px 8px;
    cursor: pointer;
    transition: background-color 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #212529;
    display: flex;
    align-items: center;
    user-select: none;
    font-weight: 400;
    letter-spacing: 0.01em;
    min-height: 26px;
}

.tree-item:hover {
    background: #e3f2fd;
}

.tree-item.highlighted {
    background: #e3f2fd;
    font-weight: 500;
}

.tree-item.selected {
    background: #fff3cd;
    font-weight: 500;
    border-left: 3px solid #ffc107;
}

.tree-item.selected .tree-label {
    font-weight: 500;
    color: #856404;
}

.tree-expand-icon {
    display: inline-block;
    width: 20px;
    color: #6c757d;
    margin-right: 6px;
    cursor: pointer;
    flex-shrink: 0;
    text-align: center;
    transition: transform 0.2s ease;
    font-size: 18px;
}

.tree-expand-icon:hover {
    color: #333;
}

.tree-bullet {
    display: inline-block;
    width: 20px;
    color: #6c757d;
    margin-right: 6px;
    flex-shrink: 0;
    text-align: center;
    font-size: 18px;
}

.tree-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-item.has-children:not(.selected):not(.highlighted):hover {
    background: #f5f5f5;
}

.tree-children {
    margin-left: 0;
}

#vu3d-container {
    flex: 1;
    position: relative;
}

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

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

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

.loading-content {
    width: 90%;
    max-width: 400px;
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

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

.loading-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1f2937;
}

.progress-container {
    background: #f3f4f6;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #0080ff);
    border-radius: 999px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.loading-status {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #6b7280;
}

.loading-status span:last-child {
    font-weight: 600;
}

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 250px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    background: var(--success-color);
}

.toast.info {
    background: var(--primary-color);
}

.toast.error {
    background: var(--error-color);
}

.debug-controls {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 999;
}

.debug-btn {
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.2s ease;
    backdrop-filter: blur(10px);
}

.debug-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
}

.container-hint {
    position: fixed;
    bottom: 20px;
    left: calc(300px + (100vw - 300px) / 2);
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 300;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.container-hint.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
}