/* CrunchyFlix panel - dark, matching the dashboard's palette. */

:root {
  --bg: #0b0e14;
  --panel: #141922;
  --panel-2: #1b2230;
  --line: #232b3a;
  --ink: #e8edf5;
  --ink-dim: #94a1b8;
  --green: #22c55e;
  --amber: #e5a00d;
  --red: #ef4444;
  --indigo: #6366f1;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ------------------------------------------------------------- masthead */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 18px;
  flex-wrap: wrap;
}

.masthead__logo { height: 40px; width: auto; }

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.nav__who {
  color: var(--ink-dim);
  font-size: 14px;
}

.nav__link {
  font-size: 14px;
  color: var(--ink);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color .15s, color .15s;
}
.nav__link:hover { border-color: var(--green); }
.nav__link--quiet { color: var(--ink-dim); }

/* ----------------------------------------------------------------- main */

.main { flex: 1; padding-bottom: 48px; }

.hero {
  max-width: 560px;
  margin: 12vh auto 0;
  text-align: center;
}

.hero__title {
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.15;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}

.hero__lede { color: var(--ink-dim); margin: 0 0 28px; font-size: 16px; }

.hero__note {
  color: var(--ink-dim);
  font-size: 13px;
  margin: 26px auto 0;
  max-width: 44ch;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s, filter .15s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }

.btn--plex { background: var(--amber); color: #1a1204; }
.btn--plex .btn__icon { width: 18px; height: 18px; fill: currentColor; }

.btn--quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-dim);
  margin-top: 24px;
}

/* ---------------------------------------------------------------- stats */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 8px 0 34px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stat__n {
  display: block;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.stat__l {
  display: block;
  color: var(--ink-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 4px;
}

/* --------------------------------------------------------------- blocks */

.block { margin-bottom: 40px; }

.block__title {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-dim);
  margin: 0 0 14px;
  font-weight: 600;
}

/* Horizontal scroller. Wide content scrolls inside itself so the page body
   never scrolls sideways on a phone. */
.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 150px;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}
.rail > * { scroll-snap-align: start; }

.card { display: block; }

.card__art {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.card__art img { width: 100%; height: 100%; object-fit: cover; }
.card__ph { width: 100%; height: 100%; background: linear-gradient(160deg, #1b2230, #232b3a); }

.card__bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(0,0,0,.55);
}
.card__bar span { display: block; height: 100%; background: var(--amber); }

.card__date {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(11,14,20,.85);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--ink);
}

.card__t {
  margin: 8px 0 2px;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.3;
  /* Two-line clamp keeps the rail's rows aligned regardless of title length. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__s {
  margin: 0;
  font-size: 12px;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----------------------------------------------------------------- pills */

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink-dim);
}
.pill--available        { color: var(--green);  border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.pill--partly-available { color: var(--green);  border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.pill--downloading      { color: var(--amber);  border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.pill--awaiting-approval{ color: var(--indigo); border-color: color-mix(in srgb, var(--indigo) 45%, transparent); }
.pill--declined         { color: var(--red);    border-color: color-mix(in srgb, var(--red) 45%, transparent); }

/* ------------------------------------------------------------------ list */

.list { list-style: none; margin: 0; padding: 0; }

.list__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: baseline;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
}

.list__t { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__s { font-size: 12px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.list__d { font-size: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

.empty { color: var(--ink-dim); text-align: center; padding: 40px 0; }

/* ---------------------------------------------------------------- footer */

.footer {
  border-top: 1px solid var(--line);
  padding: 18px 0 26px;
  color: var(--ink-dim);
  font-size: 12px;
}

@media (max-width: 560px) {
  .rail { grid-auto-columns: 124px; }
  .list__row { grid-template-columns: 1fr auto; }
  .list__s { display: none; }
}

/* --------------------------------------------------------------- notices */
/* Shown when Plex bounced the user back with ?e=<reason>. */

.notice {
  max-width: 46ch;
  margin: 0 auto 24px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-dim);
  font-size: 14px;
  text-align: left;
}

.notice--warn {
  border-color: color-mix(in srgb, var(--amber) 45%, transparent);
  color: var(--ink);
}

/* The signed-in nav is revealed by JS once /api/panel confirms a session. */
[hidden] { display: none !important; }

/* ------------------------------------------------------- playable cards */
/* Cards carrying a Plex deep link. Continue Watching is always playable;
   requests only once Seerr reports the item is actually on the server. */

.card--playable { cursor: pointer; }

.card--playable .card__art {
  transition: transform .15s ease, border-color .15s ease;
}

.card--playable:hover .card__art,
.card--playable:focus-visible .card__art {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--amber) 55%, transparent);
}

.card--playable:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 10px;
}

.card__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(11,14,20,.15), rgba(11,14,20,.65));
  opacity: 0;
  transition: opacity .15s ease;
}

.card--playable:hover .card__play,
.card--playable:focus-visible .card__play { opacity: 1; }

.card__play svg {
  width: 42px;
  height: 42px;
  fill: var(--ink);
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.6));
}

/* Touch devices get no hover, so show the badge permanently but muted. */
@media (hover: none) {
  .card__play { opacity: 1; background: none; }
  .card__play svg { width: 32px; height: 32px; opacity: .85; }
}

/* The progress bar must sit above the play overlay, not under it. */
.card__bar { z-index: 1; }

/* Site-wide notice, shown above the panel content rather than inside the
   sign-in hero. Same notice.json the landing page reads. */
.notice--banner {
  max-width: none;
  margin: 0 0 26px;
  text-align: center;
}
