:root {
  --bg: #07070f;
  --bg2: #0c0c18;
  --surface: rgba(255,255,255,0.04);
  --surface-solid: #111120;
  --surface2: rgba(255,255,255,0.07);
  --surface3: rgba(255,255,255,0.1);
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text: #f0f0f8;
  --text-muted: #7878a0;
  --text-dim: #404060;

  --accent: #e8193c;
  --accent2: #ff4d6a;
  --accent-glow: rgba(232,25,60,0.25);
  --accent-grad: linear-gradient(135deg, #e8193c, #ff4d6a);

  --b: #6699ff;
  --b-dim: rgba(102,153,255,0.12);
  --b-glow: rgba(102,153,255,0.3);
  --w: #44cc77;
  --w-dim: rgba(68,204,119,0.12);
  --w-glow: rgba(68,204,119,0.3);
  --k: #aa77ff;
  --k-dim: rgba(170,119,255,0.12);
  --k-glow: rgba(170,119,255,0.3);
  --a: #ffaa44;
  --a-dim: rgba(255,170,68,0.12);
  --a-glow: rgba(255,170,68,0.3);

  --status-dl-bg: rgba(68,204,119,0.1);
  --status-dl-text: #44cc77;
  --status-dl-border: rgba(68,204,119,0.25);
  --status-nr-bg: rgba(102,153,255,0.1);
  --status-nr-text: #6699ff;
  --status-nr-border: rgba(102,153,255,0.25);
  --status-nd-bg: rgba(255,170,68,0.1);
  --status-nd-text: #ffaa44;
  --status-nd-border: rgba(255,170,68,0.25);

  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 5px;
  --transition: 0.18s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(100,60,200,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(232,25,60,0.08) 0%, transparent 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
}

/* ── HEADER ── */
.site-header {
  background: rgba(7,7,15,0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: 1000px;
  margin: 0 auto;
}

.logo { display: flex; align-items: center; gap: 14px; }
.logo-icon { font-size: 26px; filter: drop-shadow(0 0 8px rgba(232,25,60,0.5)); }

.logo-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.logo-sub {
  font-size: 10px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1.5px;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 2px;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: all var(--transition);
}
.nav-link:hover { color: var(--text); border-color: var(--border2); background: var(--surface2); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-auth {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.4px;
  transition: all var(--transition);
}
.btn-auth:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-glow);
}

/* Edit-only elements hidden until admin logs in */
.edit-only { display: none !important; }
.is-admin .edit-only { display: inline-flex !important; }

/* ── LOGIN MODAL ── */
.login-modal { max-width: 360px; }
.login-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }
.login-error { font-size: 12px; color: var(--accent2); display: none; margin-bottom: 8px; }
.remember-label { margin-top: 12px; font-size: 13px; color: var(--text-muted); }

/* ── MEMBER CHECKBOXES ── */
.member-checks {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 0;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.check-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border2);
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition);
}
.check-label input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.check-label input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

/* ── MAIN ── */
main { max-width: 1000px; margin: 0 auto; padding: 32px 28px; }

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.filters { display: flex; gap: 6px; flex-wrap: wrap; }

.filter {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
}
.filter:hover { color: var(--text); border-color: var(--border2); background: var(--surface2); }
.filter.active {
  background: var(--accent-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* ── STATS ── */
.stats-bar {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.stat { display: flex; align-items: center; gap: 8px; }
.stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}
.stat-dot.dl { background: var(--status-dl-text); color: var(--status-dl-text); }
.stat-dot.nr { background: var(--status-nr-text); color: var(--status-nr-text); }
.stat-dot.nd { background: var(--status-nd-text); color: var(--status-nd-text); }

/* ── BUTTONS ── */
.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  box-shadow: 0 2px 12px var(--accent-glow);
  font-family: inherit;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border2);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); background: var(--surface2); }

.btn-danger {
  background: rgba(180,30,30,0.25);
  color: #ff8888;
  border: 1px solid rgba(180,30,30,0.35);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.btn-danger:hover { background: rgba(200,40,40,0.4); color: #ffaaaa; }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  transition: all var(--transition);
  line-height: 1;
}
.btn-icon:hover { color: var(--text-muted); background: var(--surface2); }

.btn-watch {
  background: var(--w-dim);
  color: var(--w);
  border: 1px solid var(--status-dl-border);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: 0.3px;
}
.btn-watch:hover {
  background: rgba(68,204,119,0.2);
  border-color: var(--w);
  box-shadow: 0 0 12px var(--w-glow);
}

.btn-dl {
  background: var(--b-dim);
  color: var(--b);
  border: 1px solid rgba(102,153,255,0.25);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: 0.3px;
}
.btn-dl:hover {
  background: rgba(102,153,255,0.2);
  border-color: var(--b);
  box-shadow: 0 0 12px var(--b-glow);
}

/* ── MOVIE LIST ── */
.movie-list { display: flex; flex-direction: column; gap: 6px; }

.section-header {
  padding: 10px 4px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-header:first-child { margin-top: 0; }
.section-header::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 2px;
  background: var(--accent-grad);
  border-radius: 1px;
}

.movie-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  animation: cardIn 0.25s ease both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.movie-card:hover {
  background: var(--surface2);
  border-color: var(--border2);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}

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

.movie-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.1px;
}

.movie-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.movie-year { color: var(--text-dim); font-size: 12px; font-weight: 500; }

.status-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.status-tag.downloaded {
  background: var(--status-dl-bg);
  color: var(--status-dl-text);
  border: 1px solid var(--status-dl-border);
}
.status-tag.not_released {
  background: var(--status-nr-bg);
  color: var(--status-nr-text);
  border: 1px solid var(--status-nr-border);
}
.status-tag.not_downloaded {
  background: var(--status-nd-bg);
  color: var(--status-nd-text);
  border: 1px solid var(--status-nd-border);
}

.movie-notes { color: var(--text-muted); font-size: 12px; font-style: italic; }

.added-tags { display: flex; gap: 4px; align-items: center; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}
.badge.b { background: var(--b-dim); color: var(--b); border: 1px solid rgba(102,153,255,0.28); }
.badge.w { background: var(--w-dim); color: var(--w); border: 1px solid rgba(68,204,119,0.28); }
.badge.k { background: var(--k-dim); color: var(--k); border: 1px solid rgba(170,119,255,0.28); }
.badge.a { background: var(--a-dim); color: var(--a); border: 1px solid rgba(255,170,68,0.28); }

.movie-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

.loading { text-align: center; color: var(--text-dim); padding: 48px; font-style: italic; }

.empty-state { text-align: center; color: var(--text-muted); padding: 72px 20px; }
.empty-state h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.3px; }
.empty-state p { font-size: 14px; color: var(--text-dim); }

/* ── MODAL ── */
dialog {
  background: #0e0e1e;
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.05);
}

dialog::backdrop {
  background: rgba(4,4,12,0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

dialog h2 { font-size: 18px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.3px; }

.watch-movie-name {
  color: var(--text-muted);
  font-size: 14px;
  font-style: italic;
  margin-bottom: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.form-field { display: flex; flex-direction: column; gap: 7px; }
.form-field.span-2 { grid-column: span 2; }

.form-field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.form-field input,
.form-field select {
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}
.form-field input:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-field input::placeholder { color: var(--text-dim); }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.confirm-modal p { margin-bottom: 24px; font-size: 15px; color: var(--text-muted); line-height: 1.5; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  main { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.span-2 { grid-column: span 1; }
  .movie-card { flex-wrap: wrap; }
  .movie-actions { width: 100%; justify-content: flex-end; }
  .stats-bar { gap: 14px; }
}
