:root {
  --plex-orange: #e5a00d;
  --plex-orange-bright: #f0b73a;
  --plex-orange-dark: #b87f08;
  --plex-orange-soft: rgba(229, 160, 13, 0.08);

  --bg: #0a0a0b;
  --bg-elev: #111113;
  --bg-card: #161618;
  --bg-card-hover: #1c1c1f;
  --panel: rgba(17, 17, 19, 0.92);
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);

  --text: #f0eee9;
  --text-dim: #b8b3aa;
  --muted: #6b6660;

  --green: #5ec98a;
  --blue: #5fa8d3;
  --red: #e06c5a;
  --amber: var(--plex-orange);

  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 12px 36px rgba(229, 160, 13, 0.22);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(ellipse at 15% -5%, rgba(229, 160, 13, 0.05), transparent 40%),
    radial-gradient(ellipse at 90% 8%, rgba(229, 160, 13, 0.03), transparent 35%),
    linear-gradient(180deg, #0e0e10 0%, var(--bg) 60%, #050506 100%);
  background-attachment: fixed;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 60px;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 32px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(17, 17, 19, 0.7);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #0a0a0b;
  border: 1px solid rgba(229, 160, 13, 0.4);
  color: var(--plex-orange);
  font-weight: 800;
  font-size: 1.1rem;
}

.brand strong { display: block; font-size: 1.02rem; letter-spacing: -0.01em; }
.brand small { display: block; color: var(--muted); margin-top: 2px; font-size: 0.78rem; }

.nav-tabs {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
}

.tab {
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 7px;
  color: var(--text-dim);
  background: transparent;
  font-weight: 600;
  font-size: 0.92rem;
  transition: color .15s ease, background .15s ease;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  color: var(--plex-orange);
  background: rgba(229, 160, 13, 0.1);
  box-shadow: inset 0 0 0 1px rgba(229, 160, 13, 0.3);
}

/* ---------- Views ---------- */
.view { display: none; }
.view.is-visible { display: block; }

/* ---------- Request layout (hero + form) ---------- */
.request-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 28px;
  align-items: stretch;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: clamp(440px, 60vh, 620px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.95)),
    url("https://images.unsplash.com/photo-1489599849927-2ee91cede3ba?auto=format&fit=crop&w=1400&q=80") center / cover;
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(115deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.35) 60%, transparent);
}

.hero-copy {
  position: absolute;
  z-index: 2;
  left: clamp(22px, 5vw, 58px);
  right: clamp(22px, 8vw, 110px);
  bottom: clamp(28px, 7vw, 68px);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--plex-orange-bright);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(2.1rem, 5.2vw, 4.2rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.hero p:not(.eyebrow) {
  max-width: 560px;
  margin: 18px 0 0;
  color: #e0d4be;
  font-size: clamp(0.98rem, 1.4vw, 1.05rem);
  line-height: 1.6;
}

.hero-media {
  position: absolute;
  z-index: 1;
  right: 7%;
  top: 9%;
  display: flex;
  gap: 14px;
  transform: rotate(-7deg);
}

.poster {
  width: clamp(88px, 9vw, 122px);
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.5);
}

