/* PutFlix — styled to match the house dashboard: deep navy panels, neon
   pink accent, teal for swarm health, amber for ratings, letterspaced
   uppercase labels. Type: Archivo (UI) / Spline Sans Mono (data + labels). */

:root {
  --ink: #0a0e16;
  --panel: #121826;
  --panel-2: #19202f;
  --line: #222c3e;
  --paper: #e9edf6;
  --dim: #8b95ac;
  --pink: #ff3358;
  --pink-bright: #ff5d7a;
  --pink-soft: rgba(255, 51, 88, 0.14);
  --health: #35e2c6;
  --health-soft: rgba(53, 226, 198, 0.13);
  --star: #f5a83c;
  --err: #ff3358;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
}

body {
  min-height: 100vh;
  padding-bottom: 4rem;
  /* Ambient screen light spilling into a dark auditorium. */
  background-image: radial-gradient(
      ellipse 90% 45% at 20% -10%,
      rgba(255, 51, 88, 0.09),
      transparent 60%
    ),
    radial-gradient(
      ellipse 90% 45% at 85% -10%,
      rgba(53, 226, 198, 0.06),
      transparent 60%
    );
  background-repeat: no-repeat;
}

button {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}

/* Topbar */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.5rem;
  background: rgba(10, 14, 22, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  filter: drop-shadow(0 0 14px rgba(255, 51, 88, 0.25));
}

.popcorn {
  display: block;
  animation: popcorn-bob 2.4s ease-in-out infinite;
  transform-origin: 50% 88%;
}

@keyframes popcorn-bob {
  0%,
  100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

.pop {
  opacity: 0;
  animation: kernel-pop 2.4s ease-out infinite;
}

.pop-2 {
  animation-delay: 0.55s;
}

.pop-3 {
  animation-delay: 1.15s;
}

@keyframes kernel-pop {
  0% {
    opacity: 0;
    transform: translateY(7px) scale(0.4);
  }
  14% {
    opacity: 1;
  }
  38% {
    opacity: 1;
    transform: translateY(-6px) scale(1);
  }
  58% {
    opacity: 0;
    transform: translateY(-11px) scale(0.85);
  }
  100% {
    opacity: 0;
    transform: translateY(-11px) scale(0.85);
  }
}

.search-form {
  display: flex;
  flex: 1;
  min-width: 220px;
  max-width: 640px;
  gap: 0.5rem;
}

.search-form input {
  flex: 1;
  padding: 0.7rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--paper);
  font-size: 1rem;
  font-family: inherit;
  min-height: 44px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-form input::placeholder {
  color: var(--dim);
}

.search-form input:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px var(--pink-soft), 0 0 24px rgba(255, 51, 88, 0.15);
}

.search-form input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-btn {
  padding: 0.7rem 1.5rem;
  min-height: 44px;
  border-radius: 12px;
  border: none;
  background: var(--pink);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.search-btn:hover {
  background: var(--pink-bright);
  box-shadow: 0 0 20px rgba(255, 51, 88, 0.4);
}

/* Quality filters */

.filters {
  display: flex;
  gap: 0.5rem;
  padding: 1.1rem 1.5rem 0;
  flex-wrap: wrap;
}

.chip {
  padding: 0.45rem 1rem;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--dim);
  font-family: "Spline Sans Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.chip:hover {
  color: var(--paper);
  border-color: var(--dim);
}

.chip.active {
  background: var(--pink-soft);
  border-color: var(--pink);
  color: var(--pink-bright);
}

/* Main / status */

main,
.filters {
  max-width: 1024px;
  margin-left: auto;
  margin-right: auto;
}

main {
  padding: 1.5rem;
}

.status {
  color: var(--dim);
  font-size: 1rem;
  padding: 2.5rem 0;
  text-align: center;
}

/* Section headings — dashboard panel labels. */

.trending-section + .trending-section {
  margin-top: 2.5rem;
}

.section-heading {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin: 0 0 1rem 0.25rem;
  color: var(--paper);
}

.section-heading::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 10px rgba(255, 51, 88, 0.6);
  margin-right: 0.65rem;
  vertical-align: 1px;
}

/* Results — floating cards, like posters on a cinema wall. */

