:root {
  --primary: #0f0f23;
  --secondary: #1a1a2e;
  --accent: #ff2e63;
  --accent-glow: rgba(255, 46, 99, 0.4);
  --text: #eaeaea;
  --text-dim: #a0a0a0;
  --card-bg: rgba(26, 26, 46, 0.6);
  --glass: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --success: #00ff88;
  --error: #ff3366;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--primary);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Animated background */
.backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background:
    radial-gradient(ellipse at 10% 20%, rgba(255, 46, 99, 0.15) 0%, transparent 40%),
    radial-gradient(ellipse at 90% 80%, rgba(138, 43, 226, 0.15) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 50%, rgba(26, 26, 46, 0.8) 0%, var(--primary) 100%);
  animation: backgroundShift 20s ease infinite;
}

@keyframes backgroundShift {
  0%, 100% { filter: hue-rotate(0deg); }
  50% { filter: hue-rotate(20deg); }
}

/* Floating particles */
.backdrop::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(2.5px 2.5px at 20% 30%, white, transparent),
    radial-gradient(2.5px 2.5px at 60% 70%, white, transparent),
    radial-gradient(1.5px 1.5px at 50% 50%, white, transparent),
    radial-gradient(1.5px 1.5px at 80% 10%, white, transparent),
    radial-gradient(2.5px 2.5px at 90% 60%, white, transparent),
    radial-gradient(1.5px 1.5px at 15% 80%, white, transparent),
    radial-gradient(2.5px 2.5px at 45% 20%, white, transparent),
    radial-gradient(1.5px 1.5px at 75% 45%, white, transparent),
    radial-gradient(2.5px 2.5px at 35% 65%, white, transparent),
    radial-gradient(1.5px 1.5px at 95% 85%, white, transparent),
    radial-gradient(2.5px 2.5px at 5% 15%, white, transparent),
    radial-gradient(1.5px 1.5px at 65% 90%, white, transparent),
    radial-gradient(2.5px 2.5px at 25% 5%, white, transparent),
    radial-gradient(1.5px 1.5px at 85% 35%, white, transparent),
    radial-gradient(2.5px 2.5px at 55% 75%, white, transparent),
    radial-gradient(1.5px 1.5px at 40% 40%, white, transparent),
    radial-gradient(2.5px 2.5px at 70% 25%, white, transparent),
    radial-gradient(1.5px 1.5px at 10% 55%, white, transparent),
    radial-gradient(2.5px 2.5px at 88% 95%, white, transparent),
    radial-gradient(1.5px 1.5px at 30% 12%, white, transparent),
    radial-gradient(2px 2px at 12% 42%, rgba(255, 46, 99, 0.6), transparent),
    radial-gradient(2px 2px at 78% 58%, rgba(138, 43, 226, 0.6), transparent),
    radial-gradient(2px 2px at 42% 88%, rgba(255, 46, 99, 0.5), transparent),
    radial-gradient(2px 2px at 92% 22%, rgba(138, 43, 226, 0.5), transparent);
  background-size: 200% 200%;
  background-position: 0% 0%;
  animation: particleFloat 60s linear infinite;
  opacity: 0.5;
}

@keyframes particleFloat {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  padding: 60px 0 40px;
  text-align: center;
  position: relative;
}

.logo-link {
  text-decoration: none;
  display: inline-block;
}

.logo {
  font-size: 4.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #fff 0%, #ff2e63 50%, #8a2be2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -2px;
  position: relative;
  animation: logoGlow 3s ease-in-out infinite;
  text-shadow: 0 0 60px var(--accent-glow);
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05) translateY(-5px);
}

@keyframes logoGlow {
  0%, 100% { filter: drop-shadow(0 0 20px var(--accent-glow)); }
  50% { filter: drop-shadow(0 0 40px var(--accent-glow)); }
}

.tagline {
  font-size: 1.25rem;
  color: var(--text-dim);
  margin: 20px auto 0;
  max-width: 700px;
  font-weight: 400;
  line-height: 1.8;
  animation: fadeInUp 0.8s ease 0.2s both;
}

/* Search Section */
.search-container {
  position: relative;
  max-width: 700px;
  margin: 50px auto 30px;
  animation: fadeInUp 0.8s ease 0.4s both;
}

.search-input {
  width: 100%;
  padding: 20px 28px;
  font-size: 1.1rem;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  position: relative;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px var(--accent-glow), 0 20px 40px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.search-input::placeholder {
  color: var(--text-dim);
}

/* Autocomplete styling */
.ui-autocomplete {
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.98) 0%, rgba(15, 15, 35, 0.98) 100%) !important;
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 46, 99, 0.2) !important;
  border-radius: 16px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 8px 32px rgba(255, 46, 99, 0.15);
  max-height: 600px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  margin-top: 12px;
  animation: dropdownSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ui-menu .ui-menu-item {
  margin: 4px 0;
  border-radius: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  background: transparent !important;
  opacity: 1 !important;
}

.ui-menu .ui-menu-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), #8a2be2);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.ui-menu .ui-menu-item:hover {
  background: linear-gradient(90deg, rgba(255, 46, 99, 0.15) 0%, rgba(138, 43, 226, 0.1) 100%);
  transform: translateX(6px);
  box-shadow: 0 4px 12px rgba(255, 46, 99, 0.2);
}

.ui-menu .ui-menu-item:hover::before {
  transform: scaleY(1);
}

