/* ── tvtracker styles ───────────────────────────────────────────────────────────
   Page-specific styles for tvtracker experience.
   shared.css (loaded first) provides design tokens, the reset, base body /
   link styles, and the shared navbar; this file only adds the layout and
   components unique to this page.
   ──────────────────────────────────────────────────────────────────────────── */

/* ── Extra Design Tokens (TV Tracker only) ──────────────────────────────────── */
:root {
  --danger:  #e05c6e;  /* Destructive-action red (delete buttons)   */
  --success: #4caf82;  /* Positive-action green (completed status)  */
  --star:    #f5c842;  /* Star-rating yellow                        */
  --warn:    #e0b25c;  /* Status banner warning colour               */
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Back-to-home link in the navbar */
.nav-back {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition);
}
.nav-back:hover { color: var(--text); }

/* ── Main ───────────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.5rem 4rem;
  gap: 2rem;
}
.page-header { text-align: center; }
.page-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  margin-bottom: 0.4rem;
}
.page-header p { color: var(--text-muted); font-size: 1rem; }
.accent { color: var(--accent-lt); }

/* ── Status banner (Firebase connection state) ─────────────────────────────── */
.banner {
  width: 100%;
  max-width: 900px;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  text-align: center;
  display: none;
}
.banner.visible { display: block; }
.banner.info {
  background: rgba(124,106,247,.12);
  border: 1px solid rgba(124,106,247,.3);
  color: var(--accent-lt);
}
.banner.warn {
  background: rgba(224,178,92,.12);
  border: 1px solid rgba(224,178,92,.35);
  color: var(--warn);
}
.banner.error {
  background: rgba(224,92,110,.12);
  border: 1px solid rgba(224,92,110,.35);
  color: var(--danger);
}

.owner-auth {
  width: 100%;
  max-width: 900px;
  display: flex;
  justify-content: flex-end;
}

/* ── Panels ─────────────────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  width: 100%;
  max-width: 900px;
}
.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-lt);
  margin-bottom: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.badge {
  background: rgba(124,106,247,.2);
  border: 1px solid rgba(124,106,247,.35);
  border-radius: 20px;
  font-size: 0.72rem;
  padding: 0.1rem 0.55rem;
  color: var(--accent-lt);
  font-weight: 700;
}

/* ── Add-show form ──────────────────────────────────────────────────────────── */
.log-entry-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: flex-end;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1 1 160px;
  min-width: 140px;
}
.form-field-sm { flex: 0 1 90px; min-width: 80px; }
.form-field-wide { flex: 2 1 220px; }
.form-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}
.optional-tag { font-weight: 400; color: var(--text-muted); opacity: 0.8; }
.form-input {
  padding: 0.55rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
  font-family: inherit;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-muted); }
select.form-input { cursor: pointer; }

#add-show-submit { flex: 0 0 auto; white-space: nowrap; }

/* ── Star rating ────────────────────────────────────────────────────────────── */
/* Interactive input (add form) */
.stars {
  display: flex;
  gap: 2px;
}
.star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.2rem 0.1rem;
  color: var(--border);
  transition: color var(--transition), transform var(--transition);
}
.star:hover { transform: scale(1.15); }
.star.filled { color: var(--star); }

/* Read-only / interactive display (show cards) */
.stars-display { display: inline-flex; gap: 1px; }
.star-display {
  font-size: 0.9rem;
  color: var(--border);
  line-height: 1;
}
.star-display.filled { color: var(--star); }
.card-rating-star {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.1rem;
  font-size: 1.1rem;
  color: var(--border);
  transition: color var(--transition), transform var(--transition);
}
.card-rating-star:hover { transform: scale(1.15); }
.card-rating-star.filled { color: var(--star); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  border: none;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-lt); color: #fff; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { border-color: var(--accent-lt); color: var(--accent-lt); }
.btn-sm { font-size: 0.8rem; padding: 0.42rem 0.8rem; }

.btn-icon {
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
}
.btn-icon.btn-icon-danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(224,92,110,.12); }

/* ── Show cards ─────────────────────────────────────────────────────────────── */
#watching-list, #towatch-list, #completed-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.show-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.show-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.show-title { font-weight: 700; font-size: 1.02rem; }
.show-notes { color: var(--text-muted); font-size: 0.85rem; }

.rating-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.rating-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.rating-summary {
  color: var(--text-muted);
  font-size: 0.82rem;
}
.rating-summary-empty { opacity: 0.6; }

.watch-history {
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
  margin-top: 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
}
.watch-history-title {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.watch-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.watch-history-empty {
  color: var(--text-muted);
  font-size: 0.82rem;
  opacity: 0.7;
}

.show-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.progress-input {
  width: 4.2rem;
  padding: 0.4rem 0.5rem;
}

.show-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.show-actions .btn-icon { margin-left: auto; }

.cell-pill {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.1rem 0.55rem;
  font-size: 0.78rem;
  color: var(--accent-lt);
  font-weight: 700;
  white-space: nowrap;
}

/* ── Empty state ────────────────────────────────────────────────────────────── */
.empty-state {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.empty-icon { font-size: 2rem; margin-bottom: 0.5rem; }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  main { padding: 2rem 1rem 3rem; }
  .panel { padding: 1.25rem 1.25rem; }
  .form-field, .form-field-sm, .form-field-wide { flex: 1 1 100%; min-width: 0; }
  #add-show-submit { width: 100%; }
  .show-actions .btn-icon { margin-left: 0; }
}