.results,
.trending-section .results {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.row {
  position: relative;
  background: linear-gradient(160deg, var(--panel-2), var(--panel) 55%);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  padding: 0.9rem 1.15rem;
  min-height: 124px;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  animation: row-in 0.32s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  animation-delay: calc(min(var(--i, 0), 14) * 26ms);
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.row:hover {
  border-color: rgba(255, 51, 88, 0.35);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.45), 0 0 24px rgba(255, 51, 88, 0.07);
  transform: translateY(-1px);
}

.row-poster {
  position: relative;
  flex-shrink: 0;
  width: 74px;
  height: 105px;
  border-radius: 10px;
  background: var(--panel-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.row-poster::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, var(--panel-2), var(--ink));
}

.row-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.row-poster img.loaded {
  opacity: 1;
}

.row-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
  background-position: 150% 0;
  animation: poster-shimmer 1.2s infinite;
}

.row-poster:has(img.loaded)::after,
.row-poster.no-poster::after {
  display: none;
  animation: none;
}

@keyframes poster-shimmer {
  to {
    background-position: -50% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .row-poster::after {
    animation: none;
    background: rgba(255, 255, 255, 0.04);
  }
}

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.row-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.8rem;
  font-family: "Spline Sans Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
  color: var(--dim);
}

.badge {
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--dim);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11rem;
}

.stat {
  white-space: nowrap;
}

.stat.seeders {
  color: var(--health);
  font-weight: 700;
  font-size: 0.85rem;
  text-shadow: 0 0 12px rgba(53, 226, 198, 0.35);
}

.stat.rating {
  color: var(--star);
  font-weight: 700;
  text-shadow: 0 0 12px rgba(245, 168, 60, 0.35);
}

.add-feedback {
  font-size: 0.76rem;
  font-weight: 700;
}

.add-feedback:empty {
  display: none;
}

.add-feedback.success {
  color: var(--health);
}

.add-feedback.error {
  color: var(--err);
}

/* The + button — the whole point of the page. */

.add-btn {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--pink-bright);
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease, transform 0.1s ease;
}

.add-btn:hover:not(:disabled) {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 51, 88, 0.45);
}

.add-btn:active:not(:disabled) {
  transform: scale(0.9);
}

.add-btn:disabled {
  cursor: default;
}

.add-btn.done {
  background: var(--health-soft);
  border-color: var(--health);
  color: var(--health);
  box-shadow: 0 0 16px rgba(53, 226, 198, 0.3);
}

.add-btn.busy {
  background: var(--panel-2);
}

.add-btn.busy::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--pink);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Login overlay */

.overlay[hidden] {
  display: none;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 15, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  text-align: center;
  box-shadow: 0 0 60px rgba(255, 51, 88, 0.08), 0 24px 48px rgba(0, 0, 0, 0.55);
}

.login-card h2 {
  margin: 0;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--pink);
  text-shadow: 0 0 22px rgba(255, 51, 88, 0.4);
}

.login-card p {
  margin: 0;
  color: var(--dim);
  font-size: 0.9rem;
}

.login-card input {
  padding: 0.7rem 1rem;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--paper);
  font-size: 1rem;
  font-family: inherit;
}

.login-card input:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px var(--pink-soft);
}

.login-card button {
  padding: 0.7rem 1rem;
  min-height: 44px;
  border-radius: 10px;
  border: none;
  background: var(--pink);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.login-card button:hover {
  background: var(--pink-bright);
}

.login-error {
  color: var(--err);
  font-size: 0.85rem;
}

/* Motion off */

@media (prefers-reduced-motion: reduce) {
  .popcorn,
  .pop {
    animation: none;
  }
  .pop {
    opacity: 1;
  }
  .row {
    animation: none;
  }
  .row-poster img {
    transition: none;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* Responsive */

@media (max-width: 520px) {
  .topbar {
    padding: 0.85rem 1rem;
    gap: 0.75rem 1rem;
  }

  .brand {
    font-size: 1.25rem;
  }

  main {
    padding: 1rem;
  }

  .filters {
    padding: 0.85rem 1rem 0;
  }

  .row {
    padding: 0.75rem 0.85rem;
    gap: 0.75rem;
    min-height: 112px;
    border-radius: 16px;
  }

  .row-poster {
    width: 64px;
    height: 91px;
  }

  .add-btn {
    width: 46px;
    height: 46px;
  }

  .badge {
    max-width: 7.5rem;
  }
}
