/* =========================================================
   AURELIA STREAM — Netflix-Style Dark Theme
   ========================================================= */

:root {
  --bg-primary: #141414;
  --bg-secondary: #1a1a1a;
  --bg-card: #1f1f1f;
  --bg-card-hover: #2a2a2a;
  --bg-input: #333;
  --bg-modal: #181818;
  --text-primary: #fff;
  --text-secondary: #b3b3b3;
  --text-muted: #777;
  --accent: #e50914;
  --accent-hover: #f40612;
  --accent-glow: rgba(229, 9, 20, 0.4);
  --border: #333;
  --navbar-bg: rgba(20, 20, 20, 0.95);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.6);
  --shadow-card: 0 4px 20px rgba(0,0,0,0.5);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
  --transition-slow: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input { border: none; outline: none; font-family: inherit; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #555; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #777; }

/* ========== NAVBAR ========== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 60px;
  height: 68px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
  transition: background 0.4s ease;
}
.navbar.scrolled { background: var(--navbar-bg); backdrop-filter: blur(10px); }

.nav-left { display: flex; align-items: center; gap: 40px; }

.logo { font-size: 28px; font-weight: 900; letter-spacing: -1px; color: var(--accent); user-select: none; }
.logo span { color: var(--text-primary); font-weight: 700; }

.nav-links { display: flex; list-style: none; gap: 8px; }
.nav-link { padding: 8px 16px; border-radius: 4px; font-size: 14px; font-weight: 500; color: var(--text-secondary); transition: color 0.2s; }
.nav-link:hover, .nav-link.active { color: var(--text-primary); }
.nav-link.active { font-weight: 600; }

.nav-right { display: flex; align-items: center; gap: 20px; }

.search-trigger {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: transparent; color: var(--text-primary);
  transition: background 0.2s;
  cursor: pointer; border: none;
}
.search-trigger:hover { background: rgba(255,255,255,0.1); }

/* ========== SEARCH OVERLAY (Netflix-style) ========== */
.search-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,0.97);
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.search-overlay.active { opacity: 1; pointer-events: all; }

.search-overlay-top {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 48px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
@media (max-width: 640px) {
  .search-overlay-top { padding: 16px 20px; gap: 8px; }
}

.search-overlay-icon {
  color: var(--text-muted); flex-shrink: 0;
}
#searchOverlayInput {
  flex: 1;
  background: transparent; border: none; outline: none;
  color: var(--text-primary);
  font-size: 28px; font-weight: 500; font-family: inherit;
  padding: 4px 0;
}
#searchOverlayInput::placeholder { color: #555; }
@media (max-width: 640px) {
  #searchOverlayInput { font-size: 20px; }
}

.search-overlay-close {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,0.08); color: var(--text-muted);
  transition: all 0.2s; flex-shrink: 0;
}
.search-overlay-close:hover { background: rgba(255,255,255,0.2); color: var(--text-primary); }

