/* Netflix Clone - Main Stylesheet */

/* ─── Reset & Variables ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #e50914;
  --red-dark: #b20710;
  --bg: #141414;
  --bg2: #181818;
  --bg3: #222222;
  --text: #e5e5e5;
  --text-muted: #999;
  --nav-h: 68px;
  --card-w: 220px;
  --radius: 4px;
  --transition: 0.2s ease;
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: 'Netflix Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; min-height: 100vh; overflow-x: hidden; }

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; outline: none; }
img { display: block; }
input, select { outline: none; }

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

/* ─── Navbar ─────────────────────────────────────────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--nav-h); padding: 0 4%;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent);
  transition: background 0.4s;
}
.navbar.scrolled { background: rgba(20,20,20,0.98); backdrop-filter: blur(8px); }
.nav-left { display: flex; align-items: center; gap: 32px; }
.logo { color: var(--red); font-size: 2rem; font-weight: 900; letter-spacing: -1px; user-select: none; }
.nav-links { display: flex; gap: 20px; }
.nav-links a { font-size: 0.9rem; color: var(--text-muted); transition: color var(--transition); }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-right { display: flex; align-items: center; gap: 20px; }
.nav-search-form { display: flex; align-items: center; background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.2); border-radius: 3px; overflow: hidden; transition: width 0.3s; }
.nav-search-input { background: none; border: none; color: var(--text); padding: 6px 10px; font-size: 0.9rem; width: 200px; }
.nav-search-input::placeholder { color: var(--text-muted); }
.nav-search-btn { background: none; color: var(--text-muted); padding: 6px 10px; font-size: 1rem; transition: color var(--transition); }
.nav-search-btn:hover { color: var(--text); }
.nav-user { display: flex; align-items: center; gap: 10px; position: relative; }
.avatar { width: 34px; height: 34px; border-radius: 4px; background: var(--red); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; cursor: pointer; }
.nav-dropdown { position: absolute; top: calc(100% + 10px); right: 0; background: rgba(0,0,0,0.9); border: 1px solid #444; border-radius: 4px; min-width: 160px; display: none; flex-direction: column; overflow: hidden; }
.nav-user:hover .nav-dropdown { display: flex; }
.nav-dropdown a, .nav-dropdown button { padding: 10px 16px; font-size: 0.9rem; color: var(--text-muted); text-align: left; background: none; width: 100%; transition: background var(--transition), color var(--transition); }
.nav-dropdown a:hover, .nav-dropdown button:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.nav-login { display: flex; gap: 12px; }
.btn { padding: 8px 18px; border-radius: var(--radius); font-size: 0.9rem; font-weight: 600; transition: background var(--transition), transform var(--transition); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-dark); transform: scale(1.03); }
.btn-outline { background: rgba(255,255,255,0.1); color: var(--text); border: 1px solid rgba(255,255,255,0.3); }
.btn-outline:hover { background: rgba(255,255,255,0.2); }
.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; }
.hamburger span { display: block; width: 24px; height: 2px; background: var(--text); transition: var(--transition); }

/* ─── Hero / Carousel ────────────────────────────────────────────────────────── */
.hero {
  position: relative; height: 100vh; min-height: 600px;
  display: flex; align-items: center; overflow: hidden;
}
.hero-slide { position: absolute; inset: 0; opacity: 0; transition: opacity 0.8s ease; }
.hero-slide.active { opacity: 1; }
.hero-bg { width: 100%; height: 100%; object-fit: cover; }
.hero-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.85) 40%, transparent 70%),
              linear-gradient(to top, rgba(20,20,20,1) 0%, transparent 30%);
}
.hero-content { position: absolute; left: 4%; bottom: 20%; max-width: 500px; z-index: 2; }
.hero-badge { display: inline-block; background: var(--red); color: #fff; font-size: 0.75rem; font-weight: 700; padding: 3px 8px; border-radius: 2px; margin-bottom: 12px; letter-spacing: 1px; text-transform: uppercase; }
.hero-title { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.1; margin-bottom: 14px; text-shadow: 2px 2px 8px rgba(0,0,0,0.5); }
.hero-meta { display: flex; gap: 14px; margin-bottom: 14px; font-size: 0.9rem; color: var(--text-muted); align-items: center; flex-wrap: wrap; }
.hero-rating { color: #f5c518; font-weight: 600; }
.hero-desc { font-size: 1rem; line-height: 1.6; color: rgba(229,229,229,0.85); margin-bottom: 24px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-hero { padding: 12px 28px; border-radius: var(--radius); font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; transition: var(--transition); }
.btn-hero-play { background: #fff; color: #000; }
.btn-hero-play:hover { background: rgba(255,255,255,0.85); }
.btn-hero-info { background: rgba(109,109,110,0.7); color: #fff; }
.btn-hero-info:hover { background: rgba(109,109,110,0.5); }
.hero-dots { position: absolute; bottom: 10%; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 3; }
.hero-dot { width: 10px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.4); cursor: pointer; transition: all 0.3s; }
.hero-dot.active { width: 24px; background: var(--red); }

/* ─── Content Rows ───────────────────────────────────────────────────────────── */
.content-section { padding: 20px 4%; }
.section-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 12px; }
.section-title .see-all { font-size: 0.85rem; color: var(--red); cursor: pointer; font-weight: 400; }
.section-title .see-all:hover { text-decoration: underline; }
.cards-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; }
.cards-row::-webkit-scrollbar { height: 4px; }

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  flex: 0 0 var(--card-w); cursor: pointer;
  transition: transform 0.3s ease, z-index 0s;
  position: relative; border-radius: var(--radius); overflow: hidden;
}
.card:hover { transform: scale(1.08); z-index: 10; }
.card-img-wrap { position: relative; aspect-ratio: 16/9; background: var(--bg3); border-radius: var(--radius); overflow: hidden; }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.card:hover .card-img-wrap img { transform: scale(1.05); }
.card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 50%);
  opacity: 0; transition: opacity 0.3s;
  display: flex; flex-direction: column; justify-content: space-between; padding: 8px;
}
.card:hover .card-overlay { opacity: 1; }
.card-actions { display: flex; gap: 6px; }
.btn-play, .btn-watchlist {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; transition: transform var(--transition);
}
.btn-play { background: #fff; color: #000; }
.btn-play:hover { transform: scale(1.1); }
.btn-watchlist { background: rgba(40,40,40,0.9); color: #fff; border: 2px solid rgba(255,255,255,0.5); font-size: 1rem; font-weight: 700; }
.btn-watchlist:hover { border-color: #fff; transform: scale(1.1); }
.btn-watchlist.active { background: var(--red); border-color: var(--red); }
.card-info { display: flex; gap: 8px; font-size: 0.7rem; color: rgba(229,229,229,0.85); align-items: center; flex-wrap: wrap; }
.card-rating { color: #f5c518; }
.card-title { font-size: 0.82rem; font-weight: 600; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.progress-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: rgba(255,255,255,0.2); }
.progress-fill { height: 100%; background: var(--red); }

/* ─── Grid Layout ────────────────────────────────────────────────────────────── */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cards-grid .card { flex: none; width: 100%; }

/* ─── Browse Page ────────────────────────────────────────────────────────────── */
.browse-header { padding: calc(var(--nav-h) + 20px) 4% 20px; }
.browse-title { font-size: 1.8rem; font-weight: 700; margin-bottom: 20px; }
.search-bar { display: flex; gap: 0; max-width: 500px; margin-bottom: 24px; border: 1px solid rgba(255,255,255,0.2); border-radius: var(--radius); overflow: hidden; background: var(--bg3); }
.search-bar input { flex: 1; background: none; border: none; color: var(--text); padding: 12px 16px; font-size: 1rem; }
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar button { background: var(--red); color: #fff; padding: 12px 20px; font-size: 1rem; }
.search-bar button:hover { background: var(--red-dark); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.filter-btn { padding: 7px 16px; border-radius: 20px; font-size: 0.85rem; background: var(--bg3); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.1); transition: var(--transition); }
.filter-btn:hover { border-color: rgba(255,255,255,0.3); color: var(--text); }
.filter-btn.active { background: var(--red); color: #fff; border-color: var(--red); }
.type-tabs { display: flex; gap: 16px; margin-bottom: 24px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.type-tab { padding: 10px 0; font-size: 0.95rem; color: var(--text-muted); border-bottom: 2px solid transparent; transition: var(--transition); cursor: pointer; }
.type-tab.active { color: var(--text); border-bottom-color: var(--red); }
.results-count { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 16px; }

/* ─── Auth Page ──────────────────────────────────────────────────────────────── */
.auth-page { min-height: 100vh; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-bg { position: fixed; inset: 0; z-index: -1; }
.auth-bg img { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.35); }
.auth-box { background: rgba(0,0,0,0.85); padding: 48px 56px; border-radius: 8px; width: 100%; max-width: 440px; }
.auth-logo { color: var(--red); font-size: 2.2rem; font-weight: 900; margin-bottom: 32px; display: block; }
.auth-title { font-size: 2rem; font-weight: 700; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
.form-group input { width: 100%; background: #333; border: 1px solid #555; color: var(--text); padding: 14px 16px; border-radius: var(--radius); font-size: 1rem; transition: border-color var(--transition); }
.form-group input:focus { border-color: var(--red); }
.form-group input.error { border-color: #e87c03; }
.form-error { color: #e87c03; font-size: 0.82rem; margin-top: 4px; }
.btn-auth { width: 100%; padding: 16px; background: var(--red); color: #fff; border-radius: var(--radius); font-size: 1rem; font-weight: 700; margin-top: 24px; transition: background var(--transition); }
.btn-auth:hover { background: var(--red-dark); }
.auth-switch { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 0.9rem; }
.auth-switch a { color: var(--text); cursor: pointer; }
.auth-switch a:hover { text-decoration: underline; }
.auth-divider { border: none; border-top: 1px solid #444; margin: 24px 0; }

/* ─── Watch Page ─────────────────────────────────────────────────────────────── */
.watch-page { background: #000; min-height: 100vh; }
.player-wrap { position: relative; width: 100%; background: #000; }
.player-wrap video { width: 100%; max-height: 75vh; display: block; }
.player-controls {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.9));
  padding: 40px 20px 16px; opacity: 0; transition: opacity 0.3s;
}
.player-wrap:hover .player-controls { opacity: 1; }
.player-progress { width: 100%; height: 4px; background: rgba(255,255,255,0.3); border-radius: 2px; cursor: pointer; margin-bottom: 12px; position: relative; }
.player-progress:hover { height: 6px; }
.player-progress-fill { height: 100%; background: var(--red); border-radius: 2px; pointer-events: none; }
.player-btns { display: flex; align-items: center; gap: 16px; }
.player-btn { background: none; color: #fff; font-size: 1.2rem; padding: 4px; transition: transform var(--transition); }
.player-btn:hover { transform: scale(1.15); }
.player-time { color: rgba(255,255,255,0.7); font-size: 0.85rem; }
.player-vol { display: flex; align-items: center; gap: 8px; }
.vol-slider { width: 80px; height: 4px; background: rgba(255,255,255,0.3); border-radius: 2px; cursor: pointer; accent-color: var(--red); }
.player-title-bar { padding: 16px 20px; color: var(--text-muted); font-size: 0.9rem; }
.player-title-bar h2 { font-size: 1.4rem; color: var(--text); margin-bottom: 4px; }
.watch-info { padding: 24px 4%; max-width: 900px; }
.watch-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.watch-genre-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.genre-tag { padding: 4px 12px; border-radius: 20px; background: var(--bg3); font-size: 0.8rem; color: var(--text-muted); border: 1px solid rgba(255,255,255,0.1); }
.watch-desc { line-height: 1.7; color: rgba(229,229,229,0.85); margin-bottom: 20px; }
.watch-cast { color: var(--text-muted); font-size: 0.9rem; }
.watch-cast span { color: var(--text); }
.btn-back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 16px; transition: color var(--transition); }
.btn-back:hover { color: var(--text); }

/* ─── Watchlist Page ─────────────────────────────────────────────────────────── */
.page-header { padding: calc(var(--nav-h) + 30px) 4% 20px; }
.page-title { font-size: 2rem; font-weight: 700; margin-bottom: 8px; }
.page-subtitle { color: var(--text-muted); margin-bottom: 24px; }
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 4rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1.4rem; margin-bottom: 8px; color: var(--text); }
.empty-state p { margin-bottom: 24px; }

/* ─── Recommendations ────────────────────────────────────────────────────────── */
.recommendations { padding: 20px 4%; }
.recommendations h3 { font-size: 1.2rem; margin-bottom: 14px; }

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--bg2); border-radius: 8px; width: 100%; max-width: 680px; max-height: 90vh; overflow-y: auto; }
.modal-header { position: relative; aspect-ratio: 16/7; overflow: hidden; }
.modal-header img { width: 100%; height: 100%; object-fit: cover; }
.modal-gradient { position: absolute; inset: 0; background: linear-gradient(to top, var(--bg2) 0%, transparent 50%); }
.modal-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; background: rgba(0,0,0,0.7); color: #fff; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; }
.modal-body { padding: 20px 24px 28px; }
.modal-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 10px; }
.modal-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; font-size: 0.9rem; color: var(--text-muted); }
.modal-desc { line-height: 1.7; margin-bottom: 20px; color: rgba(229,229,229,0.85); }
.modal-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* ─── Toast ──────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(30,30,30,0.95); color: #fff; padding: 12px 24px; border-radius: 4px;
  font-size: 0.9rem; z-index: 9999; opacity: 0; pointer-events: none; transition: all 0.3s;
  border-left: 3px solid var(--red);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
footer { background: #000; padding: 40px 4%; margin-top: 40px; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.footer-links a { color: var(--text-muted); font-size: 0.85rem; transition: color var(--transition); }
.footer-links a:hover { color: var(--text); }
.footer-copy { color: #555; font-size: 0.8rem; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --card-w: 170px; }
  .nav-links { display: none; }
  .nav-links.open { display: flex; flex-direction: column; position: fixed; top: var(--nav-h); left: 0; right: 0; background: rgba(0,0,0,0.97); padding: 20px 4%; gap: 16px; border-top: 1px solid #333; }
  .hamburger { display: flex; }
  .nav-search-input { width: 140px; }
  .auth-box { padding: 36px 28px; }
  .hero-content { bottom: 12%; }
}
@media (max-width: 600px) {
  :root { --card-w: 145px; }
  .hero-title { font-size: 1.8rem; }
  .hero-desc { display: none; }
  .btn-hero { padding: 10px 18px; font-size: 0.9rem; }
  .auth-box { padding: 28px 20px; }
  .auth-title { font-size: 1.6rem; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); }
  .nav-search-form { display: none; }
}
@media (max-width: 400px) {
  :root { --card-w: 130px; }
}

/* ─── Loading skeleton ───────────────────────────────────────────────────────── */
.skeleton { animation: shimmer 1.5s infinite; background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%); background-size: 200% 100%; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ─── Profile Page ───────────────────────────────────────────────────────────── */
.profile-page { padding: calc(var(--nav-h) + 40px) 4% 40px; max-width: 700px; margin: 0 auto; }
.profile-card { background: var(--bg2); border-radius: 8px; padding: 32px; margin-bottom: 24px; }
.profile-avatar { width: 80px; height: 80px; border-radius: 8px; background: var(--red); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; font-weight: 700; margin-bottom: 16px; }
.profile-name { font-size: 1.6rem; font-weight: 700; }
.profile-email { color: var(--text-muted); margin-top: 4px; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
.stat-box { background: var(--bg3); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-num { font-size: 1.8rem; font-weight: 700; color: var(--red); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
