html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

#root {
    width: 100%;
    height: 100%;
    display: flex;
}

.container {
    display: flex;
    width: 100%;
    height: 100%;
}

.canvas-container {
    flex: 1;
}

.sidebar {
    width: 300px;
    background: #f0f0f0;
    padding: 20px;
}
#modelSelect {
    position: fixed;
    display: none;
    z-index: 1000;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-height: 400px;
    overflow: hidden;
}
#modelSelect .menu-content {
    max-height: 300px !important;
    padding: 4px !important;
}

#modelSelect .menu-item {
    padding: 6px 8px !important;
    margin: 2px 0 !important;
}

.menu-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.menu-header {
    background: #1a2530;
    color: white;
    padding: 12px 16px;
    font-weight: 500;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.menu-title {
    font-size: 1.1em;
    font-weight: 600;
}

.back-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    font-size: 0.95em;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.back-arrow {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
}

.back-arrow::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(45deg);
    position: relative;
    left: 4px;
}

.menu-content {
    padding: 8px;
    overflow-y: auto;
    max-height: min(calc(100vh - 200px), 500px);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
    overscroll-behavior: contain;
}

.menu-content::-webkit-scrollbar {
    width: 6px;
}

.menu-content::-webkit-scrollbar-track {
    background: #f7fafc;
}

.menu-content::-webkit-scrollbar-thumb {
    background-color: #cbd5e0;
    border-radius: 3px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin: 4px 0;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: #1a2530;
    border: 1px solid transparent;
    user-select: none;
}

.menu-item:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
    transform: translateX(4px);
}

.menu-item:active {
    background: #f1f5f9;
    transform: translateX(4px) scale(0.98);
}

.menu-item.folder {
    background: #f8fafc;
    font-weight: 500;
}

.menu-item.folder:hover {
    background: #f1f5f9;
    border-color: #cbd5e0;
}

.menu-item.file {
    background: white;
    border: 1px solid #e2e8f0;
}

.menu-item.file:hover {
    border-color: #cbd5e0;
    background: #f8fafc;
}

.folder-icon,
.file-icon {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    opacity: 0.7;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.folder-icon::before {
    content: '';
    display: block;
    width: 16px;
    height: 12px;
    background: #4a5568;
    border-radius: 2px;
    position: relative;
}

.folder-icon::after {
    content: '';
    display: block;
    width: 8px;
    height: 2px;
    background: #4a5568;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 1px;
}

.custom-star-icon {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    opacity: 0.9;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #f59e0b;
}

.custom-star-icon::before {
    content: '⭐';
    font-size: 16px;
    display: block;
}

.file-icon::before {
    content: '';
    display: block;
    width: 12px;
    height: 15px;
    background: #4a5568;
    border-radius: 2px;
    position: relative;
}

.file-icon::after {
    content: '';
    display: block;
    width: 6px;
    height: 2px;
    background: white;
    position: absolute;
    top: 7px;
    left: 3px;
    box-shadow: 0 3px 0 white;
}

.file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile Responsiveness */
@media screen and (max-width: 768px) {
    #modelSelect {
        min-width: 90vw !important;
        max-width: 90vw !important;
        left: 5vw !important;
        right: 5vw !important;
        top: 20px !important;
    }

    .menu-content {
        max-height: 60vh !important;
    }

    .menu-item {
        padding: 12px 16px !important;
        margin: 4px 0 !important;
        font-size: 1rem;
        min-height: 48px; /* Better touch target size */
        display: flex;
        align-items: center;
    }

    .menu-header {
        padding: 16px 20px;
        font-size: 1.1rem;
    }

    .back-button {
        padding: 10px 16px;
        font-size: 1rem;
        min-height: 44px; /* Better touch target */
    }

    .folder-icon,
    .file-icon,
    .custom-star-icon {
        width: 24px;
        height: 24px;
        margin-right: 16px;
    }
}

@media screen and (max-width: 480px) {
    #modelSelect {
        min-width: 95vw !important;
        max-width: 95vw !important;
        left: 2.5vw !important;
        right: 2.5vw !important;
        top: 10px !important;
    }

    .menu-content {
        max-height: 50vh !important;
    }

    .menu-item {
        padding: 14px 18px !important;
        font-size: 0.95rem;
        min-height: 52px;
    }

    .menu-header {
        padding: 18px 22px;
        font-size: 1rem;
    }
}