/* ========================================================================= */
/* ===                      01_LAYOUT.CSS - FIXED (PHOTOSHOOT)           === */
/* ========================================================================= */

/* 1. ГЛОБАЛЬНЫЕ НАСТРОЙКИ */
* {
    box-sizing: border-box;
}

body, html {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000;
}

/* 2. ГЛАВНЫЙ КОНТЕЙНЕР */
.main-container {
    display: flex;
    flex-direction: row;
    height: 100vh;       
    max-height: 100vh;   
    width: 100vw;
    overflow: hidden;    
    padding: 6px;
    gap: 12px;
    position: absolute;
    top: 0;
    left: 0;
}

.app-logo-text {
    flex-shrink: 0;
    text-align: center;
    margin-bottom: 15px;
    font-family: 'Bowler', sans-serif;
    color: var(--primary);
    font-size: 14px;
    letter-spacing: 1px;
}

/* 3. ОБЩИЕ СТИЛИ ПАНЕЛЕЙ */
.panel {
    background-color: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    padding: 16px;
    height: 100%; 
    overflow: hidden;
}

/* 4. ЛЕВАЯ И ПРАВАЯ ПАНЕЛИ */
.controls-panel, 
.modes-panel {
    flex: 0 0 350px;
    width: 350px;
    min-width: 350px;
    height: 100%;
    z-index: 20;
    transition: width 0.3s ease, min-width 0.3s ease, flex-basis 0.3s ease;
}

/* 5. ЦЕНТРАЛЬНАЯ ЧАСТЬ */
.generation-space {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 0;
}

/* ==================================================================== */
/* === ЛЕВАЯ ПАНЕЛЬ: ФИКСАЦИЯ КНОПКИ И СКРЫТИЕ СКРОЛЛА             === */
/* ==================================================================== */

/* Контейнер внутри левой панели */
#controls-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#control-form, 
#music-mode-container, 
#music-cover-container, 
#video-mode-container,
#photoshoot-mode-container
{
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ЗАГОЛОВОК РЕЖИМА */
.mode-header {
    flex-shrink: 0;
    margin-bottom: 15px;
}

/* СКРОЛЛИРУЕМАЯ ОБЛАСТЬ (Инпуты, настройки) */
.form-content-wrapper,
#music-mode-container .tab-content, 
#video-mode-container .form-content-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 0 !important; 
    margin: 0 !important;
    width: 100%;
    margin-bottom: 15px !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Скрытие для Chrome/Safari */
.form-content-wrapper::-webkit-scrollbar,
#music-mode-container .tab-content::-webkit-scrollbar,
#video-mode-container .form-content-wrapper::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* ФУТЕР (КНОПКА ГЕНЕРАЦИИ) */
#generate-button,
#generate-music-button,
#generate-cover-button,
#generate-video-button,
#start-photoshoot-btn,
.mt-auto {
    flex-shrink: 0;
    width: 100%;
    margin-top: auto;
    z-index: 10;
}

form {
    margin: 0;
    padding: 0;
    height: 100%;
}

/* ==================================================================== */
/* === ПРАВАЯ ПАНЕЛЬ: МЕНЮ И ИКОНКИ                                 === */
/* ==================================================================== */

#modes-menu {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding-right: 0;
    
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#modes-menu::-webkit-scrollbar {
    display: none;
}

.modes-panel-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    gap: 15px;
}

#radio-player-container {
    flex-shrink: 0;
    margin-top: 15px;
    padding-top: 15px;
}

/* ==================================================================== */
/* === АДАПТИВНОСТЬ (ИСПРАВЛЕННАЯ ВЕРСИЯ)                           === */
/* ==================================================================== */

@media (min-width: 992px) and (max-width: 1350px) {
    .main-container {
        padding: 8px;
        gap: 12px;
    }

    .controls-panel, 
    .modes-panel {
        flex: 0 0 270px; 
        width: 350px;
        min-width: 350px;
    }
    
    .app-logo-text { font-size: 12px; }
}

@media (max-width: 991px) {
    .main-container {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        padding: 10px;
    }

    body, html {
        overflow: auto;
    }

    .controls-panel, 
    .modes-panel {
        flex: none;
        width: 100%;
        height: auto;
        max-height: none;
        overflow: visible;
    }
    .panel {
        padding: 5px;
        border-radius: 0rem;
    }
    
    .generation-space {
        height: 600px;
        flex: none;
        order: 1;
        margin-bottom: 20px;
    }
    
    .controls-panel { 
        order: 2; 
    }
    
    .modes-panel {
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
    }
    
    .form-content-wrapper {
        overflow-y: visible;
    }
}

/* ==================================================================== */
/* === СКРЫТИЕ ПРАВОЙ ПАНЕЛИ (ЗАКЛАДКА) - ОПТИМИЗИРОВАНО            === */
/* ==================================================================== */

#right-panel-toggle {
    position: absolute;
    top: 15%;
    right: 362px; 
    transform: translateY(-50%);
    width: 16px;   /* Сделали кнопку УЖЕ */
    height: 120px; /* Сделали кнопку ВЫШЕ */
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: 8px 0 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    color: var(--primary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.3);
    transition: right 0.2s ease-out, background 0.2s, color 0.2s;
    will-change: right; /* Даем команду видеокарте подготовиться */
}

#right-panel-toggle:hover {
    background: var(--primary-glow);
    color: #fff;
}

@media (min-width: 992px) and (max-width: 1350px) {
    .controls-panel, .modes-panel {
        flex: 0 0 350px !important;
        width: 350px !important;
        min-width: 350px !important;
    }
    #right-panel-toggle {
        right: 359px;
    }
}

.modes-panel {
    transition: margin-right 0.2s ease-out, opacity 0.2s ease-out;
    will-change: margin-right, opacity;
}

body.right-panel-collapsed .modes-panel {
    margin-right: -362px !important;
    opacity: 0;
    pointer-events: none;
}

body.right-panel-collapsed #right-panel-toggle {
    right: 0 !important;
    border-right: 1px solid var(--border-color);
}

@media (max-width: 991px) {
    #right-panel-toggle { display: none !important; }
    body.right-panel-collapsed .modes-panel {
        margin-right: 0 !important;
        opacity: 1;
        pointer-events: auto;
    }
}