.search-overlay-results {
  flex: 1; overflow-y: auto;
  padding: 30px 48px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  align-content: start;
  justify-items: center;
}
@media (max-width: 640px) {
  .search-overlay-results {
    padding: 12px;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .search-overlay-top { padding: 10px 14px; gap: 6px; }
  #searchOverlayInput { font-size: 17px; }
}
@media (max-width: 380px) {
  .search-overlay-results {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 641px) and (max-width: 1024px) {
  .search-overlay-results {
    padding: 24px 32px;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
}

.search-overlay-placeholder {
  grid-column: 1/-1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 20px; gap: 16px;
  color: var(--text-muted);
}
.search-overlay-placeholder p { font-size: 16px; }
@media (max-width: 640px) {
  .search-overlay-placeholder p { font-size: 14px; }
}

.search-overlay-card {
  border-radius: 4px; cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  background: var(--bg-card);
  display: flex; flex-direction: column;
  width: 100%; max-width: 200px;
}
.search-overlay-card:hover { transform: scale(1.04); box-shadow: var(--shadow-card); }
.search-overlay-card .card-img-wrapper {
  aspect-ratio: 2/3;
  position: relative;
  overflow: hidden;
  border-radius: 4px 4px 0 0;
}
.search-overlay-card .card-img-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.search-overlay-card .card-info {
  position: static; opacity: 1;
  padding: 10px;
  background: var(--bg-card);
}
.search-overlay-card .card-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-overlay-card .card-meta { font-size: 11px; color: var(--text-secondary); margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-overlay-card .card-type { padding: 2px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; background: var(--accent); color: white; }
.search-overlay-card .card-rating { color: #46d369; font-weight: 600; }

.search-overlay-loading {
  grid-column: 1/-1; text-align: center; padding: 40px; color: var(--text-muted);
}

/* Remove old search styles */
.search-box, .search-icon, #searchInput, .search-results, .search-result-item,
.search-result-info, .search-result-title, .search-result-meta, .search-result-provider { display: none; }

/* ========== HERO ========== */
.hero {
  position: relative;
  height: 85vh; min-height: 500px;
  display: flex; align-items: flex-end;
  padding: 0 60px 80px;
  margin-bottom: 10px;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center top;
}
.hero-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(77deg, rgba(0,0,0,0.8) 0%, transparent 50%, transparent 70%, rgba(0,0,0,0.4) 100%),
              linear-gradient(to top, var(--bg-primary) 0%, transparent 50%);
}
.hero-content { position: relative; max-width: 550px; animation: fadeInUp 0.8s ease; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-title { font-size: clamp(2rem, 4vw, 3.5rem); font-weight: 900; line-height: 1.1; margin-bottom: 16px; text-shadow: 2px 2px 8px rgba(0,0,0,0.6); }
.hero-desc { font-size: 16px; color: var(--text-secondary); margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 1px 1px 4px rgba(0,0,0,0.8); }
.hero-meta { display: flex; gap: 16px; font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }
.hero-meta .rating { color: #46d369; font-weight: 700; }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: 4px;
  font-size: 16px; font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: scale(1.05); }
.btn-secondary { background: rgba(109,109,110,0.7); color: white; }
.btn-secondary:hover { background: rgba(109,109,110,0.5); }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.1); color: white;
  transition: background 0.2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.2); }
.btn-back { color: var(--text-secondary); font-size: 14px; font-weight: 500; padding: 8px 16px; }
.btn-back:hover { color: var(--text-primary); }
.btn-lg { padding: 14px 32px; font-size: 18px; }

/* ========== CONTENT ROWS ========== */
.content-rows { padding: 0 0 40px; }
.content-row { margin-bottom: 40px; padding: 0 60px; }
.row-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.row-header h3 { font-size: 22px; font-weight: 700; }
.row-header .row-subtitle { font-size: 13px; color: var(--accent); font-weight: 600; cursor: pointer; opacity: 0; transition: opacity 0.2s; }
.content-row:hover .row-subtitle { opacity: 1; }

.row-cards { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; scroll-behavior: smooth; }
.row-cards::-webkit-scrollbar { display: none; }
.row-cards { -ms-overflow-style: none; scrollbar-width: none; }

/* ========== CARDS ========== */
.card {
  flex: 0 0 200px;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.4s ease;
  z-index: 1;
}
.card:hover { transform: scale(1.15) translateY(-10px); box-shadow: var(--shadow-lg); z-index: 10; }
.card-img-wrapper { aspect-ratio: 2/3; background: var(--bg-card); overflow: hidden; }
.card-img-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.card:hover .card-img-wrapper img { transform: scale(1.05); }

.card-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2a2a2a, #333);
  color: var(--text-muted); font-size: 13px;
}

.card-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 40px 10px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.95), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.card:hover .card-info { opacity: 1; }
.card-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { font-size: 11px; color: var(--text-secondary); margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.card-rating { color: #46d369; font-weight: 600; }
.card-type { padding: 2px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; background: var(--accent); }

/* ========== GRID ========== */
.content-section { padding: 100px 60px 40px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.section-header h2 { font-size: 28px; font-weight: 800; }

.genre-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.genre-tag { padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 500; background: var(--bg-card); color: var(--text-secondary); transition: all 0.2s; }
.genre-tag:hover, .genre-tag.active { background: var(--text-primary); color: #000; }

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

.grid-card { border-radius: 4px; overflow: hidden; cursor: pointer; transition: transform 0.3s, box-shadow 0.3s; }
.grid-card:hover { transform: scale(1.05); box-shadow: var(--shadow-card); }
.grid-card .card-img-wrapper { aspect-ratio: 2/3; }
.grid-card .card-info { position: static; opacity: 1; padding: 10px; background: var(--bg-card); }
.grid-card:hover .card-info { background: var(--bg-card-hover); }

.load-more { text-align: center; padding: 20px; }

/* ========== PLAYER ========== */
.player-container { padding: 80px 40px 40px; max-width: 1200px; margin: 0 auto; min-height: 100vh; }
.player-header { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.player-header h2 { font-size: 22px; font-weight: 700; }

.player-wrapper {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16/9;
  display: flex; align-items: center; justify-content: center;
}
.player-wrapper video, .player-wrapper iframe { width: 100%; height: 100%; border: none; }
.player-loading, .player-error { display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--text-secondary); padding: 40px; }
.player-error svg { opacity: 0.5; }

.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.player-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-top: 16px; padding: 12px 0; }
.server-selector { display: flex; align-items: center; gap: 10px; }
.server-selector label { font-size: 14px; color: var(--text-secondary); }
.server-selector select {
  padding: 8px 12px; border-radius: 4px;
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border);
  font-size: 14px; font-family: inherit; cursor: pointer;
}
.player-servers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; justify-content: center; }
.server-btn { padding: 8px 16px; border-radius: 4px; background: rgba(255,255,255,0.1); color: var(--text-primary); font-size: 13px; transition: background 0.2s; }
.server-btn:hover { background: var(--accent); }

.episode-controls { display: flex; align-items: center; gap: 12px; }
.episode-controls span { font-size: 14px; color: var(--text-secondary); }

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  position: relative;
  width: 90%; max-width: 850px; max-height: 90vh;
  background: var(--bg-modal);
  border-radius: 12px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute; top: 12px; right: 16px; z-index: 10;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: white; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.2); }

