body {
    margin: 0;
    /* Темный фон */
    background-color: #121212;
    color: white;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

    /* Отступ */
    padding-bottom: 120px;

    /* Переменная фона для JS */
    --bg-cover: none;
}

/* Создание слоя фона с обложкой */
body::before {
    content: "";
    position: fixed;
    /* Фиксируется, чтобы фон не скроллился */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    /* Используется переменная CSS */
    background-image: var(--bg-cover);
    background-size: cover;
    background-position: center;

    /* !!! ЭФФЕКТЫ: Размытие */
    filter: blur(30px);
    /* Сильное размытие для создания абстрактного фона */
    -webkit-filter: blur(30px);

    /* Масштабируется чуть больше 100%, чтобы скрыть белые края от размытия */
    transform: scale(1.1);

    /* Уводится на задний план */
    z-index: -2;

    /* Плавная смена фона при переключении трека */
    transition: background-image 0.8s ease-in-out;

    /* По умолчанию скрывается (пока не заиграет первый трек) */
    opacity: 0;
}


/* Создание слоя затемнения НАД обложкой */

body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    /* Глубокое затемнение (80%) */
    background-color: rgba(0, 0, 0, 0.6);

    /* Уводится на задний план, но НАД слоем с обложкой */
    z-index: -1;
}

/* Класс, который добавляется к body, когда заиграет музыка */
body.music-playing::before {
    opacity: 1;
    /* Проявление обложки */
}


/* Секция сортировки */

.filter-panel {
    display: flex;
    justify-content: center;
    /* Центрирует элементы по горизонтали */
    align-items: center;
    /* Центрирует элементы по вертикали */
    gap: 15px;
    /* Расстояние между селекторами */

    width: 100%;
    /* Растягивается на всю ширину родителя */
    margin: 0 auto 30px auto;
    /* Центрируется сам блок и дается отступ снизу */

    padding: 10px;
    box-sizing: border-box;
    flex-wrap: wrap;
    /* Чтобы на узких экранах кнопки переносились, а не ломали верстку */
}

/* НА ВСЯКИЙ СЛУЧАЙ: проверка контейнера, в котором лежат поиск и фильтры */
.search-section {
    display: flex;
    flex-direction: column;
    /* Выстраивается поиск и фильтры друг под другом */
    align-items: center;
    /* Центририрование */
    width: 100%;
    max-width: 900px;
    /* Должно совпадать с шириной плеера и сетки */
    margin: 0 auto;
}

.filter-panel select {
    /* Базовые размеры и сброс стандартного вида */
    padding: 10px 35px 10px 15px;

    /* Больше отступа справа для кастомной стрелочки */
    appearance: none;
    /* Убирается стандартная стрелка браузера */
    -webkit-appearance: none;

    /* СТИЛЬ GLASSMORPHISM (iOS 26) */
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);

    color: white;
    font-size: 0.9rem;
    font-weight: 400;

    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;

    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    outline: none;

    /* Кастомная стрелочка вниз (SVG) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
}

.filter-panel select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.filter-panel select:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

/* Стилизация выпадающего списка (доступно только для некоторых браузеров) */
.filter-panel select option {
    background-color: #1c1c1e;
    /* Темный фон списка, как в iOS */
    color: white;
    padding: 10px;
}

/* Секция поиска */

/* Центровка */
.search-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
}

/* Поле ввода */
#search-input {
    width: 100%;
    max-width: 400px;
    padding: 12px 20px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 15px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

#search-input:focus {
    border-color: rgba(255, 255, 255, 0.2);
    /* Цвет акцента при фокусе */
    background: #333;
    box-shadow: 0 0 10px rgba(29, 185, 84, 0.2);
}

#search-input:hover {
    transform: scale(1.02);
}

#search-input:active {
    transform: scale(0.95);
}


/* "Найти" */

