/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a1a2e;
    --secondary-color: #16213e;
    --accent-color: #0f3460;
    --highlight-color: #e94560;
    --text-color: #eaeaea;
    --text-secondary: #a0a0a0;
    --border-radius: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 6px 12px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-color);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: rgba(22, 33, 62, 0.8);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    padding: 30px 20px;
    text-align: center;
    border-bottom: 2px solid var(--highlight-color);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 5px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.tagline {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Main Content */
main {
    padding: 25px 20px;
}

/* Genre Selector */
.genre-selector {
    margin-bottom: 25px;
}

.genre-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.genre-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
    background: var(--accent-color);
    border-radius: var(--border-radius);
}

.genre-checkboxes::-webkit-scrollbar {
    width: 8px;
}

.genre-checkboxes::-webkit-scrollbar-track {
    background: var(--secondary-color);
    border-radius: 4px;
}

.genre-checkboxes::-webkit-scrollbar-thumb {
    background: var(--highlight-color);
    border-radius: 4px;
}

.genre-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--secondary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.genre-checkbox-item:hover {
    background: var(--primary-color);
    transform: translateX(3px);
}

.genre-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--highlight-color);
    flex-shrink: 0;
}

.genre-checkbox-item span {
    font-size: 0.95rem;
    color: var(--text-color);
}

.genre-checkbox-item input[type="checkbox"]:checked + span {
    color: var(--highlight-color);
    font-weight: 600;
}

.genre-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.genre-btn {
    flex: 1;
    padding: 8px 12px;
    background: var(--accent-color);
    color: var(--text-color);
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.genre-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

.genre-btn.load-btn {
    background: var(--highlight-color);
    font-weight: 600;
}

.genre-btn.load-btn:hover {
    background: #c23050;
}

.genre-btn:active {
    transform: translateY(0);
}

/* Selected Genres Display */
.selected-genres-display {
    margin-bottom: 25px;
    padding: 12px 15px;
    background: var(--accent-color);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-color);
}

.selected-genres-display strong {
    color: var(--highlight-color);
}

#selectedGenresText {
    color: var(--text-secondary);
    font-style: italic;
}

/* Now Playing */
.now-playing {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    padding: 20px;
    background: var(--accent-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.album-art {
    flex-shrink: 0;
    margin-right: 20px;
    position: relative;
    width: 80px;
    height: 80px;
}

.album-art-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: var(--shadow);
}

.album-placeholder {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--highlight-color) 0%, #c23050 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    box-shadow: var(--shadow);
}

.track-info {
    flex: 1;
    min-width: 0;
}

/* Sound Wave Animation */
.sound-wave {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 30px;
    margin-bottom: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sound-wave.active {
    opacity: 1;
}

.sound-wave .bar {
    display: inline-block;
    width: 4px;
    min-width: 4px;
    height: 8px;
    background-color: #e94560;
    background: linear-gradient(180deg, #e94560 0%, #c23050 100%);
    border-radius: 2px;
    transform-origin: bottom;
    animation: sound-wave-animation 0.8s ease-in-out infinite;
    will-change: height;
}

.sound-wave .bar:nth-child(1) {
    animation-delay: 0s;
}

.sound-wave .bar:nth-child(2) {
    animation-delay: 0.1s;
}

.sound-wave .bar:nth-child(3) {
    animation-delay: 0.2s;
}

.sound-wave .bar:nth-child(4) {
    animation-delay: 0.3s;
}

.sound-wave .bar:nth-child(5) {
    animation-delay: 0.4s;
}

@keyframes sound-wave-animation {
    0% {
        height: 8px;
    }
    50% {
        height: 24px;
    }
    100% {
        height: 8px;
    }
}

.track-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-genre {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 20px;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--accent-color);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--highlight-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.progress-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--highlight-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.progress-bar::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.progress-bar::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.control-btn {
    width: 50px;
    height: 50px;
    background: var(--accent-color);
    border: none;
    border-radius: 50%;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.control-btn.play-pause {
    width: 65px;
    height: 65px;
    background: var(--highlight-color);
}

.control-btn.play-pause svg {
    width: 32px;
    height: 32px;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.control-btn:disabled:hover {
    transform: none;
    box-shadow: var(--shadow);
}

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    padding: 0 10px;
}

.volume-control label {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.volume-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--accent-color);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--text-secondary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: var(--highlight-color);
}

.volume-slider::-moz-range-thumb:hover {
    background: var(--highlight-color);
}

/* Playlist */
.playlist-container {
    margin-top: 30px;
}

.playlist-container h2 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-color);
    color: var(--text-color);
}

.playlist {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.playlist::-webkit-scrollbar {
    width: 8px;
}

.playlist::-webkit-scrollbar-track {
    background: var(--accent-color);
    border-radius: 4px;
}

.playlist::-webkit-scrollbar-thumb {
    background: var(--highlight-color);
    border-radius: 4px;
}

.playlist-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.playlist li {
    padding: 12px 15px;
    margin-bottom: 8px;
    background: var(--accent-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playlist li:hover {
    background: var(--secondary-color);
    transform: translateX(5px);
}

.playlist li.active {
    background: var(--highlight-color);
    font-weight: 600;
}

.playlist li .song-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist li .song-duration {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: 10px;
}

/* Footer */
footer {
    padding: 20px;
    text-align: center;
    background: var(--primary-color);
    border-top: 1px solid var(--accent-color);
}

footer p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 0;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.8rem;
    }

    main {
        padding: 20px 15px;
    }

    .genre-checkboxes {
        grid-template-columns: 1fr;
        max-height: 200px;
    }

    .genre-checkbox-item {
        padding: 12px;
    }

    .genre-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .genre-btn {
        width: 100%;
    }

    .now-playing {
        padding: 15px;
    }

    .album-art {
        width: 60px;
        height: 60px;
        margin-right: 15px;
    }

    .album-art-image,
    .album-placeholder {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .track-title {
        font-size: 1rem;
    }

    .controls {
        gap: 10px;
    }

    .control-btn {
        width: 45px;
        height: 45px;
    }

    .control-btn svg {
        width: 20px;
        height: 20px;
    }

    .control-btn.play-pause {
        width: 55px;
        height: 55px;
    }

    .control-btn.play-pause svg {
        width: 28px;
        height: 28px;
    }

    .playlist-container h2 {
        font-size: 1.1rem;
    }

    .playlist li {
        padding: 10px 12px;
    }
}

@media (max-width: 360px) {
    header h1 {
        font-size: 1.3rem;
    }

    .controls {
        gap: 8px;
    }

    .control-btn {
        width: 40px;
        height: 40px;
    }

    .control-btn.play-pause {
        width: 50px;
        height: 50px;
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}
