/* ------------------------------------------------------------------ */
/* Pitch-black film club aesthetic                                     */
/* ------------------------------------------------------------------ */
:root {
  --bg: #000000;
  --surface: #0a0a0b;
  --surface-2: #111113;
  --border: #1c1c1f;
  --border-bright: #2a2a2e;
  --text: #f2f2f3;
  --muted: #6e6e75;
  --muted-2: #8a8a92;
  --accent: #d4af37;        /* muted gold for scores/highlights */
  --accent-dim: #9c8129;
  --danger: #b03a3a;
  --radius: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------------ */
/* Logo                                                                */
/* ------------------------------------------------------------------ */
.logo {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.18em;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.logo span { color: var(--accent); }

/* ------------------------------------------------------------------ */
/* Login gate                                                          */
/* ------------------------------------------------------------------ */
.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 30%, #0a0a0c 0%, #000 70%);
  z-index: 50;
}
.gate-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 320px;
  padding: 40px 32px;
  text-align: center;
}
.gate-card .logo { font-size: 2.2rem; margin-bottom: 4px; }
.gate-sub {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.gate-card input,
.gate-card button {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.gate-card input {
  background: var(--surface-2);
  border: 1px solid var(--border-bright);
  color: var(--text);
}
.gate-card input:focus { outline: none; border-color: var(--accent-dim); }
.gate-card button {
  background: var(--accent);
  color: #000;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.gate-card button:hover { background: #e4bf44; }
.gate-error { color: var(--danger); font-size: 0.8rem; min-height: 1em; }

/* ------------------------------------------------------------------ */
/* Top bar + search                                                    */
/* ------------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 18px 28px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.search-wrap { position: relative; flex: 1; max-width: 520px; }
#search {
  width: 100%;
  padding: 11px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.92rem;
  transition: border-color 0.15s;
}
#search::placeholder { color: var(--muted); }
#search:focus { outline: none; border-color: var(--border-bright); }

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: 60vh;
  overflow-y: auto;
}
.result {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.result:last-child { border-bottom: none; }
.result:hover { background: var(--surface-2); }
.result img { width: 38px; height: 57px; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
.result-meta { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; }
.result-title { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-year { font-size: 0.78rem; color: var(--muted); }
.result-empty { padding: 16px; color: var(--muted); font-size: 0.85rem; text-align: center; }

/* ------------------------------------------------------------------ */
/* Content + grid                                                      */
/* ------------------------------------------------------------------ */
.content { max-width: 1280px; margin: 0 auto; padding: 36px 28px 80px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.section-title { display: flex; align-items: baseline; gap: 12px; }
.section-head h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 1.7rem;
  letter-spacing: 0.04em;
}
.count { color: var(--muted); font-size: 0.85rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 22px;
}

.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-bright); }
.card-poster { position: relative; aspect-ratio: 2 / 3; background: var(--surface-2); }
.card-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-poster.no-art {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
  padding: 12px;
}

.card-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
}
.card-title {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.card-title .year { color: var(--muted); font-weight: 400; }

.score {
  flex-shrink: 0;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  display: flex;
  align-items: baseline;
  gap: 1px;
}
.score .max { font-size: 0.7rem; color: var(--muted); font-family: 'Inter', sans-serif; }
.score.unrated { color: var(--muted); font-size: 0.78rem; font-family: 'Inter', sans-serif; }

.card-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.card:hover .card-remove { opacity: 1; }
.card-remove:hover { background: var(--danger); }

.empty { text-align: center; padding: 80px 20px; }
.empty p { margin: 4px 0; }
.empty p:first-child { font-size: 1.1rem; }

/* ------------------------------------------------------------------ */
/* Modal                                                               */
/* ------------------------------------------------------------------ */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(4px); }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 1;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  z-index: 2;
}
.modal-close:hover { color: var(--text); }

