/* --- CSS Variables for Wooklo Branding --- */
:root {
    --primary-orange: #FF6600;
    --primary-orange-hover: #e55c00;
    --secondary-yellow: #FFCC00;
    --white: #ffffff;
    --bg-color: #f7f8fa;
    --text-dark: #333333;
    --text-light: #777777;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Header --- */
.header {
    background-color: var(--white);
    padding: 40px 0;
    text-align: center;
    border-bottom: 4px solid var(--primary-orange);
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.logo span {
    color: var(--primary-orange);
}

.tagline {
    color: var(--text-light);
    margin-top: 10px;
    font-size: 1.1rem;
}

/* --- Player Container --- */
.player-container {
    background-color: var(--white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
    border-top: 4px solid var(--secondary-yellow);
}

.player-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.lang-badge {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 6px;
    color: var(--text-dark);
}

.yellow-badge {
    background-color: var(--secondary-yellow);
}
.orange-badge {
    background-color: var(--primary-orange);
    color: var(--white);
}

.track-title {
    font-size: 1.4rem;
    font-weight: 700;
}

/* --- Progress Bar --- */
.progress-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    width: 100%;
}

.progress-container span {
    font-size: 0.9rem;
    color: var(--text-light);
    min-width: 45px;
    text-align: center;
}

/* Wrapper to stack the visualizer and the slider */
.waveform-wrapper {
    position: relative;
    flex-grow: 1;
    height: 60px; /* Height of the visualizer */
    display: flex;
    align-items: center;
}

#waveform-canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none; /* Allows mouse clicks to pass through to the slider */
}

/* Make the slider invisible, but it still perfectly tracks mouse clicks & drags */
#progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    opacity: 0;
    cursor: pointer;
    margin: 0;
}

input[type="range"] {
    flex-grow: 1;
    cursor: pointer;
    accent-color: var(--primary-orange); /* Modern CSS standard for range sliders */
    height: 6px;
    border-radius: 5px;
}

/* --- Controls --- */
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.control-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

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

.control-btn:hover {
    color: var(--primary-orange);
}

.play-btn {
    background-color: var(--primary-orange);
    color: var(--white);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(255, 102, 0, 0.3);
    transition: background-color 0.3s, transform 0.2s;
}

.play-btn:hover {
    background-color: var(--primary-orange-hover);
    color: var(--white);
    transform: scale(1.05);
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.volume-container input[type="range"] {
    width: 100px;
}

/* --- Playlist --- */
.playlist-section h3 {
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: var(--text-dark);
}

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

.playlist-item {
    background-color: var(--white);
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: transform 0.2s, border 0.2s;
    border: 2px solid transparent;
}

.playlist-item:hover {
    transform: translateY(-2px);
    border-color: var(--secondary-yellow);
}

.playlist-item.active {
    border-color: var(--primary-orange);
    background-color: rgba(255, 102, 0, 0.05);
}

.playlist-item-title {
    flex-grow: 1;
    font-weight: 500;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* --- Responsive Adjustments --- */
@media (max-width: 600px) {
    .controls {
        flex-direction: column;
    }
    .volume-container {
        margin-left: 0;
        margin-top: 15px;
    }
    .track-title {
        font-size: 1.1rem;
    }
    .player-header {
        align-items: flex-start;
    }
}

/* --- Animated Equalizer Waves --- */
.eq-bars {
    display: none; /* Hidden by default, appears when playing */
    align-items: flex-end;
    gap: 3px;
    height: 18px;
    margin-left: auto; /* Pushes the waves to the far right */
}

.eq-bars.is-playing {
    display: flex;
}

.eq-bar {
    width: 4px;
    background-color: var(--primary-orange);
    border-radius: 2px;
    animation: eq 0.8s ease-in-out infinite alternate;
}

/* Delay each bar slightly so they jump randomly */
.eq-bar:nth-child(1) { animation-delay: 0.0s; height: 8px; }
.eq-bar:nth-child(2) { animation-delay: 0.2s; height: 16px; }
.eq-bar:nth-child(3) { animation-delay: 0.1s; height: 12px; }
.eq-bar:nth-child(4) { animation-delay: 0.3s; height: 10px; }

@keyframes eq {
    from { transform: scaleY(0.4); }
    to   { transform: scaleY(1); }
}

/* --- Smooth Moving Thumb for Visualizer --- */
.progress-thumb {
    position: absolute; 
    top: 0; 
    bottom: 0; 
    width: 2px;
    background: var(--primary-orange); 
    border-radius: 2px;
    pointer-events: none; /* Allows clicks to pass through to slider */
    transition: left 0.05s linear;
    z-index: 1;
    box-shadow: 0 0 8px rgba(255, 102, 0, 0.6);
}

.progress-thumb::before {
    content: ''; 
    position: absolute;
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%);
    width: 12px; 
    height: 12px; 
    border-radius: 50%;
    background: var(--primary-orange); 
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.2);
}