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

:root {
  --bg: #fff;
  --surface: #f5f5f5;
  --border: #e0e0e0;
  --text: #111;
  --muted: #888;
  --accent: #111;
  --green: #1a7f3c;
  --blue: #1a5fa8;
  --radius: 4px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
}

a { color: var(--text); text-decoration: none; }

/* Nav */
nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 32px 36px 24px;
  gap: 24px;
}

.nav-brand { display: none; }

.nav-links {
  display: flex;
  gap: 24px;
  align-items: baseline;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-links a { color: var(--muted); }
.nav-links a:hover { color: var(--text); }

/* Nav left slot — search or page title */
.search-box { flex: 1; }

.nav-heading {
  flex: 1;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  border-bottom: 2px solid var(--text);
  padding-bottom: 6px;
}

.search-box input {
  width: 100%;
  background: var(--bg);
  border: none;
  border-bottom: 2px solid var(--text);
  padding: 0 0 6px;
  color: var(--text);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  outline: none;
}

.search-box input::placeholder { color: var(--muted); font-weight: 700; }

.search-tagline { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

/* Main */
main { padding: 0 36px 48px; max-width: 1200px; }

/* Auth */
.auth-wrap {
  max-width: 360px;
  margin: 100px auto 0;
}

.auth-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 6px;
}

.auth-sub { color: var(--muted); margin-bottom: 32px; font-size: 14px; }

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  padding: 10px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
}

.tab.active { color: var(--text); border-bottom-color: var(--text); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form.hidden { display: none; }

.auth-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}

.auth-form input:focus { border-color: var(--text); }

.auth-form button {
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 11px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.15s;
}

.auth-form button:hover { opacity: 0.75; }
.form-error { color: #c00; font-size: 13px; min-height: 18px; }


/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.movie-card {
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.poster {
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--surface);
  position: relative;
}
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.no-poster {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--muted);
  background: var(--surface);
}

/* Add seasons button (profile page inline) */
.add-seasons-btn {
  background: #fff;
  color: #111;
  border: 1px solid #111;
  border-radius: 2px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.add-seasons-btn:hover { opacity: 0.7; }
.add-seasons-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Bother Joe button */
.bother-btn {
  background: #111;
  color: #fff;
  border: none;
  border-radius: 2px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.bother-btn:hover { opacity: 0.7; }
.bother-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.bother-btn.bothered { background: #555; }

/* Re-download button (profile page inline + search page overlay) */
.redownload-btn {
  background: #111;
  color: #fff;
  border: none;
  border-radius: 2px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.poster .redownload-btn {
  position: absolute;
  bottom: 10px;
  left: 10px;
}
.redownload-btn:hover { opacity: 0.7; }
.redownload-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Add more seasons button — overlay on poster, bottom-right */
.poster .add-more-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: #fff;
  color: #111;
  border: none;
  border-radius: 2px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: opacity 0.15s;
}
.poster .add-more-btn:hover { opacity: 0.8; }

/* Request button — overlay on poster */
.request-btn {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: #fff;
  color: #111;
  border: none;
  border-radius: 2px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: opacity 0.15s;
}

.request-btn:hover { opacity: 0.8; }
.request-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.info {
  padding: 8px 2px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.movie-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.movie-year { font-size: 12px; color: var(--muted); }

/* Badges — base style */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 2px;
}

/* Overlay variant: only when badge is inside a poster */
.poster .badge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  pointer-events: none;
}

/* On poster (white on dark image) */
.poster .badge.available { background: #fff; color: #111; }
.poster .badge.requested,
.poster .badge.searching,
.poster .badge.downloading,
.poster .badge.pending { background: rgba(255,255,255,0.65); color: #333; }

/* Outside poster (dark on white page) */
.badge.available {
  background: #111;
  color: #fff;
  animation: pulse-badge 2s ease-in-out infinite;
}

.badge.requested, .badge.searching, .badge.downloading, .badge.pending {
  background: #e0e0e0;
  color: #555;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* TV type pill (top-right of poster) */
.type-pill {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 5px;
  border-radius: 2px;
  text-transform: uppercase;
  pointer-events: none;
}

/* TV tag inline (profile list) */
.type-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 4px;
  border-radius: 2px;
  text-transform: uppercase;
  background: #e0e0e0;
  color: #555;
  vertical-align: middle;
  margin-left: 4px;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: #fff;
  padding: 28px;
  border-radius: 4px;
  min-width: 280px;
  max-width: 360px;
  width: 90%;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 20px;
  color: var(--text);
}

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

.modal-opt {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 10px 14px;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s;
}
.modal-opt:hover { background: var(--surface); }

.modal-cancel {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-top: 8px;
}
.modal-cancel:hover { color: var(--text); }

/* Season picker */
.season-picker { margin-bottom: 12px; }

.season-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 14px;
}

.season-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
}
.season-row input { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.season-row span:first-of-type { flex: 1; }
.season-eps { font-size: 12px; color: var(--muted); flex-shrink: 0; }

/* Already-requested seasons: greyed out */
.season-done { opacity: 0.45; cursor: default; }
.season-done input { cursor: default; }

/* Entire Series upgrade row */
.season-entire { border-bottom: 1px solid var(--border); margin-bottom: 8px; padding-bottom: 10px; }

.modal-confirm-btn {
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 2px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.15s;
}
.modal-confirm-btn:hover { opacity: 0.75; }

/* States */
.empty-state { color: var(--muted); padding: 32px 0; font-size: 14px; }
.loading { color: var(--muted); padding: 20px 0; font-size: 14px; }
.hidden { display: none !important; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: 2px;
  font-size: 13px;
  z-index: 100;
}
.toast.error { background: #c00; }

/* Profile */
.profile-header { margin-bottom: 24px; padding-top: 8px; }
.profile-email { color: var(--muted); font-size: 14px; }

.request-list { display: flex; flex-direction: column; gap: 12px; }

.request-row {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 14px 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.req-poster {
  width: 40px;
  height: 60px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  background: var(--surface);
}

.req-poster.no-poster {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.req-info { flex: 1; min-width: 0; }
.req-title { font-size: 15px; font-weight: 600; }
.req-year { color: var(--muted); font-weight: 400; }
.req-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

@media (max-width: 600px) {
  nav {
    flex-direction: column;
    align-items: stretch;
    padding: 20px 20px 0;
    gap: 12px;
  }
  .search-box { width: 100%; }
  .search-box input { font-size: 24px; }
  .nav-links { justify-content: flex-end; order: -1; }
  main { padding: 0 20px 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
}
