/* ==========================================
   OCOE Music - Modern CSS Design System
   ========================================== */

/* Design Tokens & Variables */
:root {
    --bg-dark: #0a0a14;
    --bg-card: rgba(18, 18, 32, 0.45);
    --bg-card-hover: rgba(26, 26, 46, 0.6);
    --border-glass: rgba(255, 255, 255, 0.07);
    --border-glass-focus: rgba(255, 255, 255, 0.15);
    
    --primary: #8a2be2;
    --primary-glow: rgba(138, 43, 226, 0.4);
    --secondary: #00f0ff;
    --secondary-glow: rgba(0, 240, 255, 0.3);
    
    --text-main: #f0f0f5;
    --text-muted: #8e8eaf;
    --text-active: #ffffff;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Background Glowing Blobs */
.bg-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.45;
    mix-blend-mode: screen;
    animation: blob-float 25s infinite alternate ease-in-out;
    will-change: transform;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -10%;
    left: -10%;
    animation-duration: 20s;
}

.blob-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
    bottom: -15%;
    right: -10%;
    animation-duration: 28s;
    animation-delay: -5s;
}

.blob-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #ff007f 0%, transparent 70%);
    top: 40%;
    left: 50%;
    animation-duration: 24s;
    animation-delay: -10s;
}

@keyframes blob-float {
    0% {
        transform: translate(0px, 0px) scale(1) rotate(0deg);
    }
    33% {
        transform: translate(50px, -40px) scale(1.1) rotate(120deg);
    }
    66% {
        transform: translate(-30px, 40px) scale(0.9) rotate(240deg);
    }
    100% {
        transform: translate(0px, 0px) scale(1) rotate(360deg);
    }
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* App Container Layout */
.app-container {
    position: relative;
    z-index: 1;
    width: 94vw;
    height: 90vh;
    max-width: 1400px;
    max-height: 850px;
    display: grid;
    grid-template-columns: 340px 1fr;
    background: var(--bg-card);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    transition: all var(--transition-normal);
}

/* Sidebar Styling */
.sidebar {
    background: rgba(8, 8, 16, 0.5);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand .logo {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.brand h1 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, #dcdcf0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Import Section */
.import-section {
    padding: 0 24px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.import-buttons {
    display: flex;
    gap: 10px;
}

.btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #a24bf5);
    color: white;
    border: none;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(138, 43, 226, 0.55);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-glass-focus);
}

.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
}

.drop-zone.dragover {
    border-color: var(--secondary);
    background: rgba(0, 240, 255, 0.05);
    color: var(--text-main);
    box-shadow: 0 0 12px var(--secondary-glow);
}

/* Playlist Header, Search & Stats */
.playlist-header {
    padding: 0 24px 10px 24px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--secondary);
    box-shadow: 0 0 8px var(--secondary-glow);
    color: var(--text-main);
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 0.85rem;
    width: 100%;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.playlist-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0 2px;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    transition: color var(--transition-fast);
}

.btn-text:hover {
    color: #ff4d4d;
}

.btn-text-sm {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 4px;
    color: var(--text-muted);
    padding: 2px 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-text-sm:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Playlist Container & Items */
.playlist-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px 16px 20px 24px;
}

.playlist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.playlist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    background: transparent;
    transition: all var(--transition-fast);
    position: relative;
    border: 1px solid transparent;
}

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

.playlist-item.active {
    background: rgba(138, 43, 226, 0.12);
    border-color: rgba(138, 43, 226, 0.25);
    box-shadow: inset 0 0 10px rgba(138, 43, 226, 0.05);
}

.playlist-item .track-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.playlist-item .track-index {
    font-size: 0.8rem;
    color: var(--text-muted);
    width: 20px;
    text-align: center;
}

/* Audio Wave Icon for active track */
.playlist-item.active .track-index {
    color: var(--secondary);
}

.wave-animation {
    display: none;
    align-items: flex-end;
    gap: 2.5px;
    width: 20px;
    height: 12px;
}

