/* ========================================================================= */
/* ===         05_RESPONSIVE.CSS - АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ           ===  */
/* ========================================================================= */
/* Этот файл содержит все стили, которые применяются только на               */
/* устройствах с шириной экрана 992px и меньше. Он переопределяет            */
/* десктопные стили для корректного отображения на мобильных.                */
/* ========================================================================= */

@media (max-width: 992px) {

    /* ================================================================= */
    /* ===     ЛОГИКА ДЛЯ ОСНОВНОГО ПРИЛОЖЕНИЯ (MAIN APP)            === */
    /* ================================================================= */

    /* --- ГЛОБАЛЬНЫЕ ИЗМЕНЕНИЯ --- */
    body.is-logged-in {
        overflow-y: auto; /* Разрешаем прокрутку для всей страницы */
    }
    body.is-logged-in.chat-is-active {
        overflow: hidden; /* Когда открыт чат, запрещаем прокрутку */
    }
    
    /* --- ОСНОВНАЯ СТРУКТУРА (LAYOUT) --- */
    .main-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        padding: 0 0.5rem;
        gap: 0;
    }
    body.chat-is-active .main-container {
        height: 100vh;
        padding: 0;
    }
    
    .panel {
        flex-basis: auto;
        width: 100%;
        max-height: none;
        overflow-y: visible;
        padding: 1rem;
        border: none;
    }

    /* --- ПАНЕЛИ И ИНТЕРФЕЙС --- */
    .controls-panel {
        order: 1;
        position: relative;
        z-index: 2;
    }
    .controls-panel .panel-logo,
    .controls-panel .logo-text {
        display: none;
    }

    .generation-space {
        order: 2;
        position: relative;
        z-index: 1;
        background-color: transparent;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        min-height: 0;
        padding: 0;
    }

    #results-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.5rem;
        padding-right: 0;
    }
    .result-card:hover {
        transform: none;
    }

    /* --- ВЫДВИЖНАЯ ПАНЕЛЬ РЕЖИМОВ (СЛЕВА) --- */
    .modes-panel {
        position: fixed;
        top: 0; 
        left: 0; 
        height: 100%;
        width: 280px;
        z-index: 1045;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 4px 0 15px rgba(0,0,0,0.4);
        overflow-y: auto;
        padding: 1.5rem;
    }
    .modes-panel.is-open {
        transform: translateX(0);
    }
    .modes-panel h5 {
        display: block;
        padding: 0.5rem 0;
    }
    #modes-menu {
        display: flex;
        flex-direction: column;
        padding-bottom: 0;
        gap: 0.5rem;
    }
    .mode-button {
        margin-bottom: 0;
        font-size: 1rem;
        padding: 1rem;
    }

    /* --- ЧАТ --- */
    #chat-participants-view {
        display: none !important; /* Полностью скрываем десктопный список участников */
    }

    #mobile-participants-counter {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        position: absolute;
        top: 1rem;
        right: 1rem;
        z-index: 10;
        background-color: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(5px);
        padding: 0.25rem 0.75rem;
        border-radius: 2rem;
        font-size: 0.8rem;
        color: var(--text-secondary);
        font-weight: 500;
    }
    #mobile-participants-counter strong {
        color: var(--text-primary);
    }

    #chat-send-form {
        padding-left: calc(0.75rem + env(safe-area-inset-left));
        padding-right: calc(0.75rem + env(safe-area-inset-right));
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }

    /* --- РАДИО-ПЛЕЕР (в выдвижном меню) --- */
    #radio-player-container {
        margin-top: 1rem;
        display: none;
    }
    .modes-panel.radio-active #radio-player-container {
        display: block;
    }
    #radio-player-container .player-track-info {
        padding: 0.5rem;
        border-top: none;
        background-color: var(--background-tertiary);
        border-radius: 0.5rem;
    }
    #radio-player-container .player-controls {
        padding: 0.5rem 1rem 0 1rem;
        justify-content: space-between;
    }
    #radio-player-container .volume-control-container {
        display: flex;
    }
    #radio-player-container .volume-slider {
        width: 70px;
        opacity: 1;
    }
    
    /* --- ПРОЧЕЕ --- */
    .gallery-nav-btn { 
        display: none; /* Прячем стрелки в галерее, т.к. на мобильных будет свайп */
    }

    #profile-view .history-header {
        margin-top: 1.5rem;
    }
    
} /* Конец главного медиа-запроса @media (max-width: 992px) */