:root {
    --played-color: #d88b5e;
    --unplayed-color: #333333;
    --bg-color: #ffffff;
    --text-color: #ffffff;
}

.custom-wave-player {
    width: 100%;
    display: flex;
    justify-content: center;
}

.player-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 900px;
    padding: 20px;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

/* Play Button Styling */
.play-btn {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1.5px solid var(--unplayed-color);
    background: transparent;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.15s ease, opacity 0.3s ease;
}

.play-btn:hover:not(:disabled) {
    transform: scale(1.06); 
}

.play-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.play-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.play-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--unplayed-color);
    margin-left: 3px; 
}

.play-btn.playing svg {
    margin-left: 0; 
}

/* Waveform Wrapper */
.waveform-wrapper {
    flex-grow: 1;
    position: relative;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Actual Canvas Waveform */
.waveform {
    width: 100%;
    height: 60px;
    /* Start fully clipped out to the left */
    clip-path: inset(0 100% 0 0); 
    transition: clip-path 0.6s ease-in-out, opacity 0.3s ease;
    z-index: 2;
}

.player-container.ready .waveform {
    /* Wipe in to reveal the whole shape */
    clip-path: inset(0 0 0 0); 
}

/* Loading Animation Container */
.loading-wave {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1px; 
    overflow: hidden;
    /* Start fully visible */
    clip-path: inset(0 0 0 0);
    transition: clip-path 0.6s ease-in-out, opacity 0.3s ease; 
    pointer-events: none;
    z-index: 1;
}

.player-container.ready .loading-wave {
    /* Left edge wipes to the right, hiding it exactly as the real wave appears */
    clip-path: inset(0 0 0 100%); 
}

/* Error State */
.error-message {
    position: absolute;
    color: #ff6b6b;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 3;
}

.player-container.error .loading-wave,
.player-container.error .waveform {
    opacity: 0;
    pointer-events: none;
}

.player-container.error .error-message {
    opacity: 1;
}

/* Time Label */
.time-current {
    flex-shrink: 0;
    color: var(--unplayed-color);
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    min-width: 45px;
    text-align: right;
    transition: opacity 0.3s ease;
}

.player-container.error .time-current {
    opacity: 0.4;
}

/* =========================================
   LOADING ANIMATION OPTIONS
   ========================================= */

/* OPTION 1: The Equalizer (Active) */
.loading-bar {
    width: 2px;
    flex-shrink: 0;
    background-color: var(--unplayed-color);
    border-radius: 2px;
    height: 10px;
    opacity: 0.6;
    animation: equalizer 1.2s ease-in-out infinite alternate; 
}
@keyframes equalizer {
    0% { height: 10px; }
    33% { height: 45px; }
    66% { height: 20px; }
    100% { height: 55px; }
}