:root {
  --primary: #00f0ff;
  --primary-dark: #00bfff;
  --secondary: #0088ff;
  --neon-glow: 0 0 10px rgba(0, 240, 255, 0.7), 0 0 20px rgba(0, 191, 255, 0.5),
    0 0 30px rgba(0, 136, 255, 0.3);
  --dark-bg: #0a0a1a;
  --card-bg: rgba(20, 25, 40, 0.8);
  --text-primary: #f0f8ff;
  --text-secondary: #a0d0ff;
  --border-color: rgba(0, 191, 255, 0.3);
  --hover-transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
    box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --shadow-sm: 0 1px 10px rgba(0, 136, 255, 0.2);
  --shadow-md: 0 4px 20px rgba(0, 136, 255, 0.3);
  --shadow-lg: 0 10px 30px rgba(0, 136, 255, 0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --glass-blur: blur(8px);
  --glass-blur-chrome: blur(4px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Inter", "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,
    "Open Sans", "Helvetica Neue", sans-serif;
}

body {
  background-color: var(--dark-bg);
  background-image: radial-gradient(
      circle at 20% 50%,
      rgba(0, 240, 255, 0.08),
      transparent 50%
    ),
    radial-gradient(circle at 80% 20%, rgba(0, 191, 255, 0.08), transparent 50%);
  background-size: cover;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-position: center;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

header {
  background-color: rgba(15, 25, 45, 0.9);
  padding: 0.5rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
  will-change: transform, box-shadow;
  transform: translateZ(0);
  position: relative;
}

.header-left img {
  height: 45px;
  transition: transform 0.3s ease, filter 0.3s ease;
  filter: drop-shadow(0 0 5px rgba(0, 240, 255, 0.7));
  transform: translateZ(0);
}

nav.header-center {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

nav.header-center a {
  color: var(--text-primary);
  text-decoration: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  transition: var(--hover-transition);
  font-weight: 600;
  letter-spacing: 0.4px;
  position: relative;
  font-size: 0.95rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

nav.header-center a:hover {
  color: var(--primary);
  text-shadow: 0 0 8px var(--primary);
}

nav.header-center a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s ease;
}

nav.header-center a:hover::after {
  width: 70%;
}

.header-right {
  display: flex;
  align-items: center;
}

.header-search-container {
  display: flex;
  gap: 0.5rem;
}

.header-search-input {
  width: 200px;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  border: 1px solid var(--border-color);
  background-color: rgba(15, 25, 45, 0.4);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: var(--hover-transition);
  box-shadow: var(--shadow-sm), inset 0 0 10px rgba(0, 136, 255, 0.2);
}

.header-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.3), var(--shadow-md),
    inset 0 0 15px rgba(0, 136, 255, 0.3);
}

.header-search-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.header-search-button {
  padding: 0.5rem;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #0a0a1a;
  font-weight: 600;
  cursor: pointer;
  transition: var(--hover-transition);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.5),
    inset 0 1px 1px rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.header-search-button:hover {
  background: linear-gradient(135deg, var(--primary), #0066ff);
  transform: translateY(-1px) translateZ(0);
}

.header-search-button,
.back-to-top {
  padding: 1.3rem;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #0a0a1a;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  will-change: transform, box-shadow;
  transform: translateZ(0);
  -webkit-tap-highlight-color: transparent;
}

.container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  padding: 1rem;
  max-width: 1900px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 1800px) {
  .container:not(.few-items):not(.single-item) {
    grid-template-columns: repeat(6, minmax(300px, 1fr));
  }
}

.container.few-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
  padding: 4rem;
}

.container.single-item {
  display: flex;
  justify-content: center;
  padding: 4rem;
}

.card {
  max-width: 300px;
  width: 100%;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  will-change: transform, box-shadow;
  transform: translateZ(0);
  margin: 0 auto;
}

/* Chrome-specific card optimization */
@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) {
}

.card:hover {
  transform: translateY(-5px) translateZ(0);
  box-shadow: var(--neon-glow);
}

.card img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
  will-change: transform;
}

.card-content {
  padding: 1.5rem;
}

.movie-title {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  line-height: 1.3;
}

.movie-year {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1rem;
}

.pagination {
  display: flex;
  justify-content: center;
  color: var(--text-primary);
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem;
}

.pagination button {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  background: rgba(20, 25, 40, 0.6);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-size: 1rem;
  will-change: background-color, box-shadow;
}

.pagination button.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #0a0a1a;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  font-weight: bold;
}

.pagination button:hover:not(.active) {
  background: rgba(0, 191, 255, 0.2);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

footer {
  background-color: rgba(15, 25, 45, 0.9);
  padding: 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-top: 1px solid rgba(0, 191, 255, 0.2);
  transform: translateZ(0);
}

footer a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  font-weight: 500;
  position: relative;
}

footer a:hover {
  color: var(--primary);
  text-shadow: 0 0 8px var(--primary);
}

footer a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--primary);
  transition: width 0.3s ease;
}

footer a:hover::after {
  width: 100%;
}

/* Mobile and Tablet Optimizations */
@media (max-width: 992px) {
  header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .header-left {
    order: 1;
    justify-content: center;
  }

  nav.header-center {
    order: 2;
    width: 100%;
    justify-content: center;
    position: static;
    transform: none;
    padding: 0.5rem 0;
  }

  .header-right {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .header-search-container {
    width: 100%;
    max-width: 500px;
  }

  .header-search-input {
    width: 100%;
  }

  .container {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .card {
    max-width: none;
  }
}

@media (max-width: 768px) {
  nav.header-center a {
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
  }

  nav.header-center a .link-text {
    display: none;
  }

  nav.header-center a i {
    font-size: 1.1rem;
  }

  .container {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }

  .card img {
    width: 182px;
    height: 273px;
  }

  .card-content {
    padding: 1rem;
  }

  .movie-title {
    font-size: 1rem;
  }

  .movie-year {
    font-size: 0.85rem;
  }

  .back-to-top {
    width: 40px;
    height: 40px;
    bottom: 1rem;
    right: 1rem;
  }
}

@media (max-width: 480px) {
  nav.header-center {
    gap: 2.8rem;
  }

  nav.header-center a {
    padding: 0.3rem;
  }

  .header-search-input {
    font-size: 0.9rem;
    padding: 0.8rem 1rem;
  }

  .container {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .card img {
    width: 182px;
    height: 273px;
  }

  .movie-title {
    font-size: 0.9rem;
  }

  .movie-year {
    font-size: 0.75rem;
  }

  .pagination {
    gap: 0.5rem;
  }

  .pagination button {
    font-size: 0.8rem;
    padding: 0.5rem 0.8rem;
  }

  footer {
    font-size: 0.8rem;
    padding: 0.8rem;
  }
}

@font-face {
  font-family: "Inter";
  src: url("https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7.woff2")
    format("woff2");
  font-display: swap;
}
