/* TV Watchlist & Rewatch Planner - Styles */
:root {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-card: #222;
  --bg-card-hover: #2a2a2a;
  --text-primary: #f0f0f0;
  --text-secondary: #aaa;
  --text-muted: #666;
  --accent: #E50914;
  --accent-hover: #f40612;
  --accent-dim: rgba(229, 9, 20, 0.15);
  --border: #333;
  --border-light: #444;
  --success: #46d369;
  --warning: #f5c518;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}

.main-nav {
  display: flex;
  gap: 24px;
}

.main-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color var(--transition);
}

.main-nav a:hover { color: var(--text-primary); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
}

/* Hero */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--bg-card-hover); }

.btn-small {
  padding: 8px 16px;
  font-size: 0.85rem;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-small:hover { color: var(--text-primary); background: var(--bg-card-hover); }

.btn-danger {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-danger:hover { background: var(--accent-dim); }

/* Sections */
section { padding: 60px 0; }

section h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-desc {
  color: var(--text-secondary);
  margin-bottom: 28px;
  max-width: 600px;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* Mood Section */
.mood-section {
  background: var(--bg-secondary);
}

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

.mood-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.mood-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.mood-card.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.mood-icon { font-size: 1.8rem; }
.mood-name { font-weight: 600; font-size: 0.95rem; }
.mood-desc { font-size: 0.8rem; color: var(--text-muted); }

.mood-results {
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  display: none;
}

.mood-results.visible { display: block; }

/* Add Form */
.add-section {
  background: var(--bg-primary);
}

.add-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group textarea { resize: vertical; }

/* Watchlist */
.watchlist-section {
  background: var(--bg-secondary);
}

.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-bar select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.9rem;
}

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

.show-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}

.show-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow);
}

.show-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.show-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.show-platform {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.show-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-mood { background: var(--accent-dim); color: var(--accent); }
.tag-priority-high { background: rgba(245, 197, 24, 0.15); color: var(--warning); }
.tag-priority-medium { background: rgba(70, 211, 105, 0.15); color: var(--success); }
.tag-priority-low { background: rgba(102, 102, 102, 0.2); color: var(--text-muted); }

.show-progress {
  margin-bottom: 12px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.progress-bar {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.show-notes {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-style: italic;
}

.show-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.episode-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.episode-controls button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.episode-controls button:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.episode-display {
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 80px;
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  display: none;
}

.empty-state.visible { display: block; }

/* Rewatch Section */
.rewatch-section {
  background: var(--bg-primary);
}

.rewatch-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  align-items: end;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.rewatch-plan {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: none;
}

.rewatch-plan.visible { display: block; }

.rewatch-plan h3 {
  margin-bottom: 16px;
}

.episode-list {
  list-style: none;
}

.episode-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.episode-list li:last-child { border-bottom: none; }

.episode-num {
  font-weight: 600;
  color: var(--accent);
}

/* Guides Section */
.guides-section {
  background: var(--bg-secondary);
}

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

.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.guide-card h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.guide-card .guide-seasons {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.guide-episodes {
  list-style: none;
}

.guide-episodes li {
  padding: 6px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}

.guide-episodes li:last-child { border-bottom: none; }

.guide-episodes .ep-season {
  color: var(--accent);
  font-weight: 600;
  margin-right: 8px;
}

/* Tips Section */
.tips-section {
  background: var(--bg-primary);
}

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

.tip-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.tip-card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--accent);
}

.tip-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Footer */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 32px 0;
}

.footer-inner {
  text-align: center;
}

.footer-inner p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 8px;
}

.footer-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
}

.footer-nav a:hover { color: var(--text-primary); }

.footer-note a {
  color: var(--accent);
  text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 20px;
    gap: 16px;
  }

  .main-nav.open { display: flex; }

  .nav-toggle { display: flex; }

  .hero h1 { font-size: 2rem; }
  .hero-sub { font-size: 1rem; }

  section { padding: 40px 0; }
  section h2 { font-size: 1.5rem; }

  .mood-grid { grid-template-columns: repeat(2, 1fr); }
  .watchlist-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .rewatch-controls { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .mood-grid { grid-template-columns: 1fr 1fr; }
  .hero-actions { flex-direction: column; align-items: center; }
  .header-actions { flex-wrap: wrap; }
}

/* Print */
@media print {
  .site-header, .site-footer, .add-section, .mood-section, .rewatch-section, .tips-section { display: none; }
  body { background: white; color: black; }
  .show-card { border: 1px solid #ccc; break-inside: avoid; }
}

/* Edit modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-overlay.visible { display: flex; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
