* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
}

:root {
    --primary-color: #e63946;
    --dark-bg: #0a0e27;
    --card-bg: #141829;
    --text-primary: #ffffff;
    --text-secondary: #b8bcc8;
    --border-color: #2a3047;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

#app {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.music-player {
    width: 100%;
    max-width: 500px;
    background: var(--dark-bg);
    border-radius: 24px;
    padding: 2rem 1.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
}

/* Header */
.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.player-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, #e63946, #f77f88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-icons {
    display: flex;
    gap: 1rem;
}

.header-icons button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.5rem;
    transition: color 0.3s;
}

.header-icons button:hover {
    color: var(--primary-color);
}

/* Album Art & Vinyl */
.vinyl-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    perspective: 1000px;
}

.vinyl-record {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #2a2a2a, #000);
    box-shadow: 
        0 0 0 15px rgba(255, 255, 255, 0.05),
        0 20px 60px rgba(0, 0, 0, 0.8),
        inset 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    animation: spin 8s linear infinite;
    animation-play-state: var(--animation-state);
}

.vinyl-record.paused {
    animation-play-state: paused;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.vinyl-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at 30% 30%, #ffd700, #daa520);
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.vinyl-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e1e1e, #333);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 5px;
    overflow: hidden;
}

.vinyl-label-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.vinyl-label-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--primary-color);
}

/* Song Info */
.song-info {
    text-align: center;
    margin-top: 15px;
    margin-bottom: 2rem;
}

.song-info h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Progress Bar */
.progress-section {
    margin-bottom: 1.5rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    margin-bottom: 0.5rem;
    position: relative;
    overflow: hidden;
}

.progress-bar:hover .progress-fill {
    background: #ff4d5c;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
    transition: width 0.1s linear;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.control-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.control-btn.primary {
    width: 70px;
    height: 70px;
    background: var(--primary-color);
    color: white;
    font-size: 1.8rem;
    border: none;
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.3);
}

.control-btn.primary:hover {
    background: #d32838;
    box-shadow: 0 6px 20px rgba(230, 57, 70, 0.4);
}

.control-btn.primary:active {
    transform: scale(0.95);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: space-around;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s;
}

.action-btn:hover {
    color: var(--primary-color);
}

.action-btn.active {
    color: var(--primary-color);
}