.modal-bg { height: 350px; background-size: cover; background-position: center; position: relative; }
.modal-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg-modal), transparent 60%); }
.modal-content { padding: 0 40px 30px; margin-top: -100px; position: relative; }
.modal-header { margin-bottom: 20px; }
.modal-header h2 { font-size: 28px; font-weight: 800; }
.modal-meta { display: flex; gap: 16px; font-size: 14px; color: var(--text-secondary); margin-top: 8px; }
.modal-body { display: flex; gap: 30px; }
.modal-left { flex-shrink: 0; width: 200px; }
.modal-poster { border-radius: 8px; width: 100%; }
.modal-right { flex: 1; min-width: 0; }
.modal-desc { font-size: 15px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 16px; }
.modal-details { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.modal-details span { display: inline-block; margin-right: 16px; margin-bottom: 4px; }
.modal-seasons { margin-bottom: 16px; }
.modal-seasons select { padding: 10px 16px; border-radius: 4px; background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); font-size: 14px; font-family: inherit; cursor: pointer; }
.modal-episodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 6px; margin-bottom: 20px; max-height: 200px; overflow-y: auto; }
.ep-btn { padding: 8px; border-radius: 4px; text-align: center; font-size: 13px; font-weight: 500; background: var(--bg-card); color: var(--text-secondary); transition: all 0.2s; }
.ep-btn:hover { background: var(--accent); color: white; }

/* ========== PAGES ========== */
.page { display: none; }
.page.active { display: block; }

