:root {
  --bg-primary: #000;
  --bg-secondary: #1a1a1a;
  --text-primary: #fff;
  --text-secondary: rgba(255,255,255,0.8);
  --accent-color: #e50914;
  --card-bg: rgba(0,0,0,0.55);
  --hover-bg: rgba(255,255,255,0.1);
  --skeleton-base: rgba(255,255,255,0.1);
  --skeleton-shine: rgba(255,255,255,0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: radial-gradient(circle at top, var(--bg-secondary), var(--bg-primary) 75%);
  color: var(--text-primary);
  font-family: system-ui, sans-serif;
  overflow-y: scroll;
  transition: background 0.3s ease, color 0.3s ease;
}

/* topbar  */
.topbar {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  transition: background 0.3s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
  transition: transform 0.2s ease;
}

.brand:hover {
  transform: scale(1.05);
}

.brand img { 
  width: 32px;
  transition: transform 0.3s ease;
}

.brand:hover img {
  transform: rotate(360deg);
}

.nav-desktop {
  margin-left: auto;
  display: none;
  gap: 24px;
}

.nav-desktop span {
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s ease, transform 0.2s ease;
  position: relative;
}

.nav-desktop span:hover { 
  opacity: 1;
  transform: translateY(-2px);
}

.nav-desktop span::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-color);
  transition: width 0.3s ease;
}

.nav-desktop span:hover::after {
  width: 100%;
}

.menu-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.menu-btn:hover {
  transform: scale(1.1);
}

/* sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100%;
  background: var(--bg-primary);
  padding: 20px;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 9999;
  box-shadow: 4px 0 20px rgba(0,0,0,0.5);
}

.sidebar.active {
  transform: translateX(0);
}

.sidebar h2 {
  margin-bottom: 20px;
  color: var(--accent-color);
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  padding: 14px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.sidebar li:hover {
  background: var(--hover-bg);
  transform: translateX(8px);
}

.sidebar li i {
  margin-right: 10px;
  transition: transform 0.2s ease;
}

.sidebar li:hover i {
  transform: scale(1.2);
}

/* hero  */
.hero {
  position: relative;
  height: 70vh;
  min-height: 520px;
  overflow: hidden;
  contain: layout paint size;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.45);
  transition: background-image 0.8s ease;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.2),
    rgba(0,0,0,0.85),
    var(--bg-primary)
  );
}

.hero-content {
  position: relative;
  z-index: 5;
  max-width: 640px;
  padding: 100px 6vw 60px;
  animation: fadeInUp 0.8s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-content h1 {
  font-size: 3rem;
  margin-bottom: 16px;
  line-height: 1.2;
  text-shadow: 2px 2px 10px rgba(0,0,0,0.8);
}

#hero-overview {
  height: 120px;
  overflow: hidden;
  opacity: 0.9;
  line-height: 1.6;
  margin-bottom: 16px;
  text-shadow: 1px 1px 5px rgba(0,0,0,0.8);
}

.hero-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.hero-hint {
  opacity: 0.6;
  font-size: 0.85rem;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.hero-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-color);
  color: white;
}

.hero-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4);
}

.hero-btn.hero-info {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
}

.hero-btn.hero-info:hover {
  background: rgba(255,255,255,0.3);
}

.desktop-only {
  display: block;
}

@media (max-width: 768px) {
  .desktop-only {
    display: none;
  }
}

.hero-video {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.hero-video iframe {
  width: 100%;
  height: 100%;
  border: none;
}
 
.search-wrap {
  padding: 36px 6vw 24px;
  background: var(--bg-primary);
}

#search {
  width: 100%;
  padding: 16px 18px;
  border-radius: 40px;
  background: var(--hover-bg);
  border: 2px solid transparent;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  transition: all 0.3s ease;
}

#search::placeholder {
  color: var(--text-secondary);
}

#search:focus {
  background: var(--card-bg);
  border-color: var(--accent-color);
  transform: scale(1.02);
}


main {
  padding: 40px 6vw 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px,1fr));
  gap: 24px;
  min-height: 100vh;
  background: var(--bg-primary);
}


.skeleton {
  background: var(--skeleton-base);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    var(--skeleton-shine),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  to { left: 100%; }
}

.skeleton-poster {
  width: 100%;
  height: 280px;
}

.skeleton-text {
  height: 20px;
  margin: 10px;
  border-radius: 4px;
  background: var(--skeleton-base);
}

.skeleton-text:last-child {
  width: 60%;
}


.movie {
  background: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.movie:hover {
  transform: scale(1.05) translateY(-8px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}


.movie img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
  background: var(--skeleton-base);
}

.movie:hover img {
  transform: scale(1.1);
}

.movie-info { 
  padding: 10px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.movie-meta {
  padding: 0 10px 10px;
  font-size: 14px;
  opacity: 0.8;
}

.overview {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.95);
  padding: 16px;
  transform: translateY(110%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.5;
}


.movie:hover .overview {
  transform: translateY(0);
}

/* shortcuts*/
.keyboard-help {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  max-width: 300px;
}

.keyboard-help.show {
  opacity: 1;
  pointer-events: auto;
}

.keyboard-help h3 {
  margin-bottom: 12px;
  color: var(--accent-color);
  font-size: 16px;
}

.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

.shortcut-list div {
  display: flex;
  align-items: center;
  gap: 10px;
}

kbd {
  background: var(--hover-bg);
  padding: 4px 8px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  border: 1px solid var(--text-secondary);
  min-width: 24px;
  text-align: center;
}


@media (min-width:1024px) {
  .menu-btn { display: none; }
  .nav-desktop { display: flex; }
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(10px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: 16px;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalSlideIn 0.4s ease;
}

@keyframes modalSlideIn {
  from {
    transform: scale(0.9) translateY(50px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0,0,0,0.7);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--accent-color);
  transform: rotate(90deg);
}

#modalBody {
  padding: 20px;
}

.modal-trailer {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; 
  margin-bottom: 20px;
  border-radius: 12px;
  overflow: hidden;
}

.modal-trailer iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.modal-info {
  display: grid;
  gap: 20px;
}

.modal-header h2 {
  font-size: 2rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.modal-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-size: 14px;
  opacity: 0.8;
}

.modal-overview {
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.info-item {
  padding: 12px;
  background: var(--hover-bg);
  border-radius: 8px;
}

.info-label {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--accent-color);
  font-size: 12px;
  text-transform: uppercase;
}

.info-value {
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 2rem;
  }
  
  .hero {
    height: 60vh;
    min-height: 400px;
  }
  
  main {
    grid-template-columns: repeat(auto-fill, minmax(150px,1fr));
    gap: 16px;
  }

  .keyboard-help {
    bottom: 10px;
    right: 10px;
    max-width: 250px;
    padding: 15px;
  }

  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .modal-header h2 {
    font-size: 1.5rem;
  }

  #modalBody {
    padding: 15px;
  }
}