/* css/music.css */
body, html {
    overflow-x: hidden !important;
    max-width: 100%;
}

.player-container {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

.player-main {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0; /* Prevents grid blowout */
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); /* Prevents grid blowout */
    gap: 40px;
    align-items: start;
    margin-top: 32px;
    
    /* Glassmorphic Background over Orbs */
    background: rgba(30, 30, 30, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 32px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .player-main {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
    .player-main {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        padding: 24px 16px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .vinyl-wrapper {
        max-width: 280px; /* Safe mobile limit */
        margin: 0 auto;
    }
}

/* Vinyl Player Physics & Layout */
.vinyl-wrapper {
    position: relative;
    width: 100%;
    max-width: 350px;
    aspect-ratio: 1;
    margin: 0 auto;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, #2a2a2a 0%, #111 80%, #000 100%);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4), inset 0 0 10px rgba(255,255,255,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.vinyl-record {
    width: 95%;
    height: 95%;
    border-radius: 50%;
    position: relative;
    background: #181818;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Grooves */
.vinyl-groove {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.03);
    width: 80%;
    height: 80%;
}
.groove-2 { width: 60%; height: 60%; }
.groove-3 { width: 40%; height: 40%; }

#albumArt {
    width: 38%;
    height: 38%;
    border-radius: 50%;
    object-fit: cover;
    z-index: 2;
    animation: rotateVinyl 4s linear infinite;
    animation-play-state: paused;
    box-shadow: 0 0 10px rgba(0,0,0,0.8);
    background-color: #333;
}

.vinyl-hole {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--bg-primary); /* matches background so it looks like a hole */
    border-radius: 50%;
    z-index: 3;
    box-shadow: inset 0 0 3px rgba(0,0,0,0.5);
    transition: background 0.3s ease;
}

@keyframes rotateVinyl {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.playing #albumArt {
    animation-play-state: running;
}

/* Tonearm */
.tonearm-container {
    position: absolute;
    top: 5%;
    right: 5%;
    width: 20px;
    height: 60%;
    z-index: 10;
}

.tonearm-pivot {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle at 30% 30%, #e5e7eb, #9ca3af, #4b5563);
    border-radius: 50%;
    position: absolute;
    top: -10px;
    right: -20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
}

.tonearm {
    position: absolute;
    top: 10px;
    right: -2px;
    width: 10px;
    height: 100%;
    transform-origin: top center;
    transform: rotate(0deg);
    transition: transform 0.6s cubic-bezier(0.3, 1.2, 0.2, 1); /* bouncy arm drop */
}

.playing .tonearm {
    transform: rotate(30deg); /* drops onto the record */
}

.tonearm-stick {
    position: absolute;
    top: 0;
    left: 2px;
    width: 6px;
    height: 100%;
    background: linear-gradient(90deg, #d1d5db, #f3f4f6, #9ca3af);
    border-radius: 3px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}

.tonearm-head {
    position: absolute;
    bottom: -15px;
    left: -5px;
    width: 16px;
    height: 28px;
    background: linear-gradient(135deg, #374151, #111827);
    border-radius: 3px;
    transform: rotate(20deg);
    box-shadow: 0 5px 10px rgba(0,0,0,0.6);
}

/* Needle tip */
.tonearm-head::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 7px;
    width: 2px;
    height: 5px;
    background: silver;
}

/* Controls */
.player-right-panel {
    display: flex;
    flex-direction: column;
}

.track-title {
    font-family: 'Minecraftia', monospace;
    font-size: 15px;
    line-height: 1.4;
    color: var(--accent-color);
    margin-bottom: 24px;
    word-break: break-word;
}

/* Progress bar */
.progress-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.time-label {
    font-family: 'Inter', monospace; 
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: center;
}

.progress-bar-container {
    flex-grow: 1;
    height: 6px;
    background-color: var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--link-color);
    width: 0%;
    pointer-events: none;
    transition: width 0.1s linear;
}

/* Hover effect for progress bar */
.progress-bar-container:hover .progress-fill {
    filter: brightness(1.2);
}

/* Buttons */
.controls-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
}

.control-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:focus, .control-btn:active {
    outline: none;
}

.progress-bar-container, .playlist-item, .theme-toggle {
    -webkit-tap-highlight-color: transparent;
}

.control-btn:hover {
    color: var(--link-color);
    background-color: rgba(255,255,255,0.05);
}

.play-pause-btn {
    width: 60px;
    height: 60px;
    background: var(--link-color);
    color: #fff;
    box-shadow: 0 4px 15px rgba(34, 211, 238, 0.3);
}

[data-theme="light"] .play-pause-btn {
    color: #ffffff;
}

.play-pause-btn:hover {
    background: var(--link-color);
    transform: scale(1.05);
    color: #fff;
}

/* Playlist */
.playlist-list {
    display: flex;
    flex-direction: column;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 8px;
    box-sizing: border-box;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: 4px;
}

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

[data-theme="light"] .playlist-item:hover {
    background-color: rgba(0,0,0,0.05);
}

.playlist-item.active {
    background-color: var(--nav-active-bg);
    border-left: 3px solid var(--link-color);
}

.playlist-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
}

.playlist-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0; 
}

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

.playlist-item.active .playlist-track-name {
    color: var(--link-color);
}

/* Webkit Scrollbar */
.playlist-list::-webkit-scrollbar {
    width: 4px;
}
.playlist-list::-webkit-scrollbar-track {
    background: transparent;
}
.playlist-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}
.playlist-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Ambient Moving Background Animations */
.ambient-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.4;
    animation: floatOrb 20s infinite ease-in-out alternate;
}

[data-theme="light"] .orb {
    opacity: 0.25;
}

.orb-1 {
    width: 350px;
    height: 350px;
    background: rgba(34, 211, 238, 0.4); /* Cyan */
    top: -5%;
    left: 10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 450px;
    height: 450px;
    background: rgba(168, 85, 247, 0.35); /* Purple */
    bottom: -10%;
    right: -5%;
    animation-duration: 25s;
    animation-delay: -5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: rgba(236, 72, 153, 0.3); /* Pink */
    top: 40%;
    left: 55%;
    animation-duration: 22s;
    animation-delay: -10s;
}

.orb-4 {
    width: 250px;
    height: 250px;
    background: rgba(59, 130, 246, 0.35); /* Blue */
    bottom: 25%;
    left: -5%;
    animation-duration: 28s;
    animation-delay: -2s;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -60px) scale(1.1); }
    66% { transform: translate(-30px, 30px) scale(0.9); }
    100% { transform: translate(50px, 50px) scale(1.05); }
}
