/* === Reset & Base === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Kanit", sans-serif;  /* Normalize Kanit font everywhere */
}

body {
  background-color: #121212;
  color: #eaeaea;
  overflow-x: hidden;
  line-height: 1.6;
}

#toggleStylesheetImage {
  cursor:pointer;
  width:50px;
  height:50px;
}

/* === Scrollbar Styling === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}
::-webkit-scrollbar-track {
  background: #1a1a1a;
}

/* === Container === */
.container, .episode-container {
  overflow: visible;
}
.container {
  max-width: auto;
  margin: auto;
  padding: 20px;
}

/* === Header === */
header {
  text-align: center;
  margin-bottom: 30px;
}
header h1 {
  font-size: 2.5rem;
  font-weight: 300;
  color: white;
}
header img {
  vertical-align: middle;
}

/* === Search === */
.search-box {
  display: flex;
  justify-content: center;
  margin-top: 15px;
}
.search-box input {
  background-color: #333;
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  width: 80%;
  max-width: 500px;
  font-size: 1rem;
}


/* === Category Banners === */
#categoryContainer {
  display: flex;
  justify-content: center;

  margin-bottom: 40px;
}
.movie-item-banner {
  transition: 0.3s;
  flex: 0 1 auto;
  width: 20%;
  height: 20%;
  text-align: center;
  cursor: pointer;
  margin: 5px;
}
.movie-item-banner:hover {
  transform: scale(1.05);
}
.movie-item-banner img {
  width: 100%;
  border-radius: 10px;
}
.movie-item-banner p {
  margin-top: 10px;
  font-size: 1rem;
  font-weight: 300;
}

/* === Movie List === */
.movie-list-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 0;
  margin-bottom: 10px;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 2;
}
.movie-list-wrapper::-webkit-scrollbar {
  height: 8px;
}
.movie-list-wrapper::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}
.movie-list-wrapper::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.movie-list {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 14px;
  padding: 5px 10px;
}

.movie-item {
  flex: 0 0 auto;
  width: 130px;
  height: 190px;
  background-color: #1f1f1f;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.3s ease;
  scroll-snap-align: start;
}
.movie-item:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}
.movie-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  transition: opacity 0.3s ease;
}
.movie-item p {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.65);
  font-size: 0.85rem;
  font-weight: 300;
  color: #eee;
  text-align: center;
  padding: 6px 4px;
  border-radius: 0 0 12px 12px;
  backdrop-filter: blur(3px);
}

/* === Seasons Dropdown === */
.seasons-dropdown {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding: 8px 12px;
  background: #222;
  border-radius: 8px;
  max-width: 100%;
  scrollbar-width: thin;
}
.seasons-dropdown button {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: #333;
  color: #eee;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.seasons-dropdown button.active {
  background: #555;
}
.seasons-dropdown button:hover {
  background: #444;
}

/* === Episode Container === */
.episode-container {
  display: flex;
  gap: 20px;
  margin-top: 45px;
  align-items: stretch; /* This is the key */
}
.sidebar {
  flex: 0 0 250px;
  overflow-y: auto;
  background: #2b2b2b;
  padding: 10px;
  border-radius: 10px;

  /* Remove max-height if you want it to match .player */
  max-height: none;
}
.episode {
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 10px;
  background: #1a1a1a;
  cursor: pointer;
  transition: all 0.3s ease;
}
.episode:hover {
  transform: scale(1.03);
  background-color: #3b3b3b;
}
.episode.active {
  background: #444;
}

/* === Player Container === */
.player {
  flex: 1;
  background: #000;
  border-radius: 10px;
  padding: 15px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  z-index: 1;
}

/* === Video Frame === */
iframe#videoPlayer {
  width: 100%;
  height: 65vh;
  max-height: 600px;
  border: none;
  border-radius: 10px;
  background-color: #000;
  transition: opacity 0.3s ease;
}

/* === Spinner While Loading === */
.spinner {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border: 6px solid #555;
  border-top-color: #ccc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none;
  z-index: 10;
}

/* === Controls === */
.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 20px;
  z-index: 1;
}

/* === Button Styles === */
.button {
  padding: 10px 20px;
  border-radius: 25px;
  background: linear-gradient(145deg, #2b2b2b, #1e1e1e);
  color: #eaeaea;
  font-size: 1rem;
  text-decoration: none;
  border: none;
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  /* font-family removed here since * covers it */
}
.button:hover {
  background: #3a3a3a;
  transform: translateY(-2px);
}

/* === Toggle Dubbed Button (Active State) === */
.button.dubbed-toggle.active {
  background: #666;
  color: white;
  font-weight: bold;
}

/* === Download Container === */
#downloadContainer {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 15px;
  width: 100%;
}

/* === Changelog === */
.changelog-container {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 15px;
  max-height: 250px;
  overflow-y: auto;
  width: 100%;
  margin-top: 40px;
}
.changelog-box {
  background: #2a2a2a;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.changelog-box h3 {
  color: #fff;
  font-weight: 500;
  margin-bottom: 5px;
}
.changelog-box p {
  color: #ccc;
  font-size: 0.9rem;
}

/* === Fade Effect === */
.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.fade-transition {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.fade-transition.show {
  opacity: 1;
}

/* === Animations === */
@keyframes spin {
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.section-animate {
  animation: fadeInUp 0.6s ease forwards;
}

/* === Responsive === */
@media (max-width: 768px) {
  .episode-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex: unset;
  }
  .player {
    padding: 10px;
  }
  iframe#videoPlayer {
    height: 50vh;
  }
  .controls {
    flex-direction: column;
    gap: 8px;
  }
  .button {
    width: 100%;
    text-align: center;
  }
}

/* === Misc === */
html {
  scroll-behavior: smooth;
}
p, span, label, button, input, textarea, div, h1, h2, h3, h4, h5, h6 {
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

/* === Season Selector === */
#seasonSelector {
  background: #1a1a1a;
  color: #eaeaea;
  font-weight: 300;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  width: 100%;
  font-size: 1rem;
  box-sizing: border-box;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
#seasonSelector:hover,
#seasonSelector:focus {
  background-color: #333;
  outline: none;
  transform: scale(1.02);
}
.episode-container {
  max-height: 600px;
  align-items: stretch;
}
.sidebar, .player {
  max-height: 600px;
}
