/* ─── Layout ─────────────────────────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border-soft);
  background: rgba(14, 16, 20, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  font-style: italic;
  color: var(--accent);
  letter-spacing: -0.02em;
}

#main-content {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 20px 60px;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 20px;
  border-top: 1px solid var(--border-soft);
  font-size: var(--text-sm);
  background: var(--bg-elev-1);
}

/* ─── Navigation ─────────────────────────────────────────────────────────── */
.nav-list {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.nav-list a, .nav-list button {
  border: 1px solid var(--border-hard);
  color: var(--muted);
  background: transparent;
  border-radius: 999px;
  padding: 5px 13px;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
  transition: var(--transition-interactive);
}

.nav-list a:hover, .nav-list button:hover {
  background: var(--bg-elev-2);
  color: var(--text);
  border-color: color-mix(in srgb, var(--border-hard) 70%, var(--accent) 30%);
}

.nav-list a:active, .nav-list button:active { transform: scale(0.97); }

.nav-list a.is-active, .nav-list a[aria-current='page'] {
  background: var(--accent-soft);
  border-color: rgba(232, 164, 40, 0.35);
  color: var(--accent);
  font-weight: 600;
}

/* ─── Card ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-elev-1);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-card);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
button.primary {
  background: var(--accent);
  color: #1a1000;
  border: 1px solid var(--accent);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-sm);
  transition: var(--transition-interactive);
}

button.primary:hover {
  background: color-mix(in srgb, var(--accent) 85%, #fff 15%);
  box-shadow: var(--accent-glow);
}

button.secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border-hard);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  transition: var(--transition-interactive);
}

button.secondary:hover { background: var(--panel-2); }

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  transition: var(--transition-interactive);
}

button.danger:hover { background: rgba(224, 82, 82, 0.12); }

button.primary:active, button.secondary:active, button.danger:active { transform: scale(0.97); }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
form { display: grid; gap: var(--space-3); max-width: 360px; }

label { display: grid; gap: var(--space-1); font-size: var(--text-sm); font-weight: 500; color: var(--muted); }

input, textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-hard);
  border-radius: var(--radius-sm);
  padding: 10px var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-md);
  transition: border-color .18s ease, box-shadow .18s ease;
}

input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 164, 40, 0.1);
  outline: none;
}

select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-hard);
  border-radius: var(--radius-sm);
  padding: 10px var(--space-3);
  font-family: var(--font-body);
}

/* ─── Poster ─────────────────────────────────────────────────────────────── */
.poster {
  width: 120px;
  aspect-ratio: 2/3;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border-soft);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
  padding: 8px;
}

.poster-image { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; }

/* ─── Film card — richer ─────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 16px;
}

.film-card {
  background: var(--bg-elev-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: var(--transition-interactive);
  position: relative;
  cursor: pointer;
}

.film-card:hover {
  transform: translateY(-4px);
  border-color: rgba(232, 164, 40, 0.3);
  box-shadow: var(--shadow-2), var(--accent-glow);
}

.film-card:active { transform: scale(0.98); }

/* Poster area */
.film-card-media {
  position: relative;
  overflow: hidden;
}

.film-card-media .poster {
  width: 100%;
  aspect-ratio: 2/3;
  min-height: 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border-soft);
}

.film-card-media .poster-image {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}

.film-card:hover .film-card-media .poster-image {
  transform: scale(1.04);
}

/* Rating badge — top right corner */
.film-card-rating-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(14, 16, 20, 0.82);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(232, 164, 40, 0.3);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Hover overlay with genre chips + year */
.film-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(14, 16, 20, 0.92) 0%, rgba(14, 16, 20, 0.4) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10px;
  opacity: 0;
  transition: opacity .22s ease;
  gap: 5px;
}

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

.film-card-overlay-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.film-card-overlay-chip {
  background: rgba(232, 164, 40, 0.18);
  border: 1px solid rgba(232, 164, 40, 0.3);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 7px;
  font-size: .65rem;
  font-weight: 600;
}

.film-card-overlay-year {
  font-size: .7rem;
  color: rgba(232, 234, 240, 0.7);
  font-weight: 500;
}

/* Card content below poster */
.film-card-content {
  padding: var(--space-3);
  display: grid;
  gap: 6px;
}

.film-card-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  /* truncate to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.film-card-director {
  font-size: var(--text-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.film-card-meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }

.film-card a { display: block; height: 100%; }

/* ─── Chips & pills ──────────────────────────────────────────────────────── */
.meta-chip {
  border-radius: 999px;
  border: 1px solid var(--border-hard);
  background: var(--panel);
  padding: 2px 8px;
  font-size: .7rem;
  font-weight: 500;
  color: var(--muted);
}