.playlist-item.active .wave-animation {
    display: inline-flex;
}

.playlist-item.active .track-index-num {
    display: none;
}

.wave-bar {
    width: 3px;
    height: 100%;
    background-color: var(--secondary);
    border-radius: 1px;
    animation: wave-bounce 1s ease-in-out infinite alternate;
}

.wave-bar:nth-child(2) {
    animation-delay: -0.3s;
}

.wave-bar:nth-child(3) {
    animation-delay: -0.6s;
}

@keyframes wave-bounce {
    0% { height: 20%; }
    100% { height: 100%; }
}

/* When paused, the wave bars stop moving */
.playlist-item.paused .wave-bar {
    animation-play-state: paused;
    height: 30%;
}

.playlist-item .track-meta {
    flex: 1;
    min-width: 0;
}

.playlist-item .track-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--transition-fast);
}

.playlist-item.active .track-title {
    color: white;
    font-weight: 600;
}

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

.playlist-item.active .track-artist {
    color: rgba(255, 255, 255, 0.6);
}

.playlist-item .track-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.playlist-item .track-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.playlist-item .btn-remove-track {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all var(--transition-fast);
}

.playlist-item:hover .btn-remove-track {
    opacity: 1;
}

.playlist-item .btn-remove-track:hover {
    color: #ff4d4d;
    background: rgba(255, 77, 77, 0.1);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 60px 20px;
    text-align: center;
    gap: 12px;
}

.empty-state p {
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Main Content Area */
.main-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(10, 10, 20, 0.2);
}

.top-bar {
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
}

.now-playing-info h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 450px;
}

.now-playing-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 450px;
}

.quick-settings {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Select wrapper */
.select-wrapper {
    position: relative;
}

.select-wrapper select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 8px 14px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 30px;
    transition: all var(--transition-fast);
}

.select-wrapper select:focus, .select-wrapper select:hover {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.select-wrapper::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-top-color: var(--text-muted);
    pointer-events: none;
}

.btn-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    border-radius: 10px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: var(--border-glass-focus);
}

.btn-icon.active {
    color: var(--secondary);
    background: rgba(0, 240, 255, 0.1);
    border-color: rgba(0, 240, 255, 0.25);
    box-shadow: 0 0 10px var(--secondary-glow);
}

/* Content Body (Vinyl & Lyrics) */
.content-body {
    flex: 1;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    padding: 32px;
    gap: 32px;
    overflow: hidden;
    align-items: center;
}

/* Vinyl & Visualizer container */
.visualizer-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    max-width: 380px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
}

#visualizer-canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

.vinyl-wrapper {
    position: relative;
    width: 70%;
    height: 70%;
    border-radius: 50%;
    z-index: 2;
    padding: 8px;
    background: rgba(0, 0, 0, 0.25);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-glass);
}

.vinyl-disc {
    position: relative;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #0e0e17 0%, #030305 60%, #0e0e17 62%, #08080c 100%);
    border-radius: 50%;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8), 0 0 20px rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: spin 20s linear infinite;
    animation-play-state: paused;
    will-change: transform;
}

.vinyl-disc.playing {
    animation-play-state: running;
}

.vinyl-grooves {
    position: absolute;
    width: 86%;
    height: 86%;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.03);
    pointer-events: none;
}

.vinyl-grooves::before {
    content: "";
    position: absolute;
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.vinyl-grooves::after {
    content: "";
    position: absolute;
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.025);
}

.vinyl-disc img {
    width: 44%;
    height: 44%;
    border-radius: 50%;
    object-fit: cover;
    z-index: 3;
    border: 4px solid #000;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    background-color: #2a2a3e;
}

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

/* Lyrics Section */
.lyrics-container {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    height: 100%;
    min-height: 280px;
    max-height: 380px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lyrics-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.1);
}

.lyrics-offset-ctrl {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lyrics-offset-ctrl span {
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--text-muted);
    width: 32px;
    text-align: center;
}

