:root {
  --bg-color: #f5f5fa;
  --text-primary: #121212;
  --text-secondary: #666;
  --accent-color: #000;
  --card-bg: #fff;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.12);
  --radius-lg: 24px;
  --radius-md: 16px;
  --font-main: "Segoe UI", Inter, system-ui, sans-serif;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
}

header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 15px 40px;
  position: sticky;
  top: 0;
  background: rgba(245, 245, 250, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.logo-text {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
  justify-self: start;
  white-space: nowrap;
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-self: center;
}

.nav-home {
  color: var(--text-primary);
  text-decoration: none;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
}
.nav-home:hover {
  transform: scale(1.1);
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
  white-space: nowrap;
}
.nav-link:hover {
  color: var(--text-primary);
}

.search-bar {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 30px;
  padding: 5px 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  justify-self: end;
}

.search-form {
  display: flex;
  align-items: center;
}
.search-form input {
  border: none;
  outline: none;
  padding: 5px;
  font-size: 0.9rem;
  width: 150px;
  background: transparent;
}
.search-form button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.hero-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px 0;
  position: relative;
  width: 100%;
  min-height: 0;
}

.gallery-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 20px;
}

.movie-gallery {
  display: flex;
  align-items: center;
  gap: 15px;
  overflow-x: auto;
  padding: 40px 20px;
  scroll-behavior: smooth;
  scrollbar-width: none;
  width: auto;
  max-width: 100%;
  cursor: grab;
  justify-content: center;
  margin: 0 auto;
}

.movie-gallery::-webkit-scrollbar {
  display: none;
}
.movie-gallery.active {
  cursor: grabbing;
  scroll-behavior: auto;
}

.movie-card {
  position: relative;
  width: 180px;
  min-width: 180px;
  height: 320px;
  border-radius: 18px;
  background: #ccc;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  user-select: none;
  display: block;
}

.movie-card.disabled {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.7;
}

.movie-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.card-info {
  position: absolute;
  bottom: 15px;
  left: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(5px);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transform: translateY(15px);
  opacity: 0;
  transition: all 0.3s;
}

.movie-card:hover .card-info,
.movie-card.active .card-info {
  transform: translateY(0);
  opacity: 1;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0;
  color: #000;
}
.like-badge {
  margin-top: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  color: #f43f5e;
}

.scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  border: none;
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 20;
  transition: all 0.2s;
}
.scroll-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-50%) scale(1.1);
}
.scroll-btn.left {
  left: 10px;
}
.scroll-btn.right {
  right: 10px;
}

@media (min-width: 769px) {
  .movie-card:nth-child(odd) {
    transform: translateY(25px);
  }
  .movie-card:nth-child(even) {
    transform: translateY(-15px);
  }
  .movie-card:hover {
    transform: translateY(-35px) scale(1.08);
    z-index: 10;
    box-shadow: var(--shadow-hover);
  }
}

footer {
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  text-align: center;
  flex-shrink: 0;
}

.player-layout {
  display: flex;
  gap: 25px;
  padding: 20px 40px;
  align-items: flex-start;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.video-section {
  flex: 1;
  min-width: 0;
}
.playlist-section {
  width: 320px;
  flex-shrink: 0;
}

.player-wrapper {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-hover);
}

.artplayer-app {
  width: 100%;
  height: 100%;
}

.video-meta {
  margin-top: 20px;
}
.video-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 10px;
  font-family: "Oswald", sans-serif;
}
.video-stats {
  display: flex;
  gap: 12px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 15px;
  flex-wrap: wrap;
}
.video-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.btn {
  padding: 8px 18px;
  border-radius: 18px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  font-size: 0.85rem;
}
.btn:hover {
  background: #f0f0f0;
}

.desc-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.playlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.playlist-title {
  font-size: 1.1rem;
  font-weight: 700;
}
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 18px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 18px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #2196f3;
}
input:checked + .slider:before {
  transform: translateX(20px);
}