.poster-one { background: linear-gradient(160deg, #2a2a2d, #16161a 60%, #050506); }
.poster-two { margin-top: 44px; background: linear-gradient(160deg, #38302a, #18140f 55%, #050506); }
.poster-three { margin-top: 12px; background: linear-gradient(160deg, #1f1f22, #0e0e10 60%, #050506); }

/* ---------- Panels & cards ---------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.request-form, .login-panel {
  padding: clamp(22px, 3vw, 34px);
}

.form-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.icon-badge {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(229, 160, 13, 0.08);
  color: var(--plex-orange);
  border: 1px solid rgba(229, 160, 13, 0.18);
}

h1, h2, h3, p { overflow-wrap: anywhere; }

.form-head h1, .form-head h2 {
  margin: 0 0 4px;
  font-size: 1.32rem;
  letter-spacing: -0.01em;
}

.form-head p, .admin-subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.93rem;
}

/* ---------- Form fields ---------- */
label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.88rem;
}

input, textarea, select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #050506;
  outline: 0;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input, textarea { padding: 12px 14px; }
textarea { resize: vertical; min-height: 120px; }
select { padding: 0 12px; appearance: none; background-image:
  linear-gradient(45deg, transparent 50%, var(--plex-orange) 50%),
  linear-gradient(135deg, var(--plex-orange) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

input::placeholder, textarea::placeholder { color: #6e6353; }

input:hover, textarea:hover, select:hover { border-color: var(--line-strong); }

input:focus, textarea:focus, select:focus {
  border-color: rgba(229, 160, 13, 0.55);
  box-shadow: 0 0 0 3px rgba(229, 160, 13, 0.1);
}

/* ---------- Buttons ---------- */
.primary-action, .ghost-action, .delete-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border-radius: var(--radius);
  border: 0;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}

.primary-action {
  width: 100%;
  margin-top: 6px;
  color: #100c04;
  background: var(--plex-orange);
  box-shadow: 0 4px 14px rgba(229, 160, 13, 0.15);
}

.primary-action:hover {
  background: var(--plex-orange-bright);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(229, 160, 13, 0.22);
  transform: translateY(-1px);
}

.primary-action:active { transform: translateY(0); }

.ghost-action {
  padding: 0 18px;
  color: var(--text-dim);
  border: 1px solid var(--line-strong);
  background: transparent;
}

.ghost-action:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ---------- Messages ---------- */
.message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.message.is-success { color: var(--green); }
.message.is-error { color: var(--red); }

/* ---------- Admin layout ---------- */
.admin-layout {
  width: min(1140px, 100%);
  margin: 0 auto;
}

.login-panel {
  width: min(480px, 100%);
  margin: 48px auto 0;
}

.dashboard { display: grid; gap: 20px; }
.is-hidden { display: none !important; }

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(24px, 4vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}

.admin-hero h2 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  transition: border-color .15s ease, background .15s ease;
}

.stat:hover { border-color: var(--line-strong); background: var(--bg-card); }

.stat strong {
  display: block;
  margin-bottom: 6px;
  font-size: clamp(1.9rem, 4vw, 2.4rem);
  line-height: 1;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat span {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* ---------- Admin sections ---------- */
.admin-section {
  padding: clamp(18px, 2.5vw, 24px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
}

.controls-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 230px);
  gap: 14px;
  align-items: stretch;
}

.search { position: relative; margin: 0; }

.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search input { padding-left: 44px; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title h3 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.section-title span {
  color: var(--text-dim);
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

/* ---------- Request cards ---------- */
.requests-list { display: grid; gap: 12px; }

.request-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  padding: clamp(16px, 2.2vw, 20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.request-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--line-strong);
}

.request-card h3 {
  margin: 10px 0 6px;
  font-size: clamp(1.05rem, 1.8vw, 1.2rem);
  letter-spacing: -0.01em;
}

.meta, .notes {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.9rem;
}

.notes {
  margin-top: 10px;
  padding: 10px 12px;
  color: var(--text-dim);
  background: #050506;
  border-left: 2px solid rgba(229, 160, 13, 0.5);
  border-radius: 4px;
}

/* ---------- Status pill ---------- */
.status-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--plex-orange);
  background: rgba(229, 160, 13, 0.1);
  border: 1px solid rgba(229, 160, 13, 0.25);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-pill.approved { color: var(--blue); background: rgba(95, 168, 211, 0.1); border-color: rgba(95, 168, 211, 0.25); }
.status-pill.added { color: var(--green); background: rgba(94, 201, 138, 0.1); border-color: rgba(94, 201, 138, 0.28); }
.status-pill.rejected { color: var(--red); background: rgba(224, 108, 90, 0.1); border-color: rgba(224, 108, 90, 0.28); }

.link-zone {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.link-add-btn, .link-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.link-add-btn svg, .link-open-btn svg { width: 15px; height: 15px; }

.link-add-btn {
  border: 1px dashed rgba(229, 160, 13, 0.35);
  background: transparent;
  color: var(--plex-orange);
}

.link-add-btn:hover {
  background: rgba(229, 160, 13, 0.1);
  border-color: var(--plex-orange);
  border-style: solid;
  color: #ffffff;
}

.link-open-btn {
  border: 1px solid rgba(94, 201, 138, 0.4);
  background: rgba(94, 201, 138, 0.1);
  color: var(--green);
}

.link-open-btn:hover {
  background: rgba(94, 201, 138, 0.22);
  border-color: var(--green);
  color: #ffffff;
}

.link-edit-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.link-edit-btn svg { width: 14px; height: 14px; }

.link-edit-btn:hover {
  background: rgba(229, 160, 13, 0.1);
  border-color: var(--plex-orange);
  color: #ffffff;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.is-open { display: flex; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  animation: modal-fade .2s ease;
}

.modal-panel {
  position: relative;
  width: min(520px, 100%);
  padding: 26px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #111113;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: modal-slide .25s cubic-bezier(.2, .8, .2, 1);
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.modal-head h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.modal-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.modal-close {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

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

.modal-actions .ghost-action {
  width: auto;
}

.modal-actions .primary-action {
  width: auto;
  margin-top: 0;
  padding: 0 22px;
}

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-slide {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.search-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  min-width: 150px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(229, 160, 13, 0.3);
  background: transparent;
  color: var(--plex-orange);
  font-weight: 600;
  font-size: 0.88rem;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.search-button:hover {
  background: rgba(229, 160, 13, 0.15);
  border-color: var(--plex-orange);
  color: #ffffff;
}

.search-button.is-approved {
  background: rgba(95, 168, 211, 0.1);
  border-color: rgba(95, 168, 211, 0.4);
  color: var(--blue);
}

.search-button.is-approved:hover {
  background: rgba(95, 168, 211, 0.22);
  border-color: var(--blue);
  color: #ffffff;
}

.search-button.is-added {
  background: rgba(94, 201, 138, 0.08);
  border-color: rgba(94, 201, 138, 0.32);
  color: var(--green);
}

.search-button.is-added:hover {
  background: rgba(94, 201, 138, 0.18);
  border-color: var(--green);
  color: #ffffff;
}

.delete-button:hover {
  background: rgba(224, 108, 90, 0.18);
  border-color: var(--red);
  color: #ffffff;
}

.delete-button {
  width: 42px;
  min-height: 42px;
  color: var(--red);
  border: 1px solid rgba(224, 108, 90, 0.25);
  background: transparent;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

/* ---------- Empty ---------- */
.empty {
  padding: 40px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: rgba(0, 0, 0, 0.15);
}

/* ---------- Toast (Toastify overrides) ---------- */
.toastify {
  font-family: Inter, system-ui, sans-serif !important;
  backdrop-filter: blur(14px);
}

.toastify .toast-close {
  color: var(--muted);
  opacity: 0.7;
  margin-left: 14px;
  transition: opacity .15s ease, color .15s ease;
}

.toastify .toast-close:hover { color: var(--text); opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .request-layout { grid-template-columns: 1fr; }
  .request-form { width: min(620px, 100%); margin: 0 auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-hero, .request-card { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 20px, 1200px); padding-top: 12px; }
  .topbar, .admin-hero, .section-title, .card-actions {
    align-items: stretch;
    flex-direction: column;
    display: flex;
  }
  .nav-tabs, .controls-section select, .status-select { width: 100%; }
  .tab { flex: 1; }
  .hero { min-height: 420px; }
  .hero h1 { font-size: clamp(1.9rem, 10vw, 2.8rem); line-height: 1.08; }
  .hero-copy { left: 20px; right: 20px; bottom: 24px; }
  .hero-media { right: -44px; top: 30px; opacity: 0.5; }
  .poster { width: 80px; }
  .controls-section, .stats { grid-template-columns: 1fr; }
  .request-card { display: flex; flex-direction: column; }
  .delete-button { width: 100%; }
}

@media (max-width: 390px) {
  .hero h1 { font-size: 1.85rem; }
  .brand small { display: none; }
}
