
:root {
    --primary-bg: #121212;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent: #1DB954;
    --border-radius: 12px;
}

body {
    margin: 0;
    padding: 0;
    background: var(--primary-bg);
    color: var(--text-primary);
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    overflow: hidden;
    height: 100vh;
    touch-action: manipulation;
}

.loading, .error-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    flex-direction: column;
    gap: 1rem;
}

.loading-text, .error-message div {
    color: var(--text-primary);
    font-size: 1.2rem;
}

.spinner-border {
    color: var(--accent);
}

.error-message {
    display: none;
}

/* Единственный режим — портрет */
.portrait-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
}

.background-blur {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(40px) brightness(0.5);
    z-index: -1;
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 767px;
}

.album-art-container {
    padding: 2rem;
    display: flex;
    justify-content: center;
}

.album-art {
    width: 80%;
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-controls {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.track-info {
    text-align: center;
}

.track-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-artist {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.control-btn, .play-pause-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.control-btn:hover, .play-pause-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.play-pause-btn {
    width: 70px;
    height: 70px;
    background: var(--accent);
    color: #000;
}

.play-pause-btn:hover {
    background: #1ed760;
}

.progress-container {
    padding: 0 2rem;
    margin-top: 1rem;
}

.progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 0.1s;
}

.time-info {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.playlist-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    backdrop-filter: blur(10px);
    z-index: 2;
    transition: all 0.2s ease;
}

.playlist-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Модальное окно с вкладками */
.playlist-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-bg);
    backdrop-filter: blur(10px);
    z-index: 10;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.playlist-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.playlist-tabs {
    display: flex;
    gap: 1rem;
    flex: 1;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.playlist-tabs::-webkit-scrollbar {
    display: none;
}

.playlist-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.playlist-tab:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.playlist-tab.active {
    background-color: rgba(29, 185, 84, 0.2);
    color: var(--accent);
}

.close-playlist-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-playlist-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.playlist-panels {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.playlist-panel {
    display: none;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.playlist-panel.active {
    display: grid;
}

.track-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: rgba(255, 255, 255, 0.05);
    width: 96vw;
}

.track-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.track-item.active {
    background-color: rgba(29, 185, 84, 0.2);
    border: 1px solid var(--accent);
}

.track-thumbnail {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 1rem;
    flex-shrink: 0;
}

.track-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-details {
    flex: 1;
    overflow: hidden;
}

.track-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-artist-mini {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-duration {
    color: var(--text-secondary);
    font-size: 0.85rem;
    min-width: 40px;
    text-align: right;
}

.category-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: rgba(255, 255, 255, 0.05);
}

.category-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.category-thumbnail {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 1rem;
    flex-shrink: 0;
}

.category-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-details {
    flex: 1;
    overflow: hidden;
}

.category-name {
    font-weight: 500;
}

.category-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

button.control-btn.active {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #1ed760;
}

/* Действия с треком */
.track-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--accent);
}

.action-btn i {
    font-size: 1rem;
}

@media (max-width: 576px) {
    .album-art { width: 90%; }
    .player-controls { padding: 1rem; }
    .track-title { font-size: 1.25rem; }
    .controls { gap: 1rem; }
    .control-btn, .play-pause-btn { width: 44px; height: 44px; font-size: 1.25rem; }
    .play-pause-btn { width: 52px; height: 52px; }
    .track-thumbnail { width: 40px; height: 40px; margin-right: 0.75rem; }
    .content {max-width: 100%; padding: 2rem 0;}
    .playlist-btn {top: 2rem;right: 2rem;}
    #playlist-container {top: 2rem;}
}
