:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --secondary-color: #22d3ee;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --dark-bg: #0f172a;
  --dark-surface: #1e293b;
  --dark-border: #334155;
  --light-bg: #f8fafc;
  --light-surface: #ffffff;
  --light-border: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #f1f5f9;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

h1 {
  color: white;
  font-size: 3rem;
  font-weight: 800;
  text-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  background: linear-gradient(135deg, #fff 0%, #e0e7ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

.theme-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.theme-icon {
  font-size: 1.5rem;
}

.subtitle {
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  margin-bottom: 3rem;
}

.search-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  margin-bottom: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-box {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.search-box input[type="text"] {
  flex: 1;
  padding: 1rem 1.5rem;
  border: 2px solid var(--light-border);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

.search-box input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.search-box button {
  padding: 1rem 2rem;
  border: none;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: white;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

.search-box button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.search-box button:active {
  transform: translateY(0);
}
.filter-options {
  margin-bottom: 1rem;
}

.filter-options select {
  padding: 0.75rem 1rem;
  border: 2px solid var(--light-border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-options select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
#episode-selection {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

#episode-selection select {
  padding: 0.75rem 1rem;
  border: 2px solid var(--light-border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 150px;
}

#episode-selection select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
#tmdb-results {
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  max-height: 400px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#tmdb-results-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

#tmdb-results-list li {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--light-border);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-primary);
}

#tmdb-results-list li strong {
  color: var(--text-primary);
  font-weight: 600;
}

#tmdb-results-list li div {
  color: var(--text-primary);
}

#tmdb-results-list li:last-child {
  border-bottom: none;
}

#tmdb-results-list li:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
  transform: translateX(4px);
}

.tmdb-poster {
  width: 60px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  background: var(--light-bg);
  transition: transform 0.3s ease;
}

.tmdb-poster:hover {
  transform: scale(1.05);
}

.tmdb-poster-placeholder {
  width: 60px;
  height: 90px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease;
}

.tmdb-poster-placeholder:hover {
  transform: scale(1.05);
}

.tmdb-result-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tmdb-result-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.tmdb-result-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tmdb-result-year {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.tmdb-result-type {
  background: var(--primary-color);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.results-container {
  margin-top: 2rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  max-height: 600px;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#results-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

#results-list li {
  padding: 1.5rem;
  border-bottom: 1px solid var(--light-border);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

#results-list li:last-child {
  border-bottom: none;
}

#results-list li:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.03), rgba(139, 92, 246, 0.03));
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

#results-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

#results-list li:hover::before {
  transform: scaleY(1);
}

.stream-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.stream-content {
  flex: 1;
}

.stream-name {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.stream-details {
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.stream-details span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  background: var(--light-bg);
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.magnet-button {
  padding: 0.75rem 1.5rem;
  border: none;
  background: linear-gradient(135deg, var(--success-color), #059669);
  color: white;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.magnet-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, #059669, var(--success-color));
}

.magnet-button:active {
  transform: translateY(0);
}

.magnet-button::before {
  content: "🧲";
  font-size: 1rem;
}

/* Loading animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

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

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Pulse animation for important elements */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.pulse {
  animation: pulse 2s infinite;
}

/* Skeleton loading animation */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
  }
  
  .search-container {
    padding: 1.5rem;
  }
  
  .search-box {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .search-box input[type="text"] {
    padding: 0.875rem 1.25rem;
  }
  
  .search-box button {
    padding: 0.875rem 1.5rem;
    width: 100%;
  }
  
  #episode-selection {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  #episode-selection select {
    width: 100%;
  }
  
  .stream-info {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .magnet-button {
    width: 100%;
    justify-content: center;
  }
  
  .stream-details {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .results-container {
    max-height: 500px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0.75rem;
  }
  
  h1 {
    font-size: 1.75rem;
  }
  
  .search-container {
    padding: 1rem;
    border-radius: var(--radius-lg);
  }
  
  .results-container {
    border-radius: var(--radius-lg);
  }
  
  #tmdb-results {
    border-radius: var(--radius-md);
  }
  
  #results-list li {
    padding: 1rem;
  }
  
  .stream-name {
    font-size: 1rem;
  }
  
  .stream-details span {
    padding: 0.2rem 0.5rem;
    font-size: 0.85rem;
  }
  
  .tmdb-poster,
  .tmdb-poster-placeholder {
    width: 50px;
    height: 75px;
  }
  
  .tmdb-result-title {
    font-size: 0.9rem;
  }
}

/* Dark mode styles */
body.dark-mode {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

body.dark-mode .search-container,
body.dark-mode .results-container,
body.dark-mode #tmdb-results {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(51, 65, 85, 0.5);
}

body.dark-mode .search-box input[type="text"],
body.dark-mode .filter-options select,
body.dark-mode #episode-selection select {
  background: var(--dark-surface);
  border-color: var(--dark-border);
  color: var(--text-light);
}

body.dark-mode .search-box input[type="text"]:focus,
body.dark-mode .filter-options select:focus,
body.dark-mode #episode-selection select:focus {
  border-color: var(--primary-color);
}

body.dark-mode #tmdb-results-list li,
body.dark-mode #results-list li {
  border-color: var(--dark-border);
}

body.dark-mode #tmdb-results-list li:hover,
body.dark-mode #results-list li:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
}

body.dark-mode #tmdb-results-list li {
  color: var(--text-light);
}

body.dark-mode #tmdb-results-list li strong,
body.dark-mode #tmdb-results-list li div {
  color: var(--text-light);
}

body.dark-mode .tmdb-result-title {
  color: var(--text-light);
}

body.dark-mode .tmdb-result-year {
  color: rgba(241, 245, 249, 0.7);
}

body.dark-mode .stream-name {
  color: var(--text-light);
}

body.dark-mode .stream-details span {
  background: var(--dark-surface);
  color: var(--text-light);
}

body.dark-mode .subtitle {
  color: rgba(241, 245, 249, 0.8);
}

/* Additional micro-interactions */
.search-box input[type="text"]::placeholder {
  color: var(--text-secondary);
  transition: opacity 0.3s ease;
}

.search-box input[type="text"]:focus::placeholder {
  opacity: 0.7;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
}

body.dark-mode ::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

/* Focus visible for accessibility */
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Selection styling */
::selection {
  background: rgba(99, 102, 241, 0.2);
  color: var(--text-primary);
}

body.dark-mode ::selection {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text-light);
}

/* Tablet styles */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    padding: 1.5rem;
  }
  
  h1 {
    font-size: 2.5rem;
  }
}
