/* ============ FlixMine design system ============ */
:root {
  --bg: #09070E;
  --primary: #A855F7;
  --primary-dark: #7C3AED;
  --youtube-red: #FF0000;
  --white: #FFFFFF;

  --text-focused: rgba(255,255,255,0.7);
  --text-section: rgba(255,255,255,0.6);
  --text-meta: rgba(255,255,255,0.45);
  --text-inactive-tab: rgba(255,255,255,0.38);
  --text-description: rgba(255,255,255,0.35);
  --text-label: rgba(255,255,255,0.3);
  --text-attribution: rgba(255,255,255,0.25);

  --surface-button: rgba(255,255,255,0.06);
  --surface-border: rgba(255,255,255,0.08);
  --surface-poster-border: rgba(255,255,255,0.05);

  --primary-rating-bg: rgba(168,85,247,0.2);
  --primary-tab-bg: rgba(168,85,247,0.18);
  --primary-poster-border: rgba(168,85,247,0.15);
  --primary-button-bg: rgba(168,85,247,0.12);
  --primary-pill-bg: rgba(168,85,247,0.08);

  --font-display: 'Chakra Petch', sans-serif;
  --font-body: 'Space Grotesk', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-body);
  overflow-x: hidden;
}
button { font-family: var(--font-body); cursor: pointer; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(168,85,247,0.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(168,85,247,0.5); }

/* ============ Logo ============ */
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark svg { width: 22px; height: 22px; }
.logo-mark-lg { width: 56px; height: 56px; border-radius: 16px; }
.logo-mark-lg svg { width: 38px; height: 38px; }
.wordmark {
  font-family: var(--font-display); font-weight: 700;
  font-size: 18px; letter-spacing: 2px; color: var(--white);
}
.wordmark em { font-style: normal; color: var(--primary); }
.wordmark-lg { font-size: 34px; letter-spacing: 4px; }

/* ============ Nav ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  padding: 18px 40px;
  background: linear-gradient(to bottom, rgba(9,7,14,0.9), rgba(9,7,14,0));
}
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: transparent; border: none;
  color: var(--text-inactive-tab);
  font-size: 14px; font-weight: 500;
  padding: 7px 14px; border-radius: 999px;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.tab:hover { color: var(--text-focused); }
.tab.active { background: var(--primary-tab-bg); color: var(--white); }
.nav-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-button); border: 1px solid var(--surface-border);
  color: var(--text-focused);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--primary-tab-bg); color: var(--white); }

/* ============ Splash ============ */
.splash {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(ellipse at 20% 0%, rgba(45,20,65,0.5), transparent 60%), var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
}
.splash-logo { display: flex; align-items: center; gap: 16px; }
.splash-status { color: var(--text-label); font-size: 14px; }
.splash-status.error { color: #EF4444; }

/* ============ Hero ============ */
.browse { min-height: 100vh; display: flex; flex-direction: column; }
.hero { position: relative; height: 62vh; min-height: 420px; }
.hero-backdrop, .detail-backdrop {
  position: absolute; inset: 0;
  background-size: cover; background-position: center 20%;
  transition: opacity .5s ease;
}
.hero-tint {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 0% 0%, rgba(45,20,65,0.5), transparent 65%);
}
.hero-fade-left {
  position: absolute; inset: 0;
  background: linear-gradient(to right, var(--bg) 0%, rgba(9,7,14,0.85) 25%, rgba(9,7,14,0) 65%);
}
.hero-fade-bottom {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg) 0%, rgba(9,7,14,0) 40%);
}
.hero-content {
  position: relative; z-index: 2;
  height: 100%; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 40px 24px; max-width: 640px;
}
.hero-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(34px, 5vw, 58px); line-height: 0.95;
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 16px;
}
.meta-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.rating-badge {
  background: var(--primary-rating-bg); color: var(--primary);
  font-weight: 600; font-size: 13px;
  padding: 3px 9px; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 4px;
}
.meta-text { color: var(--text-meta); font-size: 14px; font-weight: 500; }
.meta-dot { color: var(--text-meta); font-size: 10px; }
.hero-overview {
  color: var(--text-description); font-size: 14.5px; line-height: 1.55;
  margin-bottom: 18px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.source-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.yt-label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-label); font-size: 13px; font-weight: 500; }