#search-btn {
    padding: 12px 28px;
    /* Полупрозрачный белый фон с легким оттенком */
    background: rgba(255, 255, 255, 0.1);

    /* Размытие того, что находится под кнопкой (Приколы айоса)*/
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);

    color: white;
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.5px;

    /* Тонкая рамка стекла */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    /* Чуть менее округлая, более "яблочная" форма */

    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    /* Инерция */

    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

#search-btn:hover,
.apply {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.02);
    /* Легкое увеличение вместо прыжка вверх */
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

#search-btn:active,
.apply {
    transform: scale(0.96);
    /* Эффект нажатия на физическую кнопку */
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.1s;
}

/* Блеск для реалистичности */
#search-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 50%);
    pointer-events: none;
}



/* Сетка */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
}


/* Карточки треков/альбомов */

.card {
    background: #1e1e1e;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
}

.card:hover {
    background: #282828;
}

.card img {
    width: 100%;
    border-radius: 5px;
}


/* Плеер */

#player-bar {
    position: fixed;
    left: 50%;
    /* Сдвигание плеера вниз на 150px (вне видимости), учитывая отступ bottom */
    transform: translateX(-50%) translateY(150px);

    bottom: 20px;
    width: 95%;
    max-width: 1200px;
    height: 120px;
    background: rgba(24, 24, 24, 0.9);
    backdrop-filter: blur(15px) saturate(180%);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    z-index: 1000;
    box-sizing: border-box;

    /* Плавная анимация выезда */
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Класс, который добавляется через JS при включении трека */
#player-bar.active {
    transform: translateX(-50%) translateY(0);
}




/* Фикс для мобильных устройств, чтобы плеер не был слишком узким */
@media (max-width: 600px) {
    #player-bar {
        width: 90%;
        bottom: 10px;
        height: 120px;
        flex-direction: column;
        /* На телефонах элементы встанут в колонку */
        padding: 10px;
    }
}

.track-info {
    max-width: 100%;
    text-align: center;
    animation: slideUp 0.4s ease-out;
    /* Анимация при смене трека */
}

#current-cover {
    border-radius: 15px;
}


#track-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#track-artist {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    font-weight: 400;
    opacity: 0.9;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    /* Делает имя исполнителя аккуратнее */
}

/* Загрузить еще */

.more-container {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

#load-more-btn {
    background: transparent;
    color: white;
    border: 2px solid #b3b3b3;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

#load-more-btn:hover {
    border-color: white;
    background: rgba(255, 255, 255, 0.1);
}

.hidden {
    display: none;
}

.hidden {
    display: none !important;
}


/* Модальное окно */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    /* Начинаю с прозрачного */
    backdrop-filter: blur(0px);
    /* Без блюра в начале */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;

    /* Плавное проявление фона */
    transition: background 0.5s ease, backdrop-filter 0.5s ease;
    pointer-events: none;
    /* Чтобы не мешало кликам, пока закрыто */
    opacity: 0;
}

/* Когда модальное окно активно */
.modal.active {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px) saturate(180%);
    pointer-events: auto;
    opacity: 1;
}

/* Контент самого окна (белая/темная плашка) */
.modal-content {
    background: rgba(30, 30, 30, 0.9);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    padding: 35px;
    overflow-y: auto;
    color: white;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);

    /* --- АНИМАЦИЯ ВЫЕЗДА --- */
    transform: translateY(100vh);
    /* Прячет глубоко внизу */
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Когда окно "выезжает" */
.modal.active .modal-content {
    transform: translateY(0);
}

/* Скрывает стандартный скроллбар внутри окна для красоты */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 30px;
    cursor: pointer;
    color: #b3b3b3;
}

.modal-body {
    display: flex;
    gap: 40px;
}

.modal-left {
    flex: 1;
    text-align: center;
}

.modal-left img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-right {
    flex: 2;
}

#modal-tracklist {
    list-style: none;
    padding: 0;
}

.modal-track-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: 0.2s;
}

.modal-track-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.hidden {
    display: none !important;
}