/* Custom Podcast Audio Player - Matching Design */

.custom-podcast-player {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 40px 0;
}

/* Logo/Image Section */
.player-logo {
    flex-shrink: 0;
    width: 150px;
    height: 150px;
}

.player-logo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Play Button + Waveform Main Container */
.player-main-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

/* Waveform Container */
.player-waveform-container {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
}

/* Play Button */
.player-play-button {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    background-color: transparent;
    background-image: url('../images/logo/play-button.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.player-play-button:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.player-play-button.playing {
    background-image: url('../images/logo/pause-button.png');
}

/* Title */
.player-title {
    font-size: 24px;
    font-weight: 600;
    color: #000;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-bottom: 2px;
    position: relative;
}

.player-title-inner {
    display: inline-block;
}

/* Scrolling animation when playing and text overflows */
.custom-podcast-player.is-playing .player-title.is-overflowing {
    text-overflow: clip;
}

.custom-podcast-player.is-playing .player-title.is-overflowing .player-title-inner {
    animation: scroll-text-loop linear infinite;
    will-change: transform;
    white-space: nowrap;
    /* Remove any default transforms */
    transform: translateX(0);
}

.custom-podcast-player.is-playing .player-title.is-overflowing .player-title-inner:hover {
    animation-play-state: paused;
}

@keyframes scroll-text-loop {
    0% {
        transform: translateX(0);
    }
    100% {
        /* Use the exact calculated distance */
        transform: translateX(var(--scroll-distance, -100px));
    }
}

/* Waveform - WaveSurfer Container */
.player-waveform {
    flex: 1;
    position: relative;
    min-height: 60px;
    background: #f5f5f5;
    border-radius: 4px;
    overflow: visible;
    cursor: pointer;
}

/* WaveSurfer canvas styling */
.player-waveform wave,
.player-waveform > div {
    width: 100% !important;
    min-height: 60px !important;
}

.player-waveform canvas {
    width: 100% !important;
    display: block !important;
}

/* Controls Row (Row 3) */
.player-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Skip Buttons Container */
.player-skip-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Skip Buttons */
.player-skip-button {
    width: 30px;
    height: 30px;
    background-color: transparent;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.player-skip-button:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.player-skip-button.skip-backward {
    background-image: url('../images/logo/arrow-rotate-left-15.svg');
}

.player-skip-button.skip-forward {
    background-image: url('../images/logo/arrow-rotate-right-30.svg');
}

/* Time Display */
.player-time {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    text-align: right;
}

.player-time .current-time {
    color: #000;
    font-weight: 600;
}

/* Hidden Audio Element */
.player-audio {
    display: none;
}

/* Responsive */

/* Tablet - iPad, etc */
@media (max-width: 1024px) {
    .player-logo {
        width: 120px;
        height: 120px;
    }
}

/* Mobile Landscape & Small Tablets */
@media (max-width: 768px) {
    .custom-podcast-player {
        gap: 15px;
        padding: 15px;
    }

    .player-logo {
        width: 100px;
        height: 100px;
    }

    .player-main-controls {
        flex-basis: 100%;
        order: 3;
    }

    .player-play-button {
        width: 50px;
        height: 50px;
    }

    .player-waveform-container {
        min-height: 70px;
    }

    .player-title {
        font-size: 13px;
    }
}

/* Mobile Portrait */
@media (max-width: 480px) {
    .custom-podcast-player {
        padding: 12px;
        gap: 12px;
    }

    .player-logo {
        width: 80px;
        height: 80px;
    }

    .player-play-button {
        width: 45px;
        height: 45px;
    }

    .player-title {
        font-size: 12px;
    }

    .player-time {
        font-size: 11px;
    }

    .player-skip-button {
        width: 25px;
        height: 25px;
    }

    .player-waveform-container {
        min-height: 65px;
    }
}