.playlist-items {
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  padding-right: 5px;
}
.playlist-items::-webkit-scrollbar {
  width: 5px;
}
.playlist-items::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.episode-card {
  display: flex;
  gap: 12px;
  padding: 10px;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.episode-card:hover {
  transform: scale(1.02);
  background: #fafafa;
}
.episode-card.active {
  border: 2px solid var(--text-primary);
  background: #fff;
}

.ep-thumb {
  width: 90px;
  height: 55px;
  border-radius: 5px;
  object-fit: cover;
}
.ep-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ep-title {
  font-weight: 600;
  font-size: 0.85rem;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  z-index: 10;
}

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

@media (max-width: 1024px) {
  header {
    padding: 12px 25px;
  }
  .logo-text {
    font-size: 1rem;
  }
  .search-form input {
    width: 120px;
  }

  .movie-card {
    width: 160px;
    min-width: 160px;
    height: 280px;
  }

  .player-layout {
    padding: 15px 25px;
    gap: 20px;
  }
  .playlist-section {
    width: 280px;
  }
  .video-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 768px) {
  header {
    padding: 12px 15px;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
  }

  .logo-text {
    font-size: 0.9rem;
  }
  .logo-center svg {
    width: 26px;
    height: 26px;
  }

  .search-bar {
    padding: 4px 10px;
  }
  .search-form input {
    width: 80px;
    font-size: 0.8rem;
  }

  .hero-section {
    padding: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    background: transparent;
  }

  .gallery-wrapper {
    width: 100%;
    height: 100%;
    padding: 0;
    overflow: visible;
    position: relative;
    background: transparent;
  }

  .movie-gallery {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 15px 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    height: auto;
    scroll-behavior: smooth;
    background: transparent;
  }

  .movie-card {
    flex: 0 0 70%;
    width: 70%;
    min-width: 70%;
    max-width: 280px;
    height: auto;
    aspect-ratio: 2/3;
    margin: 0;
    border-radius: 20px;
    scroll-snap-align: center;
    transform: scale(0.9);
    opacity: 0.5;
    filter: brightness(0.6) saturate(0.8);
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    background: #ccc;
  }

  .movie-card:first-child {
    margin-left: calc(15% - 6px);
  }

  .movie-card:last-child {
    margin-right: calc(15% - 6px);
  }

  .movie-card.carousel-active {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1) saturate(1);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.2);
    z-index: 5;
  }

  .movie-card:hover {
    transform: scale(0.9);
  }

  .movie-card.carousel-active:hover {
    transform: scale(1);
  }

  .movie-card .card-info {
    transform: translateY(0);
    opacity: 0;
    transition: opacity 0.3s ease;
    bottom: 10px;
    left: 8px;
    right: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.97);
  }

  .movie-card.carousel-active .card-info {
    opacity: 1;
  }

  .movie-card .card-title {
    font-size: 0.95rem;
  }

  .movie-card .like-badge {
    font-size: 0.8rem;
  }

  .scroll-btn {
    display: none;
  }

  .carousel-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 15px 0;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
  }

  .carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
  }

  .carousel-dot.active {
    background: var(--text-primary);
    transform: scale(1.3);
  }

  .swipe-hint {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    opacity: 0;
    animation: fadeInHint 0.5s ease 1s forwards,
      fadeOutHint 0.5s ease 4s forwards;
    pointer-events: none;
  }

  .swipe-hint svg {
    animation: swipeMotion 1.5s ease-in-out infinite;
  }

  @keyframes fadeInHint {
    to {
      opacity: 1;
    }
  }

  @keyframes fadeOutHint {
    to {
      opacity: 0;
    }
  }

  @keyframes swipeMotion {
    0%,
    100% {
      transform: translateX(0);
    }
    50% {
      transform: translateX(10px);
    }
  }

  .player-layout {
    flex-direction: column;
    padding: 10px 15px;
    gap: 15px;
  }
  .playlist-section {
    width: 100%;
  }
  .video-title {
    font-size: 1.3rem;
  }
  .playlist-items {
    max-height: 350px;
  }
  .ep-thumb {
    width: 80px;
    height: 50px;
  }
}

@media (max-width: 480px) {
  .logo-text {
    display: none;
  }
  header {
    grid-template-columns: auto 1fr;
  }
  .search-form input {
    width: 100px;
  }

  .movie-card {
    flex: 0 0 75%;
    width: 75%;
    min-width: 75%;
    max-width: 260px;
  }

  .movie-card:first-child {
    margin-left: calc(12.5% - 6px);
  }

  .movie-card:last-child {
    margin-right: calc(12.5% - 6px);
  }
}
