/**
 * Eclecty Playlist Gallery - Styles
 * YouTube playlist gallery with native scrolling
 *
 * @package Eclecty\PlaylistGallery
 */

/*------------------------------------------------------------------
[Playlist Gallery Wrapper]
*/
.hero-with-playlist {
  margin-top: 10px;
  padding: 30px 0;
  background: #000;
  color: #fff;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  padding-left: calc(50vw - 50%);
  padding-right: calc(50vw - 50%);
  box-sizing: border-box;
  border-radius: 10px;
}

/* Remove padding-top from single-content for design 22 */
.hero-52 ~ .single-content {
  padding-top: 0;
}

.hero-with-playlist .playlist-gallery-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
  aspect-ratio: unset;
}

.media-wrap.md-22.playlist-gallery-wrap {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 20px;
}

/*------------------------------------------------------------------
[Error Messages]
*/
.md-22 .playlist-error {
  padding: 20px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  color: #856404;
  margin-bottom: 20px;
}

.md-22 .playlist-error-quota {
  background: #f8d7da;
  border-color: #dc3545;
  color: #721c24;
}

.md-22 .playlist-error p {
  margin: 0 0 10px 0;
}

.md-22 .playlist-error p:last-child {
  margin-bottom: 0;
}

/*------------------------------------------------------------------
[Main Player]
*/
.md-22 .playlist-main-player {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.md-22 .playlist-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  margin-bottom: 12px;
}

