:root {
    --sidebar-width: 320px;
    --summary-height: 180px;
    --primary: #2c3e50;
    --accent: #3498db;
    --danger: #e74c3c;
    --success: #2ecc71;
    --bg: #ecf0f1;
    --card-bg: #ffffff;
    --border: #bdc3c7;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    display: flex;
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

#app {
    display: flex;
    width: 100%;
    height: 100%;
}

/* ===== Левая панель ===== */
#sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    z-index: 10;
}

#sidebar h2 {
    padding: 15px;
    background: var(--primary);
    color: white;
    font-size: 1.2rem;
    text-align: center;
    letter-spacing: 1px;
}

/* Категории */
#categories {
    display: flex;
    flex-wrap: wrap;
    padding: 10px;
    gap: 5px;
    border-bottom: 1px solid var(--border);
}

.category-btn {
    padding: 6px 10px;
    background: #f0f0f0;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.category-btn:hover {
    background: #e0e0e0;
}

.category-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Список товаров */
#product-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: grab;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    font-size: 0.9rem;
    touch-action: none;
}

.product-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.product-card:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.product-name {
    font-weight: 600;
    color: var(--primary);
}

.product-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #555;
    margin-top: 4px;
}

.product-price {
    font-weight: bold;
    color: var(--success);
}

.product-diameter {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.75rem;
}

/* ===== Правая часть: 3D и сводка ===== */
#viewport-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #e8edf2;
    overflow: hidden;
}

#viewport {
    flex: 1;
    cursor: crosshair;
}

#viewport canvas {
    display: block;
}

/* Панель сводки прилипает снизу */
#summary-panel {
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px 30px;
    align-items: center;
    backdrop-filter: blur(5px);
    border-top: 1px solid var(--border);
    z-index: 5;
    max-height: 150px;
    overflow-y: auto;
    flex-shrink: 0;
}

.summary-item {
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.summary-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #b0bec5;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: bold;
}

/* Кнопка оформления заказа */
#order-btn {
    margin-left: auto;
    padding: 10px 25px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

#order-btn:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

/* Уведомления */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--danger);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-weight: 500;
    opacity: 1;
    transition: opacity 0.3s;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}

#modal-body {
    margin-top: 10px;
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 220px;
        --summary-height: 220px;
    }
    #summary-panel {
        max-height: none;
    }
}

#trash-can {
    position: absolute;
    top: 15px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #e74c3c;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
#trash-can:hover {
    background: #e74c3c;
    color: white;
    transform: scale(1.1);
}
#trash-can.drag-over {
    background: #e74c3c;
    color: white;
    transform: scale(1.2);
}