.lyrics-scroll-area {
    flex: 1;
    overflow-y: auto;
    position: relative;
    mask-image: linear-gradient(to bottom, transparent 0%, white 15%, white 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, white 15%, white 85%, transparent 100%);
    scroll-behavior: smooth;
    padding: 80px 20px;
}

.lyrics-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: center;
}

.lyric-line {
    font-size: 0.95rem;
    color: var(--text-muted);
    opacity: 0.45;
    padding: 4px 10px;
    line-height: 1.4;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-radius: 6px;
}

.lyric-line:hover {
    background: rgba(255, 255, 255, 0.03);
    opacity: 0.8;
    color: white;
}

.lyric-line.active {
    font-size: 1.15rem;
    font-weight: 600;
    color: white;
    opacity: 1;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.35);
    transform: scale(1.03);
}

.lyric-empty {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    padding: 40px 0;
}

/* Bottom Control Bar */
.player-controls {
    padding: 16px 32px 28px 32px;
    background: rgba(8, 8, 16, 0.45);
    border-top: 1px solid var(--border-glass);
}

/* Timeline */
.progress-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.time-display {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    width: 45px;
}

#time-current {
    text-align: right;
}

#time-duration {
    text-align: left;
}

/* Sliders */
.slider-container {
    flex: 1;
    position: relative;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.slider-container input[type="range"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.slider-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
    pointer-events: none;
    z-index: 5;
    transition: width 0.05s linear;
}

/* Hover effects for sliders */
.slider-container:hover {
    height: 7px;
}

.slider-container:hover .slider-progress {
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
}

/* Controls Action Bar */
.controls-action-bar {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    align-items: center;
}

/* Left side: mini album info */
.mini-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.mini-info img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-glass);
    background-color: #2a2a3e;
}

.mini-text {
    min-width: 0;
}

#mini-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

#mini-artist {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Center: player buttons */
.playback-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.btn-medium {
    width: 42px;
    height: 42px;
    border-radius: 50%;
}

.btn-large {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    color: white;
}

.btn-play {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    box-shadow: 0 4px 18px rgba(138, 43, 226, 0.5);
    color: white;
}

.btn-play:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 24px rgba(0, 240, 255, 0.6);
}

.btn-play svg {
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.15));
}

#btn-repeat {
    position: relative;
}

#repeat-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.6rem;
    font-weight: 800;
    background: var(--secondary);
    color: #000;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: none;
    justify-content: center;
    align-items: center;
}

/* Right side: Volume controls */
.volume-section {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: end;
    width: 130px;
}

.volume-slider-container {
    height: 4px;
}

/* Responsive Media Queries */
@media (max-width: 980px) {
    .app-container {
        grid-template-columns: 1fr;
        height: 96vh;
        max-height: none;
    }
    
    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
        height: 280px;
    }
    
    .content-body {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 20px;
        overflow-y: auto;
        align-items: center;
    }
    
    .visualizer-container {
        max-width: 240px;
        margin: 10px auto;
    }
    
    .lyrics-container {
        max-height: 200px;
        min-height: 150px;
    }
    
    .controls-action-bar {
        grid-template-columns: 1fr 1fr;
        row-gap: 12px;
    }
    
    .mini-info {
        grid-column: 1 / 3;
    }
    
    .playback-buttons {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .app-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: none;
    }
    
    .sidebar {
        height: 220px;
    }
    
    .brand {
        padding: 14px;
    }
    
    .import-section {
        padding: 0 14px 10px 14px;
    }
    
    .playlist-header {
        padding: 0 14px 8px 14px;
    }
    
    .playlist-container {
        padding: 8px 14px;
    }
    
    .top-bar {
        padding: 14px;
    }
    
    .now-playing-info h2 {
        max-width: 200px;
        font-size: 1.1rem;
    }
    
    .controls-action-bar {
        grid-template-columns: 1fr;
    }
    
    .mini-info {
        grid-column: 1 / 2;
    }
    
    .playback-buttons {
        justify-content: center;
        margin-top: 10px;
    }
    
    .volume-section {
        display: none; /* Hide volume on small mobiles to save space */
    }
}
