/* Spinning cover */
.spinning-cover {
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  transition: none!important;
  margin: 0 auto;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.single-audio-player-ui .player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.single-audio-player-ui .player-controls .spinning-cover {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

/* Single podcast */

.podcast-main-cover {
  display: inline-block;
  width: 100%;
  position: relative;
  float: left;
}
.podcast-main-cover:has(img) .global-playlist-controls {
  position: absolute;
  bottom: 0;
  left: 0;
}
button#global-playlist-control-btn {
  display: flex;
  height: 60px;
  align-items: center;
  justify-content: center;
  border: none;
}
span.pause-icon,
span.play-icon {
  justify-content: center;
  align-items: center;
}


.podcast-episodes-container {
  display: inline-block;
  width: 100%;
  float: left;
  background-color: #282828;
  color: #fff;
  border-radius: 0 0 8px 8px;
}
.podcast-episodes-container .episode-thumbnail.spinning-cover {
    display: inline-block;
    width: 60px;
    height: 60px;
    padding: 0;
    margin: 0;
}
.podcast-episodes-container .episode-details {
    display: flex;
    gap: 20px;
    flex-grow: 1;
    justify-content: center;
    align-items: center;
}
.podcast-episodes-container .episode-info p {
  margin: 0;
  padding: 0;
}
.podcast-episodes-container .episode-info {
    margin-right: auto;
}
.podcast-episodes-container .episode-info p.episode-title {
    font-weight: bold;
}
.podcast-episode-item {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 15px;
  border-bottom: 1px solid #434343;
}
.podcast-episode-item:last-of-type {
  border-bottom: none;
}
.podcast-episodes-container button.play-episode-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
}
.podcast-episodes-container button.play-episode-button span {
  width: 50px;
  height: 50px;
}
/* Single podcast END*/

/* Global Player Container */
#global-audio-player {
    background-color: #282828;
    color: #fff;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
    z-index: 9999;
    border-top: 1px solid #333;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#global-audio-player.is-active {
    opacity: 1;
    visibility: visible;
}
#global-audio-player .spinning-cover {
    width: 50px;
    height: 50px;
}
#global-audio-player .player-info #player-current-title {
  font-weight: bold;
}
#global-audio-player .player-controls .control-play,
#global-audio-player .player-controls .control-pause {
  display: inline-block;
  width: 40px;
  height: 40px;
  background-size: 30px;
  background-repeat: no-repeat;
  background-position: 50% 50%;
}
#global-audio-player .player-controls .control-next,
#global-audio-player .player-controls .control-prev {
  display: inline-block;
  width: 40px;
  height: 40px;
  background-size: 20px;
  background-repeat: no-repeat;
  background-position: 50% 50%;
}
#global-audio-player .player-controls .control-prev {
  background-image: url(../img/prev.svg);
}
#global-audio-player .player-controls .control-next {
  background-image: url(../img/next.svg);
}

#global-audio-player .player-controls .control-play {
  background-image: url(../img/play_btn.svg);
}
#global-audio-player .player-controls .control-pause {
  background-image: url(../img/pause_btn.svg);
}
#global-audio-player .volume-icon,
#global-audio-player .player-volume-control {
  display: flex;
}

/* Player Cover Image */
.player-cover {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
}
.player-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Player Info (Title and Artist) */
.player-info {
    flex-grow: 1;
    min-width: 0;
}
.player-info h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}
.player-info p {
    margin: 0;
    font-size: 0.9em;
    color: #b3b3b3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Player Controls (Buttons) */
.player-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.control-play-pause:hover,
.player-btn:hover {
    color: #cfcfcf!important;
    transform: scale(1.4);
}
.player-btn:active {
    transform: scale(0.95);
}

/* Progress Bar */
.player-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 2;
    min-width: 250px;
}

.player-progress-bar {
    background: #404040;
    height: 8px;
    border-radius: 4px;
    flex-grow: 1;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.player-progress-fill {
    height: 100%;
    width: 0%;
    background: #cfcfcf;
    border-radius: 3px;
    transition: width 0.1s linear;
}
.player-time-current,
.player-time-duration {
    font-size: 0.90em;
    color: #b3b3b3;
    font-variant-numeric: tabular-nums;
}


/* Responsive adjustments (example) */
@media (max-width: 768px) {
    #global-audio-player {
        flex-wrap: wrap;
        justify-content: center;
        padding: 10px;
        gap: 10px;
    }
    .player-cover {
        margin-right: 0;
    }
}

