/* Watchlio Web Streaming Client — Cinematic Dark Theme */

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a2035;
  --bg-card-hover: #1f2847;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --success: #10b981;
  --warning: #f59e0b;
  --border: #1e293b;
  --border-light: #334155;
  --gradient-start: #6366f1;
  --gradient-end: #a855f7;
  --radius: 8px;
  --nav-height: 60px;
}

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

html {
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--text-primary); }

/* ── Navigation ──────────────────────────────────────────────── */

.watch-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(to bottom, rgba(10, 14, 26, 0.95), rgba(10, 14, 26, 0.7));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  height: var(--nav-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.watch-nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.watch-nav-logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.watch-nav-search {
  position: relative;
  width: 280px;
}

.watch-nav-search input {
  width: 100%;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.watch-nav-search input:focus {
  border-color: var(--accent);
}

.watch-nav-search input::placeholder {
  color: var(--text-muted);
}

/* Search results dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 200;
}

.search-results[hidden] { display: none; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--bg-card-hover);
}

.search-result-item img {
  width: 45px;
  height: 65px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-card);
}

.search-result-info { flex: 1; min-width: 0; }

.search-result-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Hero Banner ─────────────────────────────────────────────── */

.hero-banner {
  position: relative;
  width: 100%;
  height: 65vh;
  min-height: 400px;
  max-height: 700px;
  background-size: cover;
  background-position: center 20%;
  background-repeat: no-repeat;
  display: flex;
  align-items: flex-end;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(10, 14, 26, 0.3) 0%,
    rgba(10, 14, 26, 0.5) 50%,
    var(--bg-primary) 100%
  );
}

.hero-info {
  position: relative;
  z-index: 2;
  padding: 0 48px 48px;
  max-width: 650px;
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 12px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.hero-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

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

/* ── Buttons ─────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-play {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.btn-play:hover {
  background: #e2e8f0;
  color: var(--bg-primary);
  transform: scale(1.03);
}

.btn-info {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  backdrop-filter: blur(4px);
}

.btn-info:hover {
  background: rgba(255, 255, 255, 0.25);
  color: var(--text-primary);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-back:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ── Badges ──────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-rating {
  border: 1px solid var(--text-muted);
  color: var(--text-secondary);
}

.badge-free {
  background: var(--success);
  color: #fff;
}

.badge-rental {
  background: var(--warning);
  color: #1a1a1a;
}

.badge-purchase {
  background: var(--accent);
  color: #fff;
}

/* ── Content Rows ────────────────────────────────────────────── */

.content-rows {
  padding: 0 48px 40px;
  margin-top: -20px;
  position: relative;
  z-index: 2;
}

.content-row {
  margin-bottom: 36px;
}

.content-row h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-primary);
}

.poster-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-behavior: smooth;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.poster-scroll::-webkit-scrollbar { display: none; }

/* ── Poster Cards ────────────────────────────────────────────── */

.poster-card {
  flex: 0 0 180px;
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  background: var(--bg-card);
}

.poster-card:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 3;
}

.poster-card-img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
  background: var(--bg-card);
}

.poster-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 30px 10px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

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

.poster-card-overlay h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poster-card-overlay span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Price badge on poster */
.poster-price {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
}

.poster-price-free { background: var(--success); color: #fff; }
.poster-price-rental { background: var(--warning); color: #1a1a1a; }
.poster-price-purchase { background: var(--accent); color: #fff; }

/* Placeholder for missing posters */
.poster-placeholder {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2rem;
}

/* ── Details Modal ───────────────────────────────────────────── */

.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.85);
}

.modal-hero {
  width: 100%;
  height: 300px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.modal-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to top, var(--bg-secondary), transparent);
}

.modal-info {
  padding: 0 28px 28px;
  margin-top: -40px;
  position: relative;
  z-index: 2;
}

.modal-info h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.modal-info .modal-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.modal-info .modal-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-info .modal-buttons {
  display: flex;
  gap: 12px;
}

/* ── Player Page ─────────────────────────────────────────────── */

.player-page {
  padding-top: var(--nav-height);
}

.player-container {
  width: 100%;
  max-height: 75vh;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-container video {
  width: 100%;
  max-height: 75vh;
  outline: none;
}

.player-info {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 48px 60px;
}

.player-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.player-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.player-date {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.player-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 24px;
}

/* ── Auth Nav ────────────────────────────────────────────────── */

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

.watch-nav-auth {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.auth-user-email {
  color: var(--text-secondary);
  font-size: 0.85rem;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-auth-login {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
  padding: 6px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-auth-login:hover { opacity: 0.85; }

.btn-auth-logout {
  background: transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-auth-logout:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
}

/* ── Auth Modal ──────────────────────────────────────────────── */

.auth-modal-content {
  max-width: 420px;
}

.auth-modal-body {
  padding: 40px 32px;
}

.auth-modal-body h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 20px;
  text-align: center;
}

.auth-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 16px;
  text-align: center;
}

.auth-error[hidden] { display: none; }

.auth-field {
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.auth-field input:focus {
  border-color: var(--accent);
}

.auth-submit {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  font-size: 1rem;
}

.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--accent-light);
  font-weight: 600;
}

.auth-switch a:hover {
  color: var(--text-primary);
}

/* ── Player Gate ─────────────────────────────────────────────── */

.player-gate {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 400;
  background: rgba(10, 14, 26, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-gate[hidden] { display: none; }

.player-gate-inner {
  text-align: center;
  max-width: 400px;
  padding: 40px;
}

.player-gate-inner h3 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.player-gate-inner p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

/* ── Footer ──────────────────────────────────────────────────── */

.watch-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.watch-footer a {
  color: var(--accent-light);
  font-weight: 600;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .hero-title { font-size: 2.2rem; }
  .hero-info { padding: 0 32px 32px; }
  .content-rows { padding: 0 32px 32px; }
  .poster-card { flex: 0 0 160px; }
  .player-info { padding: 24px 32px 48px; }
}

@media (max-width: 768px) {
  .hero-banner { height: 55vh; min-height: 320px; }
  .hero-title { font-size: 1.8rem; }
  .hero-info { padding: 0 20px 24px; max-width: 100%; }
  .hero-desc { -webkit-line-clamp: 2; }
  .content-rows { padding: 0 20px 24px; }
  .poster-card { flex: 0 0 140px; }
  .modal-content { width: 95%; max-height: 90vh; }
  .modal-hero { height: 200px; }
  .modal-info { padding: 0 20px 20px; }
  .player-info { padding: 20px; }
  .watch-nav-search { width: 180px; }
}

@media (max-width: 480px) {
  .hero-banner { height: 50vh; min-height: 280px; }
  .hero-title { font-size: 1.5rem; }
  .hero-buttons { flex-direction: column; gap: 8px; }
  .btn { padding: 10px 18px; font-size: 0.9rem; }
  .content-rows { padding: 0 14px 20px; }
  .poster-card { flex: 0 0 120px; }
  .watch-nav-search { width: 140px; }
  .watch-nav-search input { font-size: 0.8rem; padding: 6px 10px; }
}
