/* app/static/css/style.css */
:root {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-card: #252525;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --accent: #e50914;
  --accent-hover: #f40612;
  --success: #46d369;
}

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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--accent);
  text-decoration: none;
}

.search-form {
  flex: 1;
  max-width: 500px;
  display: flex;
}

.search-form input {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px 0 0 4px;
  background: var(--bg-card);
  color: var(--text-primary);
}

.search-form button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

.nav-links {
  display: flex;
  gap: 1rem;
}
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
}
.nav-links a:hover {
  color: var(--text-primary);
}

/* Hero */
.hero {
  text-align: center;
  padding: 3rem 2rem;
  background: linear-gradient(
    to bottom,
    var(--bg-secondary),
    var(--bg-primary)
  );
}

/* Hero Banner (Netflix-style) */
.hero-banner {
  position: relative;
  height: 70vh;
  min-height: 500px;
  max-height: 800px;
  background-size: cover;
  background-position: center top;
  display: flex;
  align-items: flex-end;
  padding: 4rem;
}

.hero-content {
  max-width: 600px;
  z-index: 1;
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

.hero-overview {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}

.hero-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.hero-rating {
  color: #ffd700;
  font-weight: bold;
}

.hero-year {
  color: var(--text-secondary);
}

.hero-actions {
  display: flex;
  gap: 1rem;
}

.btn-hero-watch {
  padding: 1rem 2.5rem;
  background: var(--accent);
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 1.1rem;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-hero-watch:hover {
  background: var(--accent-hover);
}

.btn-hero-list {
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-hero-list:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Carousel Sections */
.carousel-section {
  padding: 1.5rem 2rem;
}

.section-title {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.carousel {
  position: relative;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 0.5rem;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-card {
  flex: 0 0 auto;
  width: 160px;
  border-radius: 6px;
  overflow: hidden;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  position: relative;
}

.carousel-card:hover {
  transform: scale(1.08);
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.carousel-card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
}

.carousel-card a {
  text-decoration: none;
  color: inherit;
}

.card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 0.5rem 0.5rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  opacity: 0;
  transition: opacity 0.2s;
}

.carousel-card:hover .card-overlay {
  opacity: 1;
}

.card-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-rating {
  font-size: 0.75rem;
  color: #ffd700;
}

/* Media Grid */
.media-section {
  padding: 2rem;
}
.media-section h2 {
  margin-bottom: 1rem;
}

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

.media-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
  transition: transform 0.2s;
}

.media-card:hover {
  transform: scale(1.05);
}
.media-card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
}
.media-card .media-info {
  padding: 0.5rem;
}
.media-card h3 {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rating {
  color: #ffd700;
  font-size: 0.85rem;
}

/* Detail Page */
.detail-page {
  padding: 2rem;
}
.detail-header {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
}
.detail-poster {
  width: 300px;
  border-radius: 8px;
}
.detail-info h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.meta {
  display: flex;
  gap: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}
.genres {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.genre-tag {
  padding: 0.25rem 0.75rem;
  background: var(--bg-card);
  border-radius: 20px;
  font-size: 0.85rem;
}
.overview {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  max-width: 600px;
}
.actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.btn-watch {
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}
.btn-watch:hover {
  background: var(--accent-hover);
}

.btn-watchlist {
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: white;
  border: 1px solid white;
  border-radius: 4px;
  cursor: pointer;
}
.btn-watchlist.added {
  background: var(--success);
  border-color: var(--success);
}

/* Episode selector */
.episode-selector {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
}
.episode-selector label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.episode-selector select,
.episode-selector input {
  padding: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--text-secondary);
  border-radius: 4px;
  color: white;
}

/* Player */
.player-section {
  margin-top: 2rem;
}
.source-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}
.source-selector button {
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: none;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}
.source-selector button.active {
  background: var(--accent);
}
.player-container iframe {
  width: 100%;
  height: 600px;
  min-height: 400px;
  border-radius: 8px;
  border: none;
}

/* Rating Widget */
.rating-widget {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: 8px;
}
.rating-widget span {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}
.star-buttons {
  display: flex;
  gap: 0.5rem;
}
.star-btn {
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--text-secondary);
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}
.star-btn:hover {
  background: var(--bg-card);
  border-color: var(--accent);
}
.star-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}

/* Auth Pages */
.auth-container {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--bg-secondary);
  border-radius: 8px;
}
.auth-container h1 {
  margin-bottom: 1.5rem;
}
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}
.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 4px;
  background: var(--bg-card);
  color: white;
}
.auth-container button {
  width: 100%;
  padding: 0.75rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 1rem;
}
.error {
  padding: 0.75rem;
  background: #ff4444;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* Watchlist & History */
.watchlist-page,
.history-page {
  padding: 2rem;
}
.watchlist-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.watchlist-filters button {
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: none;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}
.watchlist-filters button.active {
  background: var(--accent);
}

.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.watchlist-item {
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
}
.watchlist-item img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
}
.watchlist-item-info {
  padding: 1rem;
}
.watchlist-item-info h3 {
  margin-bottom: 0.5rem;
}
.btn-mark,
.btn-remove {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 0.5rem;
  margin-top: 0.5rem;
}
.btn-mark {
  background: var(--accent);
  color: white;
}
.btn-remove {
  background: var(--bg-primary);
  color: var(--text-secondary);
}
.status.watched {
  color: var(--success);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.history-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: 8px;
}
.history-item img {
  width: 60px;
  border-radius: 4px;
}
.history-item-info h3 {
  margin-bottom: 0.25rem;
}
.user-rating {
  color: #ffd700;
}
.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
}

/* Search */
.search-results {
  padding: 2rem;
}
.search-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.search-filters a {
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  color: white;
  text-decoration: none;
  border-radius: 4px;
}
.search-filters a.active {
  background: var(--accent);
}
.no-results {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
  .detail-header {
    flex-direction: column;
  }
  .detail-poster {
    width: 100%;
    max-width: 300px;
  }
  .navbar {
    flex-wrap: wrap;
  }
  .search-form {
    order: 3;
    max-width: 100%;
    width: 100%;
    margin-top: 1rem;
  }
  .player-container iframe {
    min-height: 250px;
  }
}

/* Discover Page */
.discover-page { padding: 2rem; }
.discover-filters {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.filter-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.filter-group select {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--text-secondary);
    border-radius: 4px;
    color: white;
    min-width: 120px;
}
.btn-search {
    padding: 0.5rem 2rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}
.results-count {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Stats Page */
.stats-page { padding: 2rem; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
}
.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
}
.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.stats-section {
    margin-top: 2rem;
}
.stats-section h2 {
    margin-bottom: 1rem;
}
.genre-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 500px;
}
.genre-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.genre-name {
    width: 100px;
    font-size: 0.9rem;
}
.genre-progress {
    flex: 1;
    height: 20px;
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
}
.genre-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ff6b6b);
    border-radius: 10px;
}
.genre-count {
    width: 30px;
    text-align: right;
    color: var(--text-secondary);
}

/* Progress Bar for Continue Watching */
.continue-card .progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255,255,255,0.3);
}
.continue-card .progress-fill {
    height: 100%;
    background: var(--accent);
}
.continue-card {
    position: relative;
}
.card-episode {
    display: block;
    font-size: 0.75rem;
    color: var(--accent);
    margin-top: 0.25rem;
}

/* Similar Section */
.similar-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--bg-card);
}
.similar-section h2 {
    margin-bottom: 1rem;
}

/* Resume Badge */
.resume-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--accent);
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Media card year display */
.media-card .year {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
