/* style.css — основные стили сайта */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0b0b0b;
    --bg-panel: #111;
    --text-primary: #f0f0f0;
    --text-secondary: #aaa;
    --accent: #1db954;
    --accent-dim: rgba(29,185,84,0.2);
    --border-light: rgba(255,255,255,0.05);
    --border-hover: rgba(255,255,255,0.1);
    --card-bg: rgba(255,255,255,0.02);
    --player-bg: rgba(15,15,15,0.95);
    --shadow: 0 20px 30px rgba(0,0,0,0.7);
    --transition: all 0.3s ease;
}

[data-theme="light"] {
    --bg-dark: #0f172a;        /* глубокий тёмно-синий фон */
    --bg-panel: #1e293b;        /* панели чуть светлее */
    --text-primary: #e2e8f0;    /* светло-серый текст */
    --text-secondary: #94a3b8;  /* приглушённый серый */
    --accent: #f87171;           /* красноватый акцент (под цвет шаров) */
    --accent-dim: rgba(248, 113, 113, 0.2);
    --border-light: rgba(255,255,255,0.05);
    --border-hover: rgba(255,255,255,0.1);
    --card-bg: rgba(255,255,255,0.02);
    --player-bg: rgba(15,23,42,0.95);  /* полупрозрачный фон плеера */
    --shadow: 0 20px 30px rgba(0,0,0,0.7);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Шапка */
.header {
    padding: 2.5rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(5px);
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.header h1 {
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 6px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fff, #aaa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeInDown 1s forwards;
}

.header .sub {
    color: #666;
    margin-top: 0.5rem;
    font-size: 1rem;
    letter-spacing: 2px;
    opacity: 0;
    animation: fadeInUp 1s 0.3s forwards;
}

@keyframes fadeInDown {
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

/* Кнопка переключения темы */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.theme-toggle svg {
    fill: currentColor;
    width: 24px;
    height: 24px;
}

/* Галерея альбомов */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
    padding: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.album-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--border-light);
    backdrop-filter: blur(2px);
    opacity: 0;
    transform: translateY(20px);
}

.album-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.album-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow);
    border-color: var(--border-hover);
}

.album-cover {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    background: #1e1e1e;
    display: block;
}

.album-info {
    padding: 1rem;
}

.album-title {
    font-weight: 500;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.album-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Плеер */
.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--player-bg);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-light);
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
}

.player-bar.active {
    transform: translateY(0);
}

.player-main-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.track-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 220px;
}

.track-cover {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    background: #2a2a2a;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    transition: transform 0.3s;
}

.track-cover:hover {
    transform: scale(1.05);
}

.track-details {
    overflow: hidden;
}

.track-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.album-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex: 1;
}

.control-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

.control-btn:hover {
    background: rgba(255,255,255,0.1);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.active {
    color: var(--accent);
    background: var(--accent-dim);
}

.play-pause-btn {
    width: 48px;
    height: 48px;
}

.control-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.play-pause-btn svg {
    width: 30px;
    height: 30px;
}

audio {
    flex: 2;
    height: 44px;
    border-radius: 30px;
    min-width: 200px;
}

audio::-webkit-media-controls-panel {
    background: #2a2a2a;
}

/* Firefox audio styles */
audio::-moz-media-controls-panel {
    background: #2a2a2a;
}

/* Playlist loading indicator */
.playlist-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

[data-theme="light"] .loading-spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: var(--accent);
}

.playlist-toggle {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    padding: 0.5rem 1.2rem;
    border-radius: 40px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.playlist-toggle:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--border-hover);
}

.playlist-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Панель плейлиста */
.playlist-panel {
    position: fixed;
    right: -400px;
    top: 0;
    bottom: 0;
    width: 380px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-light);
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 200;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 20px rgba(0,0,0,0.7);
}

.playlist-panel.open {
    right: 0;
}

.playlist-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playlist-header h2 {
    font-size: 1.3rem;
    font-weight: 400;
    letter-spacing: 1px;
    color: var(--text-primary);
}

.close-panel {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.5rem;
}

.close-panel:hover {
    color: var(--text-primary);
}

#playlist {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 0.3rem;
    border: 1px solid transparent;
}

.playlist-item:hover {
    background: rgba(255,255,255,0.03);
    border-color: var(--border-hover);
}

.playlist-item.active {
    background: rgba(255,255,255,0.08);
    border-left: 3px solid var(--accent);
}

.playlist-item-cover {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: #333;
}

.playlist-item-info {
    flex: 1;
    overflow: hidden;
}

.playlist-item-title {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.playlist-item-album {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    display: none;
    backdrop-filter: blur(2px);
}

.overlay.visible {
    display: block;
}

.loading, .error {
    text-align: center;
    padding: 4rem;
    color: #888;
}

.error {
    color: #f66;
}

/* ========== АДАПТАЦИЯ ========== */
@media (max-width: 700px) {
    .gallery {
        gap: 1rem;
        padding: 1rem;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .album-title {
        font-size: 0.9rem;
    }

    .album-meta {
        font-size: 0.75rem;
    }

    .player-main-row {
        flex-wrap: wrap;
        gap: 0.8rem;
    }

    .track-info {
        min-width: 100%;
        order: 1;
        justify-content: flex-start;
    }

    .player-controls {
        order: 2;
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
    }

    .control-btn {
        width: 36px;
        height: 36px;
    }

    .play-pause-btn {
        width: 42px;
        height: 42px;
    }

    .control-btn svg {
        width: 20px;
        height: 20px;
    }

    .play-pause-btn svg {
        width: 26px;
        height: 26px;
    }

    audio {
        order: 3;
        width: 100%;
        min-width: auto;
    }

    .playlist-toggle {
        order: 4;
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .playlist-panel {
        width: 85%;
        max-width: 320px;
    }

    .playlist-item-title {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 2.2rem;
        letter-spacing: 4px;
    }

    .header .sub {
        font-size: 0.8rem;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.8rem;
        padding: 0.8rem;
    }

    .album-info {
        padding: 0.6rem;
    }

    .album-title {
        font-size: 0.8rem;
    }

    .album-meta {
        font-size: 0.7rem;
    }

    .track-cover {
        width: 48px;
        height: 48px;
    }

    .track-name {
        font-size: 0.9rem;
    }

    .album-name {
        font-size: 0.7rem;
    }

    .playlist-panel {
        width: 100%;
        max-width: none;
    }
}


/* Футер */
.site-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    max-width: 700px;
    margin: 6rem auto 0;        /* большой отступ сверху — примерно на полкарточки */
    border-top: 1px solid var(--border-light);
    line-height: 1.6;
    letter-spacing: 0.3px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.site-footer:hover {
    opacity: 1;
}

.site-footer a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dotted var(--accent-dim);
    transition: border-bottom 0.2s;
}

.site-footer a:hover {
    border-bottom-style: solid;
    border-bottom-color: var(--accent);
}

/* На мобильных отступ немного меньше */
@media (max-width: 700px) {
    .site-footer {
        margin-top: 3rem;
        font-size: 0.8rem;
        padding: 1rem;
    }
}