.md-22 .playlist-player-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgb(0 0 0 / 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.md-22 .playlist-player-loader.hidden {
  display: none;
}

.md-22 .playlist-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/*------------------------------------------------------------------
[Controls]
*/
.md-22 .playlist-controls {
  display: flex;
  align-items: center;
  padding: 0;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.hero-with-playlist:hover .md-22 .playlist-controls {
  opacity: 1;
  pointer-events: auto;
}

.md-22 .playlist-control {
  flex: 0 0 2%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: rgb(255 255 255 / 0.7);
  cursor: pointer;
  padding: 5px;
  transition: color 0.2s ease;
}

.md-22 .playlist-control:hover {
  color: #fff;
}

.md-22 .playlist-control:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.md-22 .playlist-control i {
  font-size: 20px;
}

.md-22 .playlist-control--prev {
  justify-content: flex-start;
}

.md-22 .playlist-control--next {
  justify-content: flex-end;
}

.md-22 .playlist-current-title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
}

/*------------------------------------------------------------------
[Slider Wrapper]
*/
.md-22 .playlist-slider-wrap {
  position: relative;
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: rgb(255 255 255 / 0.05);
  border-radius: 8px;
}

.md-22 .playlist-header {
  padding: 12px 15px;
  border-bottom: 1px dashed rgb(255 255 255 / 0.1);
  flex-shrink: 0;
  max-height: 45px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.md-22 .playlist-header__count {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  opacity: 0.8;
}

.md-22 .playlist-header__title {
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  opacity: 0.9;
  text-align: right;
  flex: 1;
  margin-left: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*------------------------------------------------------------------
[Gallery]
*/
.md-22 .playlist-gallery {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.md-22 .playlist-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgb(0 0 0 / 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.md-22 .playlist-loader.active {
  display: flex;
}

.md-22 .playlist-viewport {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 398px;
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / 0.3) transparent;
}

.md-22 .playlist-viewport::-webkit-scrollbar {
  width: 6px;
}

.md-22 .playlist-viewport::-webkit-scrollbar-track {
  background: transparent;
}

.md-22 .playlist-viewport::-webkit-scrollbar-thumb {
  background: rgb(255 255 255 / 0.3);
  border-radius: 3px;
}

.md-22 .playlist-viewport::-webkit-scrollbar-thumb:hover {
  background: rgb(255 255 255 / 0.5);
}

.md-22 .playlist-scroll-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 10px;
}

/*------------------------------------------------------------------
[Playlist Items]
*/
.md-22 .playlist-item {
  position: relative;
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.md-22 .playlist-item:hover {
  opacity: 0.8;
}

.md-22 .playlist-item.playing .playlist-item__thumb::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 1px dashed #ff0000;
  pointer-events: none;
}

.md-22 .playlist-item__thumb {
  position: relative;
  width: 120px;
  flex-shrink: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.md-22 .playlist-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.md-22 .playlist-item__playing {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #fc0032;
  color: #000;
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.4;
  display: none;
}

.md-22 .playlist-item.playing .playlist-item__playing {
  display: block;
}

.md-22 .playlist-item.playing .playlist-item__title {
  color: #fc0032;
}

.md-22 .playlist-item__title {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  line-height: 1.3;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/*------------------------------------------------------------------
[Footer]
*/
.md-22 .playlist-footer {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  min-height: 45px;
  flex-shrink: 0;
  border-top: 1px dashed rgb(255 255 255 / 0.1);
  position: relative;
}

.md-22 .playlist-footer .playlist-load-more-btn,
.md-22 .playlist-footer .playlist-link-msg {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.md-22 .playlist-footer .playlist-counter {
  margin-left: auto;
}

.md-22 .playlist-load-more {
  display: none;
  padding: 10px 0;
  text-align: center;
  flex-shrink: 0;
}

.md-22 .playlist-load-more.visible {
  display: block;
}

.md-22 .playlist-counter {
  font-size: 11px;
  color: rgb(255 255 255 / 0.6);
}

.md-22 .playlist-load-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: rgb(255 255 255 / 0.1);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
  width: 28px;
  height: 28px;
}

.md-22 .playlist-load-more-btn i {
  font-size: 14px;
  line-height: 1;
}

.md-22 .playlist-load-more-btn:hover {
  background: rgb(255 255 255 / 0.2);
}

.md-22 .playlist-load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.md-22 .playlist-load-more-btn.loading {
  opacity: 0.7;
  cursor: wait;
}

.md-22 .playlist-link-msg {
  font-size: 11px;
  color: rgb(255 255 255 / 0.6);
  text-decoration: none;
}

.md-22 .playlist-link-msg:hover {
  color: #fff;
  text-decoration: underline;
}

/*------------------------------------------------------------------
[Article content below playlist]
*/
.hero-playlist-content {
  margin-bottom: 30px;
}

.hero-playlist-content .entry-content {
  max-width: 800px;
}

/*------------------------------------------------------------------
[Spinner]
*/
.tipi-spin {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: tipi-spin 0.8s linear infinite;
}

@keyframes tipi-spin {
  to {
    transform: rotate(360deg);
  }
}

/*------------------------------------------------------------------
[Responsive - Tablet]
*/
@media (max-width: 991px) {
  .media-wrap.md-22.playlist-gallery-wrap {
    flex-direction: column;
  }
  
  .md-22 .playlist-main-player {
    width: 100%;
  }
  
  .md-22 .playlist-player {
    width: 100%;
    aspect-ratio: 16 / 9;
  }
  
  .md-22 .playlist-slider-wrap {
    width: 100%;
    max-height: 350px;
  }
  
  .md-22 .playlist-viewport {
    max-height: 280px;
  }
  
  .md-22 .playlist-controls {
    padding: 10px 15px;
  }
  
  .md-22 .playlist-current-title {
    font-size: 13px;
  }
}

/*------------------------------------------------------------------
[Responsive - Mobile]
*/
@media (max-width: 768px) {
  .media-wrap.md-22.playlist-gallery-wrap {
    gap: 0;
  }
  
  .md-22 .playlist-slider-wrap {
    max-height: 360px;
  }
  
  .md-22 .playlist-viewport {
    max-height: 360px;
  }
  
  .md-22 .playlist-item__thumb {
    width: 100px;
  }
  
  .md-22 .playlist-item__title {
    font-size: 11px;
  }
  
  .md-22 .playlist-controls {
    display: none;
  }
  
  .md-22 .playlist-current-title {
    font-size: 12px;
  }
  
  .md-22 .playlist-control i {
    font-size: 14px;
  }
  
  .hero-with-playlist {
    margin-top: 0;
    padding: 15px !important;
  }
}
