/* ============================================
           МОБИЛЬНАЯ ВЕРСИЯ
   ============================================ */

/* Общие медиа-брейкпоинты */
:root {
    --breakpoint-xs: 480px;
    --breakpoint-sm: 768px;
    --breakpoint-md: 1024px;
    --breakpoint-lg: 1280px;
    --breakpoint-xl: 1536px;
}

/* ========== ДЕСКТОП (по умолчанию) ========== */

/* ========== ПЛАНШЕТЫ (768px - 1024px) ========== */
@media (max-width: 1024px) {
    /* Сайдбар */
    .sidebar {
        width: 240px;
        min-width: 240px;
    }
    
    .logo {
        font-size: 20px;
        margin: 20px 0 30px 16px;
    }
    
    .nav-item {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .nav-icon {
        font-size: 18px;
        width: 26px;
    }
    
    /* Основной контент */
    .main-content {
        padding: 20px 24px calc(var(--player-height) + 20px);
    }
    
    /* Главная страница */
    .hero-mix {
        height: 180px;
    }
    
    .hero-mix h1 {
        font-size: 36px;
    }
    
    .section-grid {
        gap: 24px;
    }
    
    /* Карточки */
    .artist-card {
        min-width: 140px;
        width: 140px;
        padding: 12px;
    }
    
    .artist-cover {
        width: 100px;
        height: 100px;
    }
    
    .album-card {
        min-width: 160px;
        width: 160px;
        padding: 12px;
    }
    
    .album-cover {
        width: 120px;
        height: 120px;
    }
    
    .playlist-card {
        min-width: 140px;
        width: 140px;
        padding: 12px;
    }
    
    .playlist-cover {
        width: 100px;
        height: 100px;
    }
    
    /* Таблицы */
    .tracks-table th,
    .tracks-table td {
        padding: 10px 12px;
    }
    
    .col-index {
        width: 45px !important;
        min-width: 45px !important;
    }
    
    .col-cover {
        width: 45px !important;
        min-width: 45px !important;
    }
    
    .track-cover {
        width: 35px !important;
        height: 35px !important;
    }
    
    .col-plays {
        width: 80px;
    }
    
    .col-duration {
        width: 65px;
    }
    
    /* Страницы артиста/альбома */
    .artist-header-content,
    .album-header-content {
        gap: 30px;
    }
    
    .artist-avatar {
        width: 160px;
        height: 160px;
    }
    
    .album-cover-large {
        width: 180px;
        height: 180px;
    }
    
    .artist-name {
        font-size: 36px;
    }
    
    .album-title {
        font-size: 36px;
    }
}

/* ========== МАЛЕНЬКИЕ ПЛАНШЕТЫ (768px) ========== */
@media (max-width: 768px) {
    /* Мобильное меню */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 10001;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: linear-gradient(135deg, #FFD700, #FFA500);
        color: #000;
        font-size: 24px;
        border: none;
        cursor: pointer;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 10000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px;
        background: rgba(10, 10, 15, 0.98);
        backdrop-filter: blur(20px);
        border-right: 1px solid rgba(255, 215, 0, 0.1);
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Основной контент */
    .main-content {
        width: 100%;
        padding: 70px 16px calc(var(--player-height) + 16px) !important;
        margin: 0;
    }
    
    /* Главная страница */
    .hero-mix {
        height: 140px;
        margin-bottom: 24px;
        border-radius: 20px;
    }
    
    .hero-mix h1 {
        font-size: 28px;
        letter-spacing: 2px;
    }
    
    .section-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        margin-bottom: 32px;
    }
    
    .section-title {
        font-size: 18px;
        margin-bottom: 16px;
    }
    
    .title-icon {
        font-size: 20px;
    }
    
    /* Карточки */
    .artists-scroll,
    .playlists-scroll {
        gap: 12px;
        padding: 8px 4px 16px;
    }
    
    .artist-card {
        min-width: 110px;
        width: 110px;
        padding: 10px 8px;
    }
    
    .artist-cover {
        width: 80px;
        height: 80px;
        margin-bottom: 8px;
    }
    
    .artist-name {
        font-size: 12px;
    }
    
    .artist-stats {
        font-size: 10px;
    }
    
    .album-card {
        min-width: 130px;
        width: 130px;
        padding: 10px;
    }
    
    .album-cover {
        width: 100px;
        height: 100px;
        margin-bottom: 8px;
    }
    
    .album-title {
        font-size: 12px;
    }
    
    .album-meta {
        font-size: 10px;
    }
    
    .playlist-card {
        min-width: 120px;
        width: 120px;
        padding: 10px;
    }
    
    .playlist-cover {
        width: 90px;
        height: 90px;
        font-size: 32px;
    }
    
    .playlist-name {
        font-size: 12px;
    }
    
    .playlist-meta {
        font-size: 10px;
    }
    
    /* Таблицы */
    .tracks-table th,
    .tracks-table td {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .col-index {
        width: 40px !important;
        min-width: 40px !important;
        font-size: 12px;
    }
    
    .col-cover {
        width: 40px !important;
        min-width: 40px !important;
    }
    
    .track-cover {
        width: 32px !important;
        height: 32px !important;
    }
    
    .col-plays {
        width: 70px;
        font-size: 11px;
    }
    
    .col-duration {
        width: 55px;
        font-size: 11px;
    }
    
    .track-name {
        font-size: 13px;
    }
    
    .track-artist {
        font-size: 10px;
    }
    
    /* Страницы артиста/альбома */
    .artist-header,
    .album-header {
        padding: 20px;
    }
    
    .artist-header-content,
    .album-header-content {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .artist-avatar {
        width: 120px;
        height: 120px;
    }
    
    .album-cover-large {
        width: 150px;
        height: 150px;
    }
    
    .artist-name {
        font-size: 28px;
    }
    
    .album-title {
        font-size: 28px;
        text-align: center;
    }
    
    .artist-stats {
        justify-content: center;
        gap: 20px;
        flex-wrap: wrap;
    }
    
    .stat-item:not(:last-child)::after {
        display: none;
    }
    
    .artist-actions {
        justify-content: center;
    }
    
    .artist-content {
        padding: 0 16px 40px;
    }
    
    .album-tracks-section,
    .album-info-section {
        padding: 0 16px 30px;
    }
    
    /* Плеер */
    .player-container {
        padding: 8px 12px;
    }
    
    .player-track-info {
        min-width: 140px;
    }
    
    .player-vinyl {
        width: 40px;
        height: 40px;
    }
    
    .player-track-title {
        font-size: 12px;
        max-width: 100px;
    }
    
    .player-track-artist {
        font-size: 10px;
    }
    
    .player-controls {
        gap: 8px;
        padding: 4px 12px;
    }
    
    .player-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .player-btn-play {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .player-volume {
        min-width: 100px;
        padding: 4px 8px;
    }
    
    .player-volume-slider {
        width: 60px;
    }
    
    .player-volume-value {
        font-size: 10px;
        min-width: 30px;
    }
    
    .player-extra .player-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
}

/* ========== ФИКС ДЛЯ СТРАНИЦ НА МОБИЛКАХ ========== */
@media (max-width: 768px) {
    .page.active {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: relative !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        pointer-events: auto !important;
        z-index: 1;
    }
    
    .player-bar {
        left: 0 !important;
        width: 100% !important;
    }
    
    .main-content {
        padding-bottom: calc(var(--player-height) + 20px) !important;
    }
}

/* ========== МАЛЕНЬКИЕ МОБИЛЬНЫЕ (480px) ========== */
@media (max-width: 480px) {
    /* Главная */
    .hero-mix {
        height: 100px;
    }
    
    .hero-mix h1 {
        font-size: 22px;
    }
    
    /* Карточки */
    .artist-card {
        min-width: 90px;
        width: 90px;
        padding: 8px 6px;
    }
    
    .artist-cover {
        width: 65px;
        height: 65px;
    }
    
    .artist-name {
        font-size: 11px;
    }
    
    .album-card {
        min-width: 110px;
        width: 110px;
        padding: 8px;
    }
    
    .album-cover {
        width: 85px;
        height: 85px;
    }
    
    .playlist-card {
        min-width: 100px;
        width: 100px;
        padding: 8px;
    }
    
    .playlist-cover {
        width: 75px;
        height: 75px;
        font-size: 28px;
    }
    
    /* Таблицы - скрываем неважные колонки */
    .col-plays,
    .track-plays-cell {
        display: none;
    }
    
    .col-duration {
        width: 45px;
    }
    
    .col-index {
        width: 35px !important;
        min-width: 35px !important;
    }
    
    .track-title-cell {
        max-width: 120px;
    }
    
    /* Плеер */
    .player-main {
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .player-track-info {
        order: 1;
        min-width: 120px;
        max-width: 45%;
    }
    
    .player-controls {
        order: 2;
        padding: 4px 10px;
    }
    
    .player-right {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 6px;
    }
    
    .player-volume {
        display: none;
    }
    
    .player-extra {
        gap: 8px;
    }
    
    .player-extra .player-btn {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
    
    .player-track-title {
        font-size: 11px;
        max-width: 80px;
    }
    
    .player-track-artist {
        font-size: 9px;
    }
    
    .player-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .player-btn-play {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    /* Модальные окна */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
    }
    
    .track-info-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .track-quick-actions {
        justify-content: center;
    }
    
    .track-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== ОЧЕНЬ МАЛЕНЬКИЕ (380px) ========== */
@media (max-width: 380px) {
    .artist-card {
        min-width: 80px;
        width: 80px;
    }
    
    .artist-cover {
        width: 55px;
        height: 55px;
    }
    
    .album-card {
        min-width: 95px;
        width: 95px;
    }
    
    .album-cover {
        width: 70px;
        height: 70px;
    }
    
    .playlist-card {
        min-width: 85px;
        width: 85px;
    }
    
    .playlist-cover {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    .track-title-cell {
        max-width: 100px;
    }
    
    .col-duration {
        display: none;
    }
    
    .player-track-info {
        max-width: 40%;
        min-width: 100px;
    }
    
    .player-controls {
        gap: 4px;
        padding: 4px 8px;
    }
    
    .player-btn {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }
    
    .player-btn-play {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .player-extra .player-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* ========== ЛАНДШАФТНАЯ ОРИЕНТАЦИЯ ========== */
@media (orientation: landscape) and (max-height: 500px) {
    .main-content {
        padding-top: 50px;
    }
    
    .hero-mix {
        height: 80px;
        margin-bottom: 16px;
    }
    
    .hero-mix h1 {
        font-size: 20px;
    }
    
    .player-container {
        padding: 4px 12px;
    }
    
    .player-main {
        flex-wrap: nowrap;
    }
    
    .player-track-info {
        min-width: 120px;
    }
    
    .player-volume {
        display: flex;
    }
    
    .player-extra .player-btn {
        width: 30px;
        height: 30px;
    }
    
    .queue-modal-body {
        max-height: 60vh;
    }
}

/* ========== УЛУЧШЕНИЯ ДЛЯ КАРТОЧЕК ========== */
/* Бегущая строка для длинных названий */
.artist-name-scroll {
    display: inline-flex;
    white-space: nowrap;
    animation: scrollText 10s linear infinite;
    animation-play-state: paused;
}

.artist-card:hover .artist-name-scroll {
    animation-play-state: running;
}

@keyframes scrollText {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Плавные переходы */
* {
    transition: all 0.2s ease;
}

/* Убираем скроллбар для мобилок (но оставляем функциональность) */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 3px;
        height: 3px;
    }
}

/* На телефоне вертикальный ползунок прокрутки не нужен */
@media (max-width: 768px) {
    .main-content::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
    }

    .main-content {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
}

/* Полностью скрываем полосы прокрутки на телефоне (в т.ч. внутри страниц) */
@media (max-width: 768px) {
    html,
    body,
    .main-content,
    .page,
    .page.active,
    .tracks-table-container,
    .tracks-list,
    .modal-content,
    .queue-list,
    .playlist-page,
    .history-page-v2 {
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }

    html::-webkit-scrollbar,
    body::-webkit-scrollbar,
    *::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
        display: none !important;
    }
}

/* Запрещаем горизонтальный пан страницы на телефоне: свайп меню
   не должен утаскивать контент в сторону. */
@media (max-width: 768px) {
    html,
    body {
        overflow-x: hidden !important;
        overscroll-behavior-x: none !important;
    }

    .main-content,
    .page,
    .page.active {
        touch-action: pan-y;
        overscroll-behavior-x: none !important;
    }
}
