:root {
  --bg: #0d1117;
  --bg-soft: #161b22;
  --card: #1c2330;
  --line: #2b3444;
  --text: #e8edf4;
  --muted: #94a3b8;
  --accent: #f5b942;
  --accent-dark: #d99b1e;
  --danger: #f87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { width: min(1180px, 100% - 2rem); margin-inline: auto; }
main.container { flex: 1; padding-block: 1.5rem 3rem; }

a { color: inherit; text-decoration: none; }

/* header */
.site-header {
  background: rgba(13, 17, 23, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(6px);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; padding-block: 0.8rem; }
.logo { font-weight: 800; font-size: 1.25rem; letter-spacing: 0.02em; }
.logo span { background: linear-gradient(90deg, var(--accent), #ff8a5c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; gap: 1.1rem; }
.nav a { color: var(--muted); font-weight: 600; }
.nav a:hover { color: var(--text); }
.header-auth { margin-left: auto; display: flex; align-items: center; gap: 0.7rem; }
.whoami { color: var(--muted); font-size: 0.95rem; }
.inline-form { display: inline; }

/* buttons */
.btn {
  display: inline-block; border: 0; cursor: pointer;
  padding: 0.5rem 1rem; border-radius: 8px;
  font-weight: 700; font-size: 0.95rem; font-family: inherit;
  transition: filter 0.15s, background 0.15s;
}
.btn-accent { background: var(--accent); color: #1a1200; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-block { width: 100%; padding-block: 0.7rem; }

/* hero + filters */
.hero { padding-block: 1.4rem 0.6rem; }
.hero h1 { margin: 0 0 0.3rem; font-size: 2rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
  margin-top: 1rem; padding: 0.9rem;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px;
}
.input {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 0.55rem 0.7rem; font: inherit;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.input.grow { flex: 1 1 240px; }
.input.narrow { width: 7.5rem; }

/* grid of cards */
.grid {
  display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  margin-top: 1.4rem;
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 8px 24px rgba(0,0,0,0.45); }
.poster-wrap { position: relative; aspect-ratio: 2/3; }
.poster-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rating-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.72); color: var(--accent);
  padding: 2px 8px; border-radius: 6px; font-weight: 700; font-size: 0.85rem;
}
.card-body { padding: 0.7rem 0.8rem 0.9rem; }
.card-body h3 { margin: 0 0 0.2rem; font-size: 1rem; line-height: 1.3; }
.meta { margin: 0; color: var(--muted); font-size: 0.85rem; }

.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2rem; }
.empty { text-align: center; color: var(--muted); margin-top: 3rem; font-size: 1.1rem; }

/* movie page */
.movie-page { display: grid; grid-template-columns: 320px 1fr; gap: 2rem; margin-top: 1rem; }
.movie-poster img { width: 100%; border-radius: 14px; border: 1px solid var(--line); }
.movie-info h1 { margin: 0; font-size: 2rem; }
.subtitle { color: var(--muted); margin: 0.2rem 0 0.6rem; font-size: 1.1rem; }
.rating-big { color: var(--accent); font-size: 1.6rem; font-weight: 800; margin: 0 0 0.8rem; }
.facts { border-collapse: collapse; margin-bottom: 1rem; }
.facts th, .facts td { text-align: left; padding: 0.25rem 1rem 0.25rem 0; vertical-align: top; }
.facts th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.description { max-width: 65ch; }
.similar { margin-top: 3rem; }
.similar h2 { font-size: 1.3rem; }

/* auth */
.auth-card {
  max-width: 420px; margin: 2.5rem auto;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.8rem;
}
.auth-card h1 { margin-top: 0; }
.auth-card label { display: block; margin-bottom: 0.9rem; font-weight: 600; font-size: 0.95rem; }
.auth-card .input { display: block; width: 100%; margin-top: 0.3rem; }
.hint { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.errors {
  background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248,113,113,0.4);
  color: var(--danger); border-radius: 8px; padding: 0.6rem 0.6rem 0.6rem 1.4rem;
  margin: 0 0 1rem;
}
.center-block { text-align: center; }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 1.2rem; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 720px) {
  .movie-page { grid-template-columns: 1fr; }
  .movie-poster { max-width: 260px; }
  .header-inner { flex-wrap: wrap; gap: 0.7rem; }
  .header-auth { width: 100%; margin-left: 0; }
}