#global-audio-player {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#global-audio-player.is-active {
    opacity: 1;
    visibility: visible;
}

/* Single Audio Player Container */
.single-audio-player-ui {
    background-color: #282828;
    color: #fff;
    padding: 25px;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    gap: 20px;
}
.audio-wrapper:has(.audio-cover img) .single-audio-player-ui,
.podcast-list-wrapper:has(.podcast-archive-cover img) .single-audio-player-ui {
  border-radius: 0 0 8px 8px;
}

button.control-play-pause,
button.player-btn {
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}


/* Player Info (Title and Artist) for single player */
.single-audio-player-ui .player-info {
    text-align: center;
    margin-bottom: 5px;
}
.single-audio-player-ui .player-info .player-current-title {
    font-size: 1.3em;
    margin-bottom: 5px;
}
.single-audio-player-ui .player-info .player-current-artist {
    font-size: 1em;
}

/* Player Controls (Buttons, Progress, Volume) for single player */
.single-audio-player-ui .player-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 15px;
}

/* Blinking animation */
@keyframes blink-animation {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
.play-icon,
.pause-icon {
    display: none;
}
#player-play-pause-btn.control-play .play-icon,
.play-episode-button .play-icon,
.single-audio-player-ui .control-play-pause .play-icon,
#global-playlist-control-btn .play-icon,
#player-play-pause-btn.control-pause .pause-icon,
.play-episode-button.is-playing .pause-icon,
.single-audio-player-ui .control-play-pause.control-pause .pause-icon,
#global-playlist-control-btn .pause-icon {
    display: flex;
}

/* --- Blinking (applied when paused) --- */
#player-play-pause-btn.control-play.is-paused-blinking .pause-icon {
    display: block;
    animation: blink-animation 2s infinite alternate;
}
#player-play-pause-btn.control-play.is-paused-blinking .play-icon {
    display: none;
}
.podcast-episode-item .play-episode-button.is-paused-blinking .pause-icon {
    display: block;
    animation: blink-animation 2s infinite alternate;
}
.podcast-episode-item .play-episode-button.is-paused-blinking .play-icon {
    display: none;
}
.single-audio-player-ui .control-play-pause.control-play.is-paused-blinking .pause-icon {
    display: block;
    animation: blink-animation 2s infinite alternate;
}

.single-audio-player-ui .control-play-pause.control-pause .play-icon,
.single-audio-player-ui .control-play-pause.control-play.is-paused-blinking .play-icon {
    display: none;
}
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
.episode-thumbnail.spinning-cover {
    border-radius: 50%;
    overflow: hidden;
}
.episode-thumbnail.spinning-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

#player-volume-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: transparent;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
    border-radius: 5px;
    border: none;
    /* Custom property for track fill percentage */
    --slider-fill-percent: 0%;
}

#player-volume-slider:hover {
    opacity: 1;
}

/* Thumb styling for WebKit (Chrome, Safari, Edge) */
#player-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #cfcfcf;
    cursor: pointer;
    margin-top: -4px;
    box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
}

/* Thumb styling for Firefox */
#player-volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #cfcfcf;
    cursor: pointer;
    border: none;
}

/* Thumb styling for Internet Explorer */
#player-volume-slider::-ms-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #cfcfcf;
    cursor: pointer;
}

/* Track styling for WebKit */
#player-volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    background: linear-gradient(to right, #cfcfcf var(--slider-fill-percent), #404040 var(--slider-fill-percent));
    border-radius: 5px;
    border: none;
    box-shadow: none;
}

/* Track styling for Firefox */
#player-volume-slider::-moz-range-track {
    width: 100%;
    height: 8px;
    background: linear-gradient(to right, #cfcfcf var(--slider-fill-percent), #404040 var(--slider-fill-percent));
    border-radius: 5px;
}

/* Track styling for Internet Explorer */
#player-volume-slider::-ms-track {
    width: 100%;
    height: 8px;
    background: transparent;
    border-color: transparent;
    border-width: 6px 0;
    color: transparent;
}

#player-volume-slider::-ms-fill-lower {
    background: #cfcfcf;
    border-radius: 5px;
}

#player-volume-slider::-ms-fill-upper {
    background: #404040;
    border-radius: 5px;
}

@media (max-width: 500px) {
  .player-volume-control {
    display: none!important;
  }
}