.yt-icon { width: 22px; height: 16px; }
.channel-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--primary-pill-bg); border: 1px solid var(--primary-poster-border);
  color: rgba(168,85,247,0.85);
  font-size: 12.5px; font-weight: 500;
  padding: 4px 12px 4px 5px; border-radius: 999px;
}
.channel-pill img { width: 20px; height: 20px; border-radius: 50%; }
.channel-pill.no-logo { padding-left: 12px; }

/* ============ Poster rows ============ */
.rows { position: relative; z-index: 3; padding: 0 0 40px; margin-top: -8px; }
.row { margin-bottom: 26px; }
.row-header {
  color: var(--text-section); font-size: 14px; font-weight: 600;
  padding: 0 40px; margin-bottom: 10px;
}
.row-scroller {
  display: flex; gap: 12px; overflow-x: auto;
  padding: 4px 40px 8px;
  scrollbar-width: none;
}
.row-scroller::-webkit-scrollbar { display: none; }
.poster-card {
  flex: 0 0 auto; width: 138px;
  background: none; border: 2px solid var(--surface-poster-border);
  border-radius: 8px; overflow: hidden;
  aspect-ratio: 2 / 3; position: relative;
  padding: 0;
  transition: transform .18s ease, border-color .18s ease;
}
.poster-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster-card:hover, .poster-card:focus-visible {
  transform: scale(1.06);
  border-color: var(--primary);
  outline: none; z-index: 2;
}
.poster-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 12px; text-align: center;
  color: var(--text-label); font-size: 12px; font-weight: 500;
  background: var(--surface-button);
}

/* ============ Detail ============ */
.detail { position: fixed; inset: 0; z-index: 60; background: var(--bg); overflow-y: auto; }
.detail-backdrop { position: fixed; }
.detail-fade {
  position: fixed; inset: 0;
  background:
    linear-gradient(to right, var(--bg) 0%, rgba(9,7,14,0.88) 32%, rgba(9,7,14,0.2) 70%),
    linear-gradient(to top, var(--bg) 6%, rgba(9,7,14,0) 50%);
}
.back-btn {
  background: var(--surface-button); border: 1px solid var(--surface-border);
  color: var(--text-focused); font-size: 13px; font-weight: 500;
  padding: 8px 18px; border-radius: 999px;
  transition: background .15s, color .15s;
}
.back-btn:hover { background: var(--primary-tab-bg); color: var(--white); }
.detail > .back-btn { position: fixed; top: 20px; left: 40px; z-index: 5; }
.detail-body {
  position: relative; z-index: 2;
  min-height: 100vh;
  display: flex; align-items: flex-end; gap: 36px;
  padding: 110px 40px 60px;
  max-width: 1100px;
}
.detail-poster {
  width: 220px; flex-shrink: 0;
  aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--surface-border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.detail-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-info { flex: 1; min-width: 0; }
.detail-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(28px, 4vw, 44px); line-height: 0.95;
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 14px;
}
.detail-overview { color: var(--text-description); font-size: 14.5px; line-height: 1.6; margin: 16px 0; max-width: 620px; }
.credits { margin-bottom: 22px; }
.credit-line { font-size: 13px; margin-bottom: 5px; }
.credit-line .label { color: var(--text-label); }
.credit-line .names { color: var(--text-meta); }
.detail-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.btn-watch {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none; color: var(--white);
  font-size: 14px; font-weight: 600;
  padding: 12px 26px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 9px;
  transition: filter .15s, transform .15s;
}
.btn-watch:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn-watch svg { width: 16px; height: 16px; }
.btn-youtube {
  background: var(--primary-button-bg); border: 1px solid var(--primary-poster-border);
  color: var(--text-focused); font-size: 13px; font-weight: 500;
  padding: 11px 20px; border-radius: 999px;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, color .15s;
}
.btn-youtube:hover { background: var(--primary-tab-bg); color: var(--white); }
.detail-attribution { color: var(--text-attribution); font-size: 11px; }

