@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --bg:        #1a1a1a;
  --surface:   #242424;
  --surface2:  #2c2c2c;
  --border:    #3a3a3a;
  --gold:      #f5c518;
  --gold-dim:  #c9a100;
  --text:      #e8e8e8;
  --text-dim:  #9a9a9a;
  --text-faint:#5a5a5a;
  --accent:    #f5c518;
  --red:       #e74c3c;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ── HEADER ── */
header {
  background: #111;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  background: var(--gold);
  color: #000;
  font-weight: 800;
  font-size: 18px;
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.header-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-dim);
}

/* ── PAGE LAYOUT ── */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ── LIST HEADER ── */
.list-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.list-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.list-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.list-meta span {
  font-size: 13px;
  color: var(--text-dim);
}

.list-meta .dot { color: var(--text-faint); }

.tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
}

/* ── SORT BAR ── */
.sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.sort-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

.sort-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.sort-pill:hover { border-color: var(--gold); }
.sort-pill.active { border-color: var(--gold); color: var(--gold); }

/* ── GRID ── */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

/* ── MOVIE CARD ── */
.card {
  background: var(--surface);
  display: flex;
  gap: 14px;
  padding: 16px;
  transition: background 0.15s;
  position: relative;
}

.card:hover { background: var(--surface2); }

.card-num {
  position: absolute;
  top: 16px;
  left: 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  width: 22px;
  text-align: right;
  flex-shrink: 0;
}

.card-poster {
  flex-shrink: 0;
  width: 64px;
  height: 96px;
  border-radius: 3px;
  overflow: hidden;
  margin-left: 28px;
  background: var(--surface2);
  position: relative;
}

.card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poster-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1e1e2e 0%, #2a2a3e 100%);
  border: 1px solid #3a3a5a;
}

.vhs-icon {
  font-size: 22px;
  margin-bottom: 4px;
  opacity: 0.6;
}

.card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
  cursor: pointer;
  transition: color 0.15s;
}

.card-title:hover { color: var(--gold); }

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

.card-rating {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.star {
  color: var(--gold);
  font-size: 12px;
}

.rating-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.rating-max {
  font-size: 11px;
  color: var(--text-dim);
}

.card-genre {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.genre-tag {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 3px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 6px;
}

.btn-watchlist {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.btn-watchlist:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-watchlist .plus { font-size: 13px; font-weight: 600; }

.btn-edit {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
  margin-left: auto;
}
.btn-edit:hover { border-color: var(--gold); color: var(--gold); }

.btn-add-vhs {
  background: var(--gold);
  color: #000;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-add-vhs:hover { background: var(--gold-dim); }

/* ── EDIT MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header { padding: 20px 24px 0; flex-shrink: 0; }
.modal h2 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.modal-body { padding: 0 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 24px 20px; flex-shrink: 0; border-top: 1px solid var(--border); }

.modal-fields { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }

.modal-fields label { font-size: 12px; color: var(--text-dim); display: block; margin-bottom: 4px; }

.modal-fields input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 4px;
  font-family: inherit;
  outline: none;
}
.modal-fields input:focus { border-color: var(--gold); }

.modal-status { font-size: 12px; color: var(--text-dim); font-style: italic; }

.poster-option {
  width: 80px;
  cursor: pointer;
  border-radius: 3px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.15s;
  flex-shrink: 0;
}
.poster-option:hover { border-color: var(--gold-dim); }
.poster-option.selected { border-color: var(--gold); }
.poster-option img { width: 100%; height: 120px; object-fit: cover; display: block; }

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

.btn-modal {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border);
  font-family: inherit;
  transition: all 0.15s;
}
.btn-modal.secondary { background: var(--surface2); color: var(--text-dim); }
.btn-modal.secondary:hover { color: var(--text); }
.btn-modal.primary { background: var(--gold); color: #000; border-color: var(--gold); font-weight: 600; }
.btn-modal.primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-modal.fetch { background: var(--surface2); color: var(--text); }
.btn-modal.fetch:hover { border-color: var(--gold); color: var(--gold); }
.btn-modal.delete { background: transparent; border-color: var(--red); color: var(--red); }
.btn-modal.delete:hover { background: var(--red); color: #fff; }

.add-result {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s;
  background: var(--bg);
}
.add-result:hover { border-color: var(--gold-dim); }
.add-result.selected { border-color: var(--gold); }
.add-result-poster {
  width: 48px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.add-result-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.add-result-info { display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.add-result-title { font-size: 13px; font-weight: 600; color: var(--text); }
.add-result-year  { font-size: 12px; color: var(--text-dim); }
.add-result-genres { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }

/* ── FOOTER ── */
.footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
}

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 580px) {
  .grid { grid-template-columns: 1fr; }
}