.ui-menu .ui-menu-item a {
  color: #f5f5f5 !important;
  padding: 14px 20px;
  display: block;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
  background: transparent !important;
  border: none !important;
  opacity: 1 !important;
}

.ui-menu .ui-menu-item:hover a {
  color: #ffffff !important;
  padding-left: 28px;
}

/* Additional specificity for jQuery UI override */
.ui-widget-content {
  background: transparent !important;
  color: #f5f5f5 !important;
  border: none !important;
}

.ui-menu-item-wrapper {
  color: #f5f5f5 !important;
  background: transparent !important;
  border: none !important;
  opacity: 1 !important;
}

.ui-state-active,
.ui-widget-content .ui-state-active {
  background: linear-gradient(90deg, rgba(255, 46, 99, 0.15) 0%, rgba(138, 43, 226, 0.1) 100%) !important;
  border: none !important;
  color: #ffffff !important;
}

/* Scrollbar for dropdown */
.ui-autocomplete::-webkit-scrollbar {
  width: 6px;
}

.ui-autocomplete::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}

.ui-autocomplete::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--accent), #8a2be2);
  border-radius: 10px;
}

.ui-autocomplete::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(#8a2be2, var(--accent));
}

#selection-error {
  margin-top: 12px;
  padding: 12px 20px;
  background: rgba(255, 51, 102, 0.1);
  border: 1px solid rgba(255, 51, 102, 0.3);
  border-radius: 10px;
  color: var(--error);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* Button */
.btn-container {
  text-align: center;
  margin: 30px 0;
  animation: fadeInUp 0.8s ease 0.6s both;
}

.btn {
  position: relative;
  padding: 18px 48px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, #8a2be2 100%);
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 30px var(--accent-glow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: inherit;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 40px var(--accent-glow);
}

.btn:active {
  transform: translateY(-1px) scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Movie Card */
.movie-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px;
  margin: 40px auto;
  max-width: 900px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.8s ease both;
}

.movie-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #8a2be2, var(--accent));
  background-size: 200% 100%;
  animation: borderSlide 3s linear infinite;
}

@keyframes borderSlide {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

.movie-title {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
  line-height: 1.2;
}

.movie-year {
  font-size: 1.3rem;
  color: var(--text-dim);
  font-weight: 400;
  margin-left: 16px;
}

.movie-overview {
  font-size: 1.1rem;
  line-height: 1.8;
  margin: 24px 0;
  color: var(--text-dim);
  text-align: left;
}

.movie-details {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 32px 0;
  align-items: center;
}

.movie-detail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.movie-detail-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.movie-detail-item i {
  color: var(--accent);
  font-size: 1.2rem;
}

.genre-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0;
}

.genre-tag {
  padding: 8px 20px;
  background: rgba(255, 46, 99, 0.15);
  border: 1px solid rgba(255, 46, 99, 0.3);
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: default;
}

.genre-tag:hover {
  background: rgba(255, 46, 99, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.imdb-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  background: rgba(243, 206, 19, 0.1);
  border: 1px solid rgba(243, 206, 19, 0.3);
  border-radius: 12px;
  transition: all 0.3s ease;
  text-decoration: none;
}

.imdb-link:hover {
  background: rgba(243, 206, 19, 0.2);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 24px rgba(243, 206, 19, 0.3);
}

.fa-imdb {
  font-size: 2rem;
  color: #f3ce13;
}

/* Trailer */
.trailer-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  margin: 32px 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
}

.trailer-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.no-trailer-message {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-dim);
  gap: 16px;
}

.no-trailer-message i {
  font-size: 3rem;
  opacity: 0.5;
}

/* Footer */
.footer {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: auto;
}

.footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}

.footer-text {
  font-size: 0.95rem;
  color: var(--text-dim);
}

.footer-link {
  color: var(--text-dim);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  padding: 8px 16px;
  border-radius: 8px;
}

.footer-link:hover {
  color: var(--accent);
  background: rgba(255, 46, 99, 0.1);
}

/* Loader */
.loader-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loader {
  width: 80px;
  height: 80px;
  position: relative;
}

.loader::before,
.loader::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

.loader::after {
  width: 70%;
  height: 70%;
  border-top-color: #8a2be2;
  animation: spin 1.5s linear infinite reverse;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Flash messages */
.flash-message {
  background: rgba(255, 255, 255, 0.05);
  border-left: 4px solid var(--accent);
  margin: 20px auto;
  padding: 16px 24px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  max-width: 700px;
  animation: slideInRight 0.5s ease;
}

.flash-message.error {
  border-color: var(--error);
  background: rgba(255, 51, 102, 0.1);
}

.flash-message.success {
  border-color: var(--success);
  background: rgba(0, 255, 136, 0.1);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .logo {
    font-size: 3rem;
  }

  .tagline {
    font-size: 1.1rem;
    padding: 0 16px;
  }

  .search-input {
    font-size: 1rem;
    padding: 16px 20px;
  }

  .btn {
    padding: 16px 36px;
    font-size: 1rem;
  }

  .movie-card {
    padding: 32px 24px;
  }

  .movie-title {
    font-size: 2rem;
  }

  .movie-overview {
    font-size: 1rem;
  }

  .movie-details {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-content {
    flex-direction: column;
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 2.5rem;
  }

  .tagline {
    font-size: 1rem;
  }

  .movie-title {
    font-size: 1.75rem;
  }

  .btn {
    width: 100%;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--secondary);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--accent), #8a2be2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(#8a2be2, var(--accent));
}