/* ============ Search ============ */
.search { position: fixed; inset: 0; z-index: 70; background: var(--bg); overflow-y: auto; }
.search-bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 14px;
  padding: 24px 40px;
  background: linear-gradient(to bottom, var(--bg) 70%, rgba(9,7,14,0));
}
.search-bar svg { width: 20px; height: 20px; color: var(--text-label); flex-shrink: 0; }
#search-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--white); font-family: var(--font-body);
  font-size: 22px; font-weight: 500;
}
#search-input::placeholder { color: var(--text-label); }
.search-results {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 14px; padding: 10px 40px 50px;
}
.search-results .poster-card { width: 100%; }
.search-empty { grid-column: 1 / -1; color: var(--text-label); font-size: 14px; padding: 30px 0; text-align: center; }

/* ============ About ============ */
.about {
  position: fixed; inset: 0; z-index: 70;
  background: radial-gradient(ellipse at 20% 0%, rgba(45,20,65,0.4), transparent 60%), var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow-y: auto;
}
.about-back { position: fixed; top: 20px; right: 40px; }
.about-content { max-width: 660px; text-align: center; padding: 40px 24px; }
.about-label { color: var(--primary); font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: 5px; margin-bottom: 20px; }
.about-content h1 { font-family: var(--font-display); font-weight: 700; font-size: 40px; margin-bottom: 6px; }
.about-version { color: var(--text-label); font-size: 14px; margin-bottom: 30px; }
.about-content p { color: var(--text-description); font-size: 15px; line-height: 1.7; margin-bottom: 44px; }
.about-made-by { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-label); font-size: 13px; }
.about-made-by img { height: 30px; opacity: 0.85; transition: opacity .15s, transform .15s; }
.about-made-by a:hover img { opacity: 1; transform: translateY(-1px); }
.tmdb-attribution {
  position: fixed; bottom: 24px; left: 0; right: 0;
  text-align: center; color: var(--text-attribution); font-size: 12px;
}
.tmdb-logo {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  background: linear-gradient(90deg, #90CEA1, #01B4E4);
  color: #0d253f; font-weight: 700; font-size: 10px; letter-spacing: 1px;
  vertical-align: middle;
}

/* ============ Player ============ */
.player {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(9,7,14,0.96);
  display: flex; align-items: center; justify-content: center;
}
.player-close { position: fixed; top: 20px; right: 40px; z-index: 2; }
.player-frame { width: min(1100px, 92vw); aspect-ratio: 16 / 9; }
.player-frame iframe { width: 100%; height: 100%; border: none; border-radius: 10px; }

/* ============ Footer ============ */
.site-footer {
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  padding: 26px 40px 34px;
  color: var(--text-attribution); font-size: 12px; text-align: center;
}

/* ============ Responsive ============ */
@media (max-width: 760px) {
  .nav { padding: 12px 16px; gap: 12px; }
  .wordmark { font-size: 15px; }
  .hero-content, .row-header { padding-left: 16px; padding-right: 16px; }
  .row-scroller { padding-left: 16px; padding-right: 16px; }
  .hero { height: 72vh; }
  .hero-content { max-width: 100%; }
  .poster-card { width: 108px; }
  .detail-body { flex-direction: column; align-items: flex-start; padding: 90px 16px 40px; }
  .detail-poster { width: 150px; }
  .detail > .back-btn { left: 16px; }
  .about-back, .player-close { right: 16px; }
  .search-bar { padding: 16px; }
  .search-results { padding: 10px 16px 40px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .site-footer { padding: 20px 16px 28px; }
}