.stat-pill {
  background: var(--panel);
  border: 1px solid var(--border-hard);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

/* ─── Review card ────────────────────────────────────────────────────────── */
.review-card {
  background: var(--bg-elev-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
}

.review-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  align-items: baseline;
  font-size: var(--text-sm);
  color: var(--muted);
}

/* ─── Star rating — half-star ────────────────────────────────────────────── */
.star-rating-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.star-rating {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

/* Each full star is split into two half-buttons side by side */
.star-wrap {
  display: inline-flex;
  width: 1.5rem;
  overflow: visible;
  position: relative;
}

.star-half {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 1;
  font-size: 1.5rem;
  color: var(--border-hard);
  transition: color .1s ease, transform .1s ease;
  /* each half clips to 50% of the star glyph */
  width: 0.75rem;
  overflow: hidden;
}

.star-half--left  { clip-path: inset(0 50% 0 0); }
.star-half--right { clip-path: inset(0 0 0 50%); margin-left: -0.75rem; }

.star-half.active { color: var(--accent); }

.star-wrap:hover .star-half--left,
.star-half--left:hover { color: var(--accent); transform: scale(1.15); }

.star-wrap:hover .star-half--right,
.star-half--right:hover { color: var(--accent); transform: scale(1.15); }

.star-rating-label {
  font-size: var(--text-sm);
  color: var(--muted);
  font-weight: 500;
  min-width: 6ch;
}

/* Read-only star display in review cards */
.star-display {
  font-size: 0.9rem;
  display: inline-block;
}
.star-full       { color: var(--accent); }
.star-empty      { color: var(--border-hard); }
.star-half-fill  {
  color: var(--border-hard);
  position: relative;
  display: inline-block;
}
.star-half-fill::before {
  content: '★';
  position: absolute;
  left: 0;
  color: var(--accent);
  clip-path: inset(0 50% 0 0);
}

/* ─── Detail list ────────────────────────────────────────────────────────── */
.detail-list { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-2); }

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-size: var(--text-sm);
}

/* ─── Misc ───────────────────────────────────────────────────────────────── */
.cluster { display: flex; flex-wrap: wrap; gap: 8px; }
.muted { color: var(--muted); font-size: var(--text-sm); }
.section { margin-top: var(--space-5); display: grid; gap: var(--space-4); }
.feed { display: grid; gap: var(--space-4); }
.feed-item { display: grid; grid-template-columns: auto 1fr; gap: 12px; }

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
}

.inline-link { color: var(--accent); font-weight: 500; transition: var(--transition-interactive); }
.inline-link:hover { opacity: 0.8; text-decoration: underline; text-underline-offset: 3px; }

.empty-state { padding: var(--space-2) 0; color: var(--muted); font-style: italic; }

.toolbar-form { display: flex; align-items: end; gap: var(--space-3); max-width: 540px; }

#review-message { margin: 0; }
#review-message:empty { display: none; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--space-4);
  animation: modal-fade-in 150ms ease;
}

@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg-elev-2);
  border: 1px solid var(--border-hard);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2), var(--accent-glow);
  width: 100%;
  max-width: 400px;
  position: relative;
  animation: modal-slide-in 200ms cubic-bezier(0.34, 1.26, 0.64, 1);
  padding: var(--space-6);
}

@keyframes modal-slide-in {
  from { transform: translateY(14px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: transparent;
  border: 1px solid var(--border-hard);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  transition: var(--transition-interactive);
}

.modal-close:hover { background: var(--panel); color: var(--text); }

body.modal-open { overflow: hidden; }

.modal-auth { display: grid; gap: var(--space-4); }

.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}

.modal-subtitle { margin: 0; margin-top: calc(-1 * var(--space-2)); }

.auth-form { display: grid; gap: var(--space-3); max-width: none; }

.auth-form input {
  width: 100%;
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hard);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 164, 40, 0.1);
  outline: none;
}

.auth-message { margin: 0; font-size: var(--text-sm); min-height: 1.2em; }

.auth-submit { width: 100%; padding: 10px; font-size: var(--text-md); border-radius: 999px; margin-top: var(--space-1); }

.auth-switch { margin: 0; text-align: center; font-size: var(--text-sm); }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Nav badge ──────────────────────────────────────────────────────────── */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #1a1000;
  font-size: .62rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.nav-signup-btn {
  background: var(--accent-soft) !important;
  border-color: rgba(232, 164, 40, 0.3) !important;
  color: var(--accent) !important;
}

.nav-signup-btn:hover {
  background: var(--accent) !important;
  color: #1a1000 !important;
}

/* ─── Live search dropdown ───────────────────────────────────────────────── */
.search-dropdown {
  position: absolute;
  z-index: 200;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-hard);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  animation: modal-fade-in 120ms ease;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  transition: background .15s ease;
}

.search-result-item:hover, .search-result-item:focus {
  background: var(--panel);
  outline: none;
}

.search-result-poster {
  width: 36px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--border-soft);
}

.search-result-poster--placeholder { background: var(--panel-2); }

.search-result-info { display: flex; flex-direction: column; gap: 2px; font-size: var(--text-sm); min-width: 0; }

.search-result-info strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-display);
}

.search-dropdown-empty, .search-dropdown-loading {
  padding: var(--space-3) var(--space-4);
  color: var(--muted);
  font-size: var(--text-sm);
  font-style: italic;
}

.search-dropdown-footer {
  border-top: 1px solid var(--border-soft);
  padding: var(--space-2) var(--space-3);
  background: var(--panel);
}

.search-see-all { font-size: var(--text-sm); }
