:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --primary-light: #edf2ff;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    display: flex;
    height: 100vh;
    background: var(--background);
    color: var(--text-primary);
}

@font-face {
    font-family: 'Inter';
    src: url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
}

/* Боковая панель */
.sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    transition: all 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-left: 8px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.logo-text {
    font-size: 20px;
    font-weight: 600;
}

.menu-section {
    margin-bottom: 24px;
}

.menu-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding-left: 8px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
}

.menu-item:hover {
    background: var(--primary-light);
}

.menu-item.active {
    background: var(--primary);
    color: white;
}

.menu-item i {
    font-size: 18px;
    width: 24px;
    display: flex;
    justify-content: center;
}

.wall-thickness-control {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wall-thickness-control label {
    font-size: 14px;
    color: var(--text-secondary);
}

.wall-thickness-control input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center;
}

/* Основное содержимое */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Панель инструментов */
.toolbar {
    height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.toolbar-title {
    font-size: 18px;
    font-weight: 600;
    margin-right: auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--background);
}

.btn-outline.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-group {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 36px;
    padding: 0;
}

/* Рабочая область */
.canvas-container {
    flex: 1;
    padding: 24px;
    overflow: hidden;
    position: relative;
}

#drawing-canvas {
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    cursor: crosshair;
    display: block;
}

/* Состояния */
.zoom-controls {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 8px;
    border: 1px solid var(--border);
}

.zoom-display {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        width: 72px;
        padding: 16px 8px;
    }
    .logo-text, .menu-title, .menu-item span, .wall-thickness-control {
        display: none;
    }
    .menu-item {
        justify-content: center;
        padding: 12px 8px;
    }
}

/* * * * MODEL VIEWER * * * */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 900px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    position: relative;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close-modal:hover {
    color: #333;
}

.modal-actions {
    margin-top: 20px;
    text-align: right;
}

#model-container {
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}