/* КРИТИЧЕСКИЕ СТИЛИ ДЛЯ ИСПРАВЛЕНИЯ БЛОКА ТЕКУЩЕГО ЗАКАЗА */

/* Принудительное растягивание на всю высоту */
#currentOrderSection {
    grid-column: 1 / 3 !important;
    grid-row: 2 !important;
    width: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    flex: 1 !important;
}

/* Убеждаемся что родительский grid правильно настроен */
.bento-grid {
    height: calc(100vh - 80px) !important;
    min-height: calc(100vh - 80px) !important;
    max-height: calc(100vh - 80px) !important;
    display: grid !important;
    grid-template-rows: 280px 1fr !important;
    position: relative !important;
}

/* Принудительно фиксируем grid-template-rows независимо от состояния блоков */
.bento-grid,
.bento-grid.has-collapsed {
    grid-template-rows: 280px 1fr !important;
}

/* Сохраняем высоту верхнего ряда при сворачивании только одного блока */
.bento-grid:has(.left-top.collapsed):not(:has(.right-top.collapsed)),
.bento-grid:has(.right-top.collapsed):not(:has(.left-top.collapsed)),
.bento-grid:has(#fileManagementSection.collapsed):not(:has(#chatSection.collapsed)),
.bento-grid:has(#chatSection.collapsed):not(:has(#fileManagementSection.collapsed)) {
    grid-template-rows: 280px 1fr !important;
}

/* Фиксируем высоту верхних блоков независимо от состояния */
.bento-item.left-top,
.bento-item.right-top,
#fileManagementSection,
#chatSection {
    height: 280px !important;
    min-height: 280px !important;
    max-height: 280px !important;
}

/* Свернутые блоки имеют фиксированную высоту */
.bento-item.collapsed,
#fileManagementSection.collapsed,
#chatSection.collapsed {
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
}

/* Контент блока заказа */
#currentOrderContent {
    flex: 1 !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Заголовок не должен сжиматься */
#currentOrderSection .section-header {
    flex-shrink: 0 !important;
    margin-bottom: 4px !important;
    padding-bottom: 4px !important;
}

#currentOrderSection .section-header h2 {
    margin-left: 7px !important;
}

/* Пустое состояние должно заполнять всю доступную высоту */
#currentOrderSection .empty-state {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    height: 100% !important;
    min-height: 200px !important;
}

/* Дополнительные стили для содержимого заказа */
.current-order-info {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.order-items-container {
    flex: 1 !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

.order-items {
    flex: 1 !important;
    overflow-y: auto !important;
    min-height: 0 !important;
}

/* Убираем конфликтующие стили */
#currentOrderSection.bento-item {
    min-height: 0 !important;
    height: 100% !important;
}

/* Специальные стили для разрешения 1920x1080 */
@media (min-width: 1900px) and (min-height: 1000px) {
    .bento-grid {
        height: calc(100vh - 80px) !important;
        grid-template-rows: 280px 1fr !important;
    }
    
    #currentOrderSection {
        height: 100% !important;
        min-height: calc(100vh - 380px) !important;
    }
}
