/* Reset and Base Styles */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  font-family: "Onest", sans-serif;
  background: url("https://wallpapercave.com/wp/wp15109547.webp")
    no-repeat center center fixed;
  background-size: cover;
  color: white;
  overflow-x: hidden;
  scroll-behavior: smooth;
  position: relative;
  z-index: 0;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: -1;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid #333;
  backdrop-filter: blur(18px);
}

header .logo {
  font-size: 1.2rem;
  font-weight: bold;
}

.search-container {
  display: flex;
  align-items: center;
}

.search-bar {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  font-weight: 700;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  width: 200px;
  backdrop-filter: blur(18px);
}

.search-bar::placeholder {
  color: #aaa;
}

.search-bar:focus {
  outline: none;
  border: 1px solid #ffb800;
}

/* Content */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}

/* Player Section */
#playerContainer {
  width: 100%;
  max-width: 968px;
  margin: 2rem auto;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 10;
}

.player-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shineOverlay 4s infinite linear;
  pointer-events: none;
  z-index: 11;
}

@keyframes shineOverlay {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.channel-info {
  text-align: center;
  margin-top: 1rem;
}

.channel-number {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 2px 6px;
  font-size: 1rem;
  border-radius: 100%;
  font-weight: 700;
}

#channelOverlay {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 20px 40px;
  font-size: 28px;
  font-weight: bold;
  border-radius: 10px;
  font-family: 'Onest', sans-serif;
  z-index: 9999;
  display: none;
  box-shadow: 0 0 20px #000;
}

/* Playlist */
.playlist {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
  max-width: 150vw;
  gap: 1rem;
  background-color: transparent;
  flex-wrap: nowrap;
}

.playlist-item {
  position: relative;
  flex: 0 0 auto;
  width: 120px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(8px);
  transition: transform 0.3s;
  scroll-snap-align: start;
}

.playlist-item:hover {
  transform: scale(1.05);
}

.playlist-item img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
  display: block;
  position: relative;
  z-index: 2;
}

.playlist-item:hover::after {
  content: attr(data-name);
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  padding: 5px 10px;
  white-space: nowrap;
  font-size: 12px;
}

.playlist-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: -200%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmerFade 6s infinite ease-in-out;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

@keyframes shimmerFade {
  0% {
    left: -200%;
    opacity: 0;
  }
  20% {
    opacity: 0.5;
  }
  50% {
    left: 100%;
    opacity: 0.65;
  }
  80% {
    opacity: 0.5;
  }
  100% {
    left: 200%;
    opacity: 0;
  }
}

.playlist-item.active {
  border: 2px solid #e50914;
  box-shadow: 0 0 10px rgba(229, 9, 20, 0.5);
}

.playlist-item.active img {
  filter: brightness(1.2);
}

.playlist-item.active::before {
  background: linear-gradient(
    120deg,
    rgba(229, 9, 20, 0.2) 0%,
    rgba(229, 9, 20, 0.5) 50%,
    rgba(229, 9, 20, 0.2) 100%
  );
  opacity: 1;
}

.playlist-item.active:hover::after {
  background: rgba(229, 9, 20, 0.8);
  color: white;
}

.playlist-item.active:hover img {
  filter: brightness(1.4);
}

.playlist-item.active::after {
  background: linear-gradient(
    120deg,
    rgba(229, 9, 20, 0.8) 0%,
    rgba(229, 9, 20, 1) 50%,
    rgba(229, 9, 20, 0.8) 100%
  );
}

/* Footer and Watermark */
.footer {
	text-align: center;
	color: whitesmoke;
	padding: 1rem;
	font-size: 0.7rem;
	background: rgba(255, 255, 255, 0.05);
	backdrop-filter: blur(6px);
	z-index: 900;
}

.watermark {
  position: fixed;
  bottom: 4px;
  right: 12px;
  font-size: 10px;
  color: #ccc;
  opacity: 0.6;
  pointer-events: none;
  z-index: 9999;
}

/* Responsive */
@media screen and (max-width: 768px) {
  header .logo {
    font-size: 1.0rem;
  }
  .search-bar {
    width: 140px;
    font-size: 12px;
  }
  #playerContainer {
    max-height: 320px;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
  }
  .playlist {
    padding: 1rem 0.5rem;
  }
  .playlist-item {
    width: 120px;
    height: 120px;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 15px;
  height: 15px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0.25) 100%
  );
  border-radius: 10px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  background-size: 200% 100%;
  animation: shimmer-scrollbar 2s infinite linear;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0.35) 100%
  );
  background-size: 200% 100%;
}

@keyframes shimmer-scrollbar {
  0% {
    background-position: -100% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.2);
}