/* ========== FOOTER ========== */
.footer { padding: 40px 60px; border-top: 1px solid var(--border); margin-top: 40px; }
.footer-content { text-align: center; font-size: 13px; color: var(--text-muted); }
.footer-content a { color: var(--text-secondary); transition: color 0.2s; }
.footer-content a:hover { color: var(--text-primary); }
.footer-disclaimer { margin-top: 8px; font-size: 11px; }

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .navbar { padding: 0 30px; }
  .nav-links { display: none; }
  .hero { padding: 0 30px 60px; height: 70vh; }
  .content-row { padding: 0 30px; }
  .content-section { padding: 90px 30px 30px; }
  .modal-body { flex-direction: column; }
  .modal-left { width: 150px; }
  .player-container { padding: 80px 20px 20px; }
}

@media (max-width: 640px) {
  .navbar { padding: 0 16px; }
  .logo { font-size: 22px; }
  .hero { padding: 0 16px 60px; height: 60vh; }
  .hero-actions { flex-direction: column; }
  .content-row { padding: 0 16px; }
  .row-header h3 { font-size: 18px; }
  .card { flex: 0 0 150px; }
  .grid-container { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .content-section { padding: 80px 16px 20px; }
  .footer { padding: 30px 16px; }
}

.hidden { display: none !important; }

/* ========== VARIANT SELECTOR ========== */
.variant-selector {
  display: flex; align-items: center; gap: 8px;
}
.variant-selector label { font-size: 14px; color: var(--text-secondary); }
.variant-btn {
  padding: 6px 16px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
  background: var(--bg-card); color: var(--text-secondary);
  transition: all 0.2s; cursor: pointer; border: none; font-family: inherit;
}
.variant-btn.active, .variant-btn:hover { background: var(--accent); color: white; }

/* ========== REVIEWS ========== */
.modal-reviews {
  padding: 20px 40px 30px; border-top: 1px solid var(--border);
  margin-top: 20px;
}
.reviews-section h3 {
  font-size: 20px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px;
}
.review-avg { color: #f5ad3d; font-size: 16px; font-weight: 600; }

.review-form {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 20px; padding: 14px;
  background: var(--bg-card); border-radius: 8px;
}
.review-stars { display: flex; gap: 4px; }
.star {
  font-size: 24px; color: #555; cursor: pointer;
  transition: color 0.15s;
}
.star:hover, .star.active { color: #f5ad3d; }

.review-input {
  padding: 10px 14px; border-radius: 6px;
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border); font-size: 14px; font-family: inherit;
  resize: vertical;
}
.review-input::placeholder { color: var(--text-muted); }
.btn-sm { padding: 8px 20px; font-size: 14px; }

.review-item {
  padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.review-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 4px; font-size: 14px;
}
.review-header strong { color: var(--text-primary); }
.review-stars-display { color: #f5ad3d; font-weight: 600; }
.review-date { color: var(--text-muted); font-size: 12px; margin-left: auto; }
.review-item p { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

.server-btn.active { background: var(--accent) !important; }

/* ========== WATCHED ========== */
.watched-badge {
  position: absolute; top: 6px; left: 6px; z-index: 5;
  padding: 3px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700;
  background: #46d369; color: #000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.6);
  pointer-events: none;
}

.btn-lg.watched-active {
  background: #46d369; color: #000;
}

/* ========== SEASON SELECTOR ========== */
.season-selector {
  display: flex; align-items: center; gap: 10px;
}
.season-selector label { font-size: 14px; color: var(--text-secondary); }
.season-selector select {
  padding: 8px 12px; border-radius: 4px;
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border);
  font-size: 14px; font-family: inherit; cursor: pointer;
}

.card-year { color: var(--text-muted); font-size: 11px; }

/* ========== EPISODE REVIEWS ========== */
.ep-reviews-container {
  max-width: 1200px; margin: 0 auto; padding: 0 40px 40px;
}
.ep-reviews h3 {
  font-size: 18px; font-weight: 700; margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
}
.ep-reviews .review-form { margin-bottom: 16px; }
#epSelect {
  padding: 4px 8px; border-radius: 4px;
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border);
  font-size: 13px; font-family: inherit; cursor: pointer;
  max-width: 100px;
}

@media (max-width: 640px) {
  .ep-reviews-container { padding: 0 16px 20px; }
}
