/* ===================================== */
/*              GRID LAYOUT              */
/* ===================================== */

/* ===== ОСНОВНАЯ СЕТКА ИЗ 3 КОНТЕЙНЕРОВ ===== */
body {
    display: flex;
    flex-direction: row;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-main);
}

/* Контейнер 1: МЕНЮ (слева) */
.sidebar { 
    width: var(--sidebar-width); 
    min-width: var(--sidebar-width);
    height: 100vh;
    overflow-y: auto;
    background: var(--bg-sidebar);
    backdrop-filter: blur(10px);
    border-right: var(--glass-border);
    z-index: 100;
}

/* Контейнер 2: ОСНОВНОЙ КОНТЕНТ (центр) */
.main-content { 
    flex: 1; 
    overflow-y: auto; 
    padding: 20px 40px calc(var(--player-height) + 20px); 
    position: relative; 
    scroll-behavior: smooth;
    height: 100vh;
    background: var(--bg-main);
}

/* Контейнер 3: ПЛЕЕР (снизу, поверх всего) */
.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--player-height);
    z-index: 2000;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    border-top: var(--glass-border);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
}

/* На десктопе плеер с отступом от меню */
@media (min-width: 769px) {
    .player-bar {
        left: var(--sidebar-width) !important;
        width: calc(100% - var(--sidebar-width)) !important;
    }
}

/* Стилизация скролла */
.main-content::-webkit-scrollbar { 
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.main-content::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.2);
    border-radius: 4px;
    transition: var(--transition-fast);
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.4);
}

/* ========== СЕТКА ГЛАВНОЙ СТРАНИЦЫ ========== */
.section-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 50px;
}

.section-grid .section {
    flex: 1 1 450px; /* минимальная ширина 450px */
    min-width: 450px; /* жёсткая минимальная ширина */
}

/* Жёсткий перенос при любой ширине меньше 1000px */
@media (max-width: 1000px) {
    .section-grid .section {
        flex: 1 1 100%;
        min-width: 100%;
    }
}

/* Для мобилок */
@media (max-width: 768px) {
    .section-grid {
        gap: 20px;
    }
}

/* ========== ФИКС ДЛЯ КНОПКИ МЕНЮ ========== */
/* Кнопка меню всегда видна */
.track-menu-btn {
    min-width: 32px !important;
    width: 32px !important;
    flex-shrink: 0 !important;
}

.track-menu-container {
    flex-shrink: 0 !important;
}

/* Колонка меню всегда фиксированной ширины */
.col-menu,
.track-menu-cell,
td.col-menu,
td.track-menu-cell {
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    flex-shrink: 0 !important;
}

/* На мобилках кнопка чуть меньше */
@media (max-width: 768px) {
    .col-menu,
    .track-menu-cell,
    td.col-menu,
    td.track-menu-cell {
        width: 45px !important;
        min-width: 45px !important;
        max-width: 45px !important;
    }
    
    .track-menu-btn {
        width: 28px !important;
        min-width: 28px !important;
    }
}

@media (max-width: 480px) {
    .col-menu,
    .track-menu-cell,
    td.col-menu,
    td.track-menu-cell {
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
    }
    
    .track-menu-btn {
        width: 26px !important;
        min-width: 26px !important;
        font-size: 16px !important;
    }
}

/* Блоки плейлистов */
#myPlaylistsScroll,
#favoritePlaylistsScroll {
    margin-bottom: 30px;
}

#favoritePlaylistsScroll {
    margin-top: -10px;
}

/* ========== МОБИЛЬНАЯ ВЕРСИЯ ========== */
@media (max-width: 768px) {
    body {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 10000;
        transition: left 0.3s ease;
        height: 100vh;
        width: 280px;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        width: 100%;
        height: 100vh;
        padding: 70px 16px calc(var(--player-height) + 16px) !important;
    }
    
    .menu-toggle {
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 10001;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: var(--accent-gradient);
        color: #000;
        font-size: 24px;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: var(--accent-glow);
    }
    
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(3px);
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* На мобилках секции переносятся */
    .section-grid .section {
        flex: 1 1 100%;
        min-width: 0;
    }
    
    .home-table {
        min-width: 450px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .sidebar {
        width: 260px;
    }
    
    .main-content {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .home-table {
        min-width: 380px;
    }
}

/* Ландшафтная ориентация на мобилках */
@media (orientation: landscape) and (max-width: 768px) {
    .main-content {
        padding-top: 50px;
    }
    
    .hero-mix {
        height: 100px;
    }
}

/* Убираем скролл у модальных окон */
.modal-open {
    overflow: hidden !important;
}

.modal-open .main-content {
    overflow: hidden !important;
}