/* Основной контейнер планировщика */
.planner-container {
    display: flex;
    width: 100%;
    height: 700px; /* Немного увеличили для лучшей вместимости */
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-sizing: border-box;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Боковая панель */
.sidebar {
    width: 340px;
    min-width: 340px;
    height: 100%;
    padding: 24px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #ffffff;
}

/* Стилизация скроллбара боковой панели */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: #ffffff;
}
.sidebar::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

/* Заголовки блоков */
.sidebar h3 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 16px 0;
    color: #0f172a;
    padding-bottom: 0;
    border: none;
}

/* Разделители */
hr {
    border: 0;
    border-top: 1px solid #edf2f7;
    margin: 20px 0;
}

/* Блок ввода размеров помещения */
.input-column {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-direction: column;
}
.input-column label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
}
.input-column input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
    color: #1e293b;
    background-color: #f8fafc;
    transition: all 0.2s ease;
}
.input-column input[type="number"]:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Общие стили для кнопок */
button {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    border: none;
}
button:active {
    transform: scale(0.98);
}

/* Кнопка обновления комнаты */
#apply-room-btn {
    background: #0f172a;
    color: #ffffff;
    margin-top: 4px;
}
#apply-room-btn:hover {
    background: #1e293b;
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.12);
}

/* Список добавления модулей */
.modules-list {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

/* Горизонтальный контейнер выбора модулей */
.module_select {
    display: flex;
    flex-direction: row;
    gap: 12px;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
}
.module_select::-webkit-scrollbar {
    height: 5px;
}
.module_select::-webkit-scrollbar-thumb {
    background-color: #e2e8f0;
    border-radius: 10px;
}

/* Карточка модуля */
.module-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 120px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.module-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}
.module-card img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 8px;
}
.module_info {
    width: 100%;
}
.module-card h4 {
    margin: 0 0 4px 0;
    font-size: 12px;
    color: #1e293b;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.module-card small {
    color: #64748b;
    font-size: 11px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

/* Панель управления выбранным модулем */
#selected-module-controls {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 15px;
}
#selected-module-controls h3 {
    color: #1e40af;
    margin-bottom: 8px;
}
#selected-name {
    font-size: 14px;
    font-weight: 600;
    color: #1d4ed8;
    margin: 0 0 16px 0;
    background: rgba(219, 234, 254, 0.7);
    padding: 6px 10px;
    border-radius: 6px;
}
#selected-module-controls label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    font-size: 13px;
    font-weight: 500;
    margin-top: 12px;
    color: #1e40af;
}

/* Ползунки range */
#selected-module-controls input[type="range"] {
    width: 100%;
    margin-top: 6px;
    accent-color: #3b82f6;
    cursor: pointer;
}

/* Сетки для выбора текстур/материалов */
.texture-selector {
    margin-top: 16px;
}
.texture-selector h4, 
.global-texture-selector h4 {
    font-size: 12px;
    color: #475569;
    margin: 0 0 8px 0;
    font-weight: 600;
}
.texture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    gap: 8px;
    margin-top: 6px;
}

/* Карточка текстуры */
.texture-card {
    aspect-ratio: 1;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f8fafc;
}
.texture-card:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
}
.texture-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Кнопки действий над модулем */
#rotate-mod-btn {
    width: 100%;
    background: #3b82f6;
    color: white;
    margin-top: 16px;
}
#rotate-mod-btn:hover {
    background: #2563eb;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}
#delete-mod-btn {
    width: 100%;
    background: #ef4444;
    color: white;
    margin-top: 8px;
    font-weight: 600;
}
#delete-mod-btn:hover {
    background: #dc2626;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.2);
}

/* Глобальные селекторы (Столешница, Фартук, Цоколь) */
.global-top-selector,
.global-texture-selector {
    margin-top: 20px !important;
    border-top: 1px solid #e2e8f0 !important;
    padding-top: 16px !important;
}

/* Общая кнопка экспорта в PDF */
#generate-pdf-btn {
    width: 100%;
    background: #333333 !important;
    color: #ffffff;
    padding: 14px;
    margin-bottom: 16px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}
#generate-pdf-btn:hover {
    background: #242424 !important;
    box-shadow: 0 6px 12px -1px rgba(16, 185, 129, 0.3);
}

/* Контейнер холста (сцены) */
#canvas-container {
    flex-grow: 1;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: #f1f5f9 !important; /* Светлая дизайнерская подложка вместо серой #e0e0e0 */
}

/* Размерные маркеры на сцене */
.size-labels-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    overflow: hidden;
}
.size-label {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    padding: 4px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Контейнер вкладок */
.module-tabs {
    display: flex;
    gap: 6px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 12px;
}
.tab-btn {
    flex: 1;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    color: #64748b;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.tab-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Управление видимостью вкладок */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* Обёртка слайдера со стрелками */
.slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

/* Модификация существующего класса module_select */
.module_select {
    display: flex;
    flex-direction: row;
    gap: 12px;
    width: 100%;
    overflow-x: hidden; /* Скрываем свободный скролл */
    scroll-behavior: smooth; /* Плавное перелистывание кодом */
    padding: 4px 0;
}

/* Стили стрелок */
.slider-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    font-size: 18px;
    line-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.slider-nav-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}
.slider-nav-btn.prev {
    left: -12px;
}
.slider-nav-btn.next {
    right: -12px;
}

/* Немного адаптируем карточку, чтобы в область видимости слайдера вставала ровно одна штука */
.module-card {
    width: 100% !important; /* Карточка занимает всю ширину видимого слайдера */
    box-sizing: border-box;
}