/* НеЧат — Мобильная адаптация */

/* Основной layout */
@media (max-width: 768px) {
    body {
        overflow: hidden;
    }
    
    /* Чат занимает всю ширину */
    .body {
        gap: 0;
    }
    
    .main {
        width: 100%;
        flex: 1;
        gap: 0;
    }
    
    .conductor {
        flex: 1 !important;
        width: 100% !important;
        margin: 0 !important;
        border-radius: 12px !important;
        max-width: 100%;
    }
    
    .right-col {
        display: none;
    }
    
    .side-panel.open .right-col {
        display: flex !important;
    }
    
    /* Скрываем тулбар */
    .sidebar {
        position: fixed;
        left: -56px;
        top: calc(var(--header-height) + var(--gap) * 2);
        bottom: 8px;
        width: 56px !important;
        min-width: 56px !important;
        z-index: 1502;
        transition: left 0.3s ease;
        border-radius: var(--radius);
        background: var(--bg);
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 8px 4px;
        border-radius: 0;
    }
    
    .sidebar.open {
        left: 0;
        width: 56px !important;
    }
    
    .mobile-arrow:hover {
        background: rgba(137, 180, 250, 0.25);
        border-color: rgba(137, 180, 250, 0.4);
    }

    .mobile-arrow-left {
        position: absolute;
        left: 100%;
        top: 30%;
        z-index: 1501;
        border-radius: 0 12px 12px 0;
        clip-path: polygon(0 0, 100% 10%, 100% 90%, 0 100%);
    }
    
    /* Окно контента — справа от тулбара */
    .side-panel {
        position: fixed !important;
        left: 56px !important;
        right: 0 !important;
        top: calc(var(--header-height) + var(--gap) * 2) !important;
        bottom: 8px !important;
        width: auto !important;
        z-index: 1499 !important;
        border-radius: var(--radius);
        background: var(--bg) !important;
        border-radius: 0 !important;
        display: none !important;
    }
    
    .side-panel.open {
        display: block !important;
    }
    
    
    /* Планировщик и терминал скрыты, показываются в панели */
    .planner,
    .terminal {
        display: none !important;
    }
    
    .side-panel.open .planner,
    .side-panel.open .terminal {
        display: flex !important;
    }
    
    /* Стрелки-кнопки */
    .mobile-arrow {
        top: 30%;
        transform: translateY(-50%);
        z-index: 1501;
        width: 24px;
        height: 80px;
        background: rgba(137, 180, 250, 0.1);
        border: 1px solid rgba(137, 180, 250, 0.1);
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        color: #89b4fa;
        transition: all 0.2s;
    }
    
    
    .mobile-arrow-right {
        position: absolute;
        left: -24px;
        top: 30%;
        border-radius: 12px 0 0 12px;
        clip-path: polygon(0 10%, 100% 0, 100% 100%, 0 90%);
    }
    
    /* Мобильная панель для планировщика и терминала */
    .mobile-right-panel {
        position: fixed !important;
        right: -320px !important;
        left: auto !important;
        top: calc(var(--header-height) + var(--gap) * 2) !important;
        bottom: 8px !important;
        width: 320px !important;
        z-index: 2000 !important;
        transition: right 0.3s ease !important;
        border-radius: var(--radius);
        background: var(--bg) !important;
        border-radius: 0 !important;
        display: block !important;
    }
    
    .mobile-right-panel.open {
        right: 0 !important;
    }
    
    .mobile-right-content {
        height: 100%;
        overflow: hidden;
    }
    
    .mobile-right-content .planner,
    .mobile-right-content .terminal {
        display: flex !important;
        flex: 1 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .mobile-right-content .planner {
        min-height: 50% !important;
    }
    
    .mobile-right-content .terminal {
        min-height: 40% !important;
    }
    
    /* Шестерёнки на мобильных */
    .gears-indicator {
        font-size: 14px;
        gap: 8px;
        padding: 4px 0;
    }
}

/* Стрелки скрыты по умолчанию (показываются на мобильных) */
.mobile-arrow {
    display: none;
}

@media (max-width: 768px) {
    .mobile-arrow {
        display: flex;
    }
}

/* Для отладки на десктопе */

.mobile-arrow {
    display: flex;
}

/* Для отладки на десктопе */
.mobile-right-panel {
    position: fixed !important;
    right: -320px !important;
    left: auto !important;
    top: calc(var(--header-height) + var(--gap) * 2) !important;
    bottom: 8px !important;
    width: 320px !important;
    z-index: 2000 !important;
    transition: right 0.3s ease !important;
    border-radius: var(--radius);
    background: var(--bg) !important;
    border-radius: 0 !important;
    display: block !important;
}

.mobile-right-panel.open {
    right: 0 !important;
}

.mobile-right-content {
    height: 100%;
    overflow: hidden;
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .side-panel {
        width: 280px;
        right: -280px;
    }
    
    .message-bubble {
        max-width: 90%;
        font-size: 13px;
    }
}