.action-btn span {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Playlist */
.playlist-section {
    margin-top: 1.5rem;
}

.playlist-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.playlist-label i {
    color: var(--primary-color);
}

.playlist-items {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--card-bg);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.playlist-item:hover {
    background: var(--border-color);
    border-color: var(--primary-color);
}

.playlist-item.active {
    background: rgba(230, 57, 70, 0.1);
    border-color: var(--primary-color);
}

.playlist-item-number {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 25px;
}

.playlist-item-info {
    flex: 1;
    min-width: 0;
}

.playlist-item-title {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-artist {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-duration {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Volume Control */
.volume-section {
    margin-top: 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
}

.volume-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.volume-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    #app {
        padding: 0;
        min-height: 100vh;
        height: 100vh;
    }

    .music-player {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        padding: 1.5rem 1rem;
        border-radius: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .player-header {
        margin-bottom: 1.5rem;
    }

    .vinyl-container {
        margin: 1.5rem 0;
    }

    .vinyl-record {
        width: 220px;
        height: 220px;
    }

    .song-info h2 {
        font-size: 1.25rem;
    }

    .controls {
        gap: 0.8rem;
    }

    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }

    .control-btn.primary {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .action-buttons {
        padding: 1rem 0;
    }

    .playlist-items {
        max-height: 150px;
    }

    /* Playlist View Mobile */
    .recently-played-section {
        margin-bottom: 1.5rem;
    }

    .recently-played-card {
        padding: 0.75rem;
    }

    .recently-played-vinyl .vinyl-record {
        width: 100px;
        height: 100px;
    }

    .recently-played-info h4 {
        font-size: 0.95rem;
    }

    .playlist-view-items {
        margin-bottom: 0.5rem;
    }

    .playlist-view-item {
        padding: 0.75rem;
    }

    .mini-player {
        padding: 0.75rem;
    }

    .mini-vinyl-record {
        width: 50px;
        height: 50px;
    }

    .mini-vinyl-label {
        width: 40px;
        height: 40px;
    }

    .mini-title {
        font-size: 0.85rem;
    }

    .mini-artist {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    #app {
        padding: 0;
        min-height: 100vh;
        height: 100vh;
    }

    .music-player {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        padding: 1rem 0.75rem;
        border-radius: 0;
        overflow-y: auto;
        overflow-x: hidden;
        box-shadow: none;
    }

    .player-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }

    .player-header h1 {
        font-size: 1.25rem;
    }

    .vinyl-container {
        margin: 1rem 0;
        margin-bottom:40px;
    }

    .vinyl-record {
        width: 200px;
        height: 200px;
    }

    .song-info {
        margin-bottom: 1.5rem;
    }

    .song-info h2 {
        font-size: 1.15rem;
    }

    .song-info p {
        font-size: 0.9rem;
    }

    .progress-section {
        margin-bottom: 1rem;
    }

    .time-display {
        font-size: 0.8rem;
    }

    .controls {
        gap: 0.6rem;
        margin-bottom: 1.5rem;
    }

    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }

    .control-btn.primary {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }

    .action-buttons {
        padding: 0.75rem 0;
        gap: 0.5rem;
    }

    .action-btn {
        font-size: 1.2rem;
    }

    .action-btn span {
        font-size: 0.7rem;
    }

    .volume-section {
        margin-top: 0.75rem;
        padding: 0.75rem 0;
    }

    .volume-label {
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }

    .playlist-section {
        margin-top: 1rem;
    }

    .playlist-items {
        max-height: 120px;
        gap: 0.3rem;
    }

    .playlist-item {
        padding: 0.5rem;
    }

    .playlist-item-number {
        font-size: 0.8rem;
    }

    .playlist-item-title {
        font-size: 0.8rem;
    }

    .playlist-item-artist {
        font-size: 0.75rem;
    }

    .playlist-item-duration {
        font-size: 0.75rem;
    }

    /* Playlist View Mobile */
    .recently-played-header {
        font-size: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .recently-played-card {
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .recently-played-vinyl .vinyl-record {
        width: 90px;
        height: 90px;
    }

    .recently-played-info h4 {
        font-size: 0.9rem;
        margin-bottom: 0.15rem;
    }

    .recently-played-info p {
        font-size: 0.8rem;
    }

    .track-tags {
        gap: 0.3rem;
        margin-top: 0.3rem;
    }

    .tag {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }

    .playlist-view-items {
        gap: 0.4rem;
        margin-bottom: 0.5rem;
    }

    .playlist-view-item {
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .item-number {
        font-size: 0.85rem;
        min-width: 25px;
    }

    .item-title {
        font-size: 0.9rem;
    }

    .item-artist {
        font-size: 0.8rem;
    }

    .item-duration {
        font-size: 0.8rem;
    }

    .mini-player {
        padding: 0.75rem;
        gap: 0.5rem;
        margin-top: auto;
    }

    .mini-player-info {
        gap: 0.75rem;
    }

    .mini-vinyl-record {
        width: 45px;
        height: 45px;
    }

    .mini-vinyl-label {
        width: 36px;
        height: 36px;
    }

    .mini-title {
        font-size: 0.8rem;
    }

    .mini-artist {
        font-size: 0.7rem;
    }

    .mini-player-controls {
        gap: 0.3rem;
    }

    .mini-player-controls button {
        font-size: 1rem;
        padding: 0.3rem;
    }

    .mini-player-controls .play-btn {
        width: 35px;
        height: 35px;
    }
}

/* Scrollbar Styling */
.playlist-items::-webkit-scrollbar {
    width: 6px;
}

.playlist-items::-webkit-scrollbar-track {
    background: transparent;
}

.playlist-items::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.playlist-items::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Recently Played Badge */
.recently-played-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    background: var(--primary-color);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    margin-top: 0.5rem;
}

/* Playlist View */
.playlist-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.recently-played-section {
    margin-bottom: 2rem;
}

.recently-played-header {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recently-played-header i {
    color: var(--primary-color);
}

.recently-played-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.recently-played-card:hover {
    border-color: var(--primary-color);
    background: rgba(230, 57, 70, 0.05);
}

.recently-played-vinyl {
    flex-shrink: 0;
}

.recently-played-vinyl .vinyl-record {
    width: 120px;
    height: 120px;
}

.recently-played-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.recently-played-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recently-played-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    background: var(--border-color);
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.tag.hi-res {
    background: var(--primary-color);
    color: white;
}

/* Playlist View Items */
.playlist-view-items {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-right: 0.5rem;
}

.playlist-view-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.playlist-view-item:hover {
    background: var(--border-color);
    border-color: var(--primary-color);
}

.item-number {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 30px;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-artist {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-duration {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Mini Player */
.mini-player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(230, 57, 70, 0.1);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-top: auto;
}

.mini-player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.mini-vinyl {
    flex-shrink: 0;
}

.mini-vinyl-record {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #2a2a2a, #000);
    position: relative;
    animation: spin 8s linear infinite;
    animation-play-state: var(--animation-state);
}

.mini-vinyl-record.paused {
    animation-play-state: paused;
}

.mini-vinyl-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e1e1e, #333);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mini-vinyl-label.paused {
    /* No animation needed - follows parent */
}

.mini-vinyl-label-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
}

.mini-vinyl-label-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.mini-vinyl-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: radial-gradient(circle at 30% 30%, #ffd700, #daa520);
    border-radius: 50%;
}

.mini-track-info {
    flex: 1;
    min-width: 0;
}

.mini-title {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-artist {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-player-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.mini-player-controls button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.3s;
    padding: 0.5rem;
}

.mini-player-controls button:hover {
    color: var(--primary-color);
}

.mini-player-controls .play-btn {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-player-controls .play-btn:hover {
    background: #d32838;
}

/* Player View */
.player-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Scrollbar Styling for Playlist View */
.playlist-view-items::-webkit-scrollbar {
    width: 6px;
}

.playlist-view-items::-webkit-scrollbar-track {
    background: transparent;
}

.playlist-view-items::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.playlist-view-items::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}