.modal-hero { display: flex; gap: 20px; padding: 26px; border-bottom: 1px solid var(--border); }
.modal-hero img { width: 120px; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: var(--surface-2); }
.modal-hero-meta { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.modal-hero-meta h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.8rem; font-weight: 600; line-height: 1.1; }
.modal-hero-meta .year { color: var(--muted); font-size: 0.9rem; }
.modal-avg { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.modal-avg .big { font-family: 'Cormorant Garamond', serif; font-size: 2.2rem; font-weight: 700; color: var(--accent); }
.modal-avg .max { color: var(--muted); font-size: 0.9rem; }
.modal-avg .n { color: var(--muted); font-size: 0.82rem; margin-left: 6px; }
.modal-overview { color: var(--muted-2); font-size: 0.85rem; line-height: 1.5; margin-top: 6px; max-height: 4.5em; overflow: hidden; }

.modal-section { padding: 22px 26px; }
.modal-section h4 {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.review-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.review {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.review-score {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent);
  flex-shrink: 0;
  width: 42px;
}
.review-main { min-width: 0; }
.review-name { font-weight: 600; font-size: 0.88rem; }
.review-note { color: var(--muted-2); font-size: 0.84rem; margin-top: 3px; line-height: 1.45; }
.no-reviews { color: var(--muted); font-size: 0.85rem; }

/* Review form */
.review-form { display: flex; flex-direction: column; gap: 12px; }
.review-form .row { display: flex; gap: 10px; }
.review-form input,
.review-form textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}
.review-form input:focus,
.review-form textarea:focus { outline: none; border-color: var(--accent-dim); }
.review-form textarea { resize: vertical; min-height: 64px; }
.review-form .name-input { flex: 2; }
.review-form .score-input { flex: 1; }
.review-form button {
  align-self: flex-start;
  padding: 11px 22px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}
.review-form button:hover { background: #e4bf44; }
.form-error { color: var(--danger); font-size: 0.82rem; min-height: 1em; }

/* Toolbar: sort + members */
.toolbar { display: flex; align-items: center; gap: 12px; }
.sort-wrap { display: flex; align-items: center; gap: 8px; }
.sort-label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.toolbar select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 8px 34px 8px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  color-scheme: dark; /* makes the native option list dark too */
  /* Custom chevron so every dropdown matches, drawn in the muted grey */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%238a8a92' stroke-width='1.6' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.toolbar select:hover { border-color: var(--accent-dim); }
.toolbar select:focus { outline: none; border-color: var(--accent-dim); }
.ghost-btn {
  background: transparent;
  color: var(--muted-2);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.ghost-btn:hover { color: var(--accent); border-color: var(--accent-dim); }

/* Films / Series world switch */
.world-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.world {
  background: transparent;
  border: none;
  color: var(--muted-2);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 7px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.world:hover { color: var(--text); }
.world.active { background: var(--accent); color: #000; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 4px 6px 12px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--muted-2); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* Search result inline actions */
.result-actions { display: flex; gap: 6px; margin-left: auto; }
.res-btn {
  background: var(--surface-2);
  color: var(--muted-2);
  border: 1px solid var(--border-bright);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 0.74rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.res-btn:hover { color: var(--text); border-color: var(--accent-dim); }
.res-btn.watched-btn:hover { background: var(--accent); color: #000; border-color: var(--accent); }
.result-rating { color: var(--accent); font-size: 0.78rem; margin-left: 6px; }

/* Accent toolbar button (Random pick) */
.accent-btn { color: var(--accent); border-color: var(--accent-dim); }
.accent-btn:hover { background: var(--accent); color: #000; border-color: var(--accent); }

/* Watchlist cards: genre tag + mark-watched */
.wl-card { position: relative; }
.genre-tag {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
  color: var(--text);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-bright);
}
.mark-watched {
  width: 100%;
  background: var(--surface-2);
  color: var(--muted-2);
  border: none;
  border-top: 1px solid var(--border);
  padding: 9px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mark-watched:hover { background: var(--accent); color: #000; }

/* Random pick modal */
.random-pick { padding: 4px; }
.rp-label {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  margin-bottom: 16px;
}
.rp-hero { display: flex; gap: 22px; }
.rp-hero img { width: 150px; border-radius: var(--radius); box-shadow: var(--shadow); }
.rp-meta h3 { font-family: 'Cormorant Garamond', serif; font-size: 2rem; font-weight: 600; line-height: 1.05; }
.rp-rating { display: inline-block; color: var(--accent); font-weight: 600; margin: 8px 0; }
.rp-genres { color: var(--muted-2); font-size: 0.85rem; margin: 6px 0 10px; }
.rp-again {
  margin-top: 20px;
  padding: 11px 22px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.rp-again:hover { background: #e4bf44; }

/* History view */
.hist-list { display: flex; flex-direction: column; gap: 26px; }
.hist-group { display: flex; flex-direction: column; gap: 10px; }
.hist-date {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  color: var(--accent);
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.hist-date.muted-date { color: var(--muted); }
.hist-rows { display: flex; flex-direction: column; gap: 2px; }
.hist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.hist-row:hover { background: var(--surface-2); }
.hist-row img, .hist-noart { width: 34px; height: 51px; border-radius: 4px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; }
.hist-title { flex: 1; font-size: 0.95rem; min-width: 0; }
.hist-score { color: var(--accent); font-weight: 600; font-size: 0.95rem; }
.hist-score.unrated { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.hist-score .max { color: var(--muted); font-weight: 400; font-size: 0.72em; }

/* Watched-on date editor in the detail modal */
.watched-on {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  color: var(--muted-2);
  font-size: 0.85rem;
}
.watched-on input[type="date"] {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-bright);
  border-radius: 7px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.85rem;
  color-scheme: dark;
}
.watched-on input[type="date"]:focus { outline: none; border-color: var(--accent-dim); }

/* Club headline stats banner */
.club-stats {
  display: flex;
  gap: 14px;
  margin: -8px 0 26px;
}
.club-stats .stat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-num { font-size: 1.7rem; font-weight: 600; font-family: 'Cormorant Garamond', serif; line-height: 1; }
.stat-num.accent { color: var(--accent); }
.stat-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }

.filter-empty { color: var(--muted-2); font-size: 0.95rem; padding: 20px 2px; grid-column: 1 / -1; }

/* Members panel */
.members-panel { padding-top: 4px; }
.members-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
}
.member-list { display: flex; flex-direction: column; gap: 14px; }
.member {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.member-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.member-name { font-size: 1.05rem; font-weight: 600; }
.member-avg { color: var(--accent); font-weight: 600; font-size: 0.95rem; }
.member-avg .max { color: var(--muted); font-weight: 400; font-size: 0.75em; }
.member-sub { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.member-films { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.ms-film { font-size: 0.85rem; color: var(--muted-2); }
.ms-film em { font-style: normal; color: var(--text); font-weight: 600; }
.ms-film.up { color: #6fae6f; }
.ms-film.down { color: #b56a6a; }

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

@media (max-width: 560px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 14px; padding: 14px 18px; }
  .search-wrap { max-width: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px; }
  .modal-hero { flex-direction: column; }
  .modal-hero img { width: 90px; }
  .section-head { align-items: stretch; }
  .toolbar { justify-content: space-between; flex-wrap: wrap; }
  .club-stats { gap: 8px; }
  .club-stats .stat { padding: 12px 12px; }
  .stat-num { font-size: 1.4rem; }
  .stat-label { font-size: 0.68rem; }
}
