/* ════════════════════════════════════════════════════════════════════════
   FinalVerse — Watch Sources finder styles (fv-source-finder.css)
   Poster grid for the scraped-sources admin tab. Uses the site's existing
   design tokens (--accent #e8b84b, --accent2 #e05c3a, --text, --muted, --card).
   UI/UX notes baked in:
   • Touch targets ≥ 44px (the add button + pager buttons).
   • Visible focus rings (no removed outlines).
   • Reserved poster space (2/3 aspect) so lazy images don't shift layout.
   • Transitions 160–220ms; full prefers-reduced-motion fallback.
   • Color never the sole signal (server count shown as text, not just a dot).
   ════════════════════════════════════════════════════════════════════════ */

/* stats line under the search card */
.fv-src-stats{
  margin-top:.6rem;
  font-size:.82rem;
  color:var(--muted);
  letter-spacing:.2px;
}
.fv-src-stats b{ color:var(--text); font-weight:700; }

/* responsive auto-fill grid */
.fv-src-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(150px,1fr));
  gap:1rem;
  margin-top:1rem;
}

/* card */
.fv-src-card{
  background:var(--card,rgba(255,255,255,.03));
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  transition:transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.fv-src-card:hover{
  transform:translateY(-3px);
  border-color:rgba(232,184,75,.45);
  box-shadow:0 10px 28px rgba(0,0,0,.4);
}

/* poster — reserve 2:3 box so lazy load doesn't cause CLS */
.fv-src-poster{
  position:relative;
  width:100%;
  aspect-ratio:2/3;
  background:#11131a;
  overflow:hidden;
}
.fv-src-poster-img{
  width:100%; height:100%;
  object-fit:cover;
  display:block;
  animation:fvSrcFade .25s ease;
}
@keyframes fvSrcFade{ from{opacity:0} to{opacity:1} }

.fv-src-poster-skel{
  position:absolute; inset:0;
  background:linear-gradient(110deg,#15171f 8%,#1d2029 18%,#15171f 33%);
  background-size:200% 100%;
  animation:fvSrcShimmer 1.2s linear infinite;
  display:flex; align-items:center; justify-content:center;
  color:var(--muted);
}
.fv-src-poster-none{
  background:#13151c;
  animation:none;
}
@keyframes fvSrcShimmer{ to{ background-position:-200% 0; } }

/* server-count badge — text + bg so it's not color-only */
.fv-src-badge{
  position:absolute; top:8px; left:8px;
  background:rgba(10,12,16,.82);
  border:1px solid rgba(232,184,75,.55);
  color:var(--accent,#e8b84b);
  font-size:.7rem; font-weight:700;
  padding:3px 8px; border-radius:999px;
  backdrop-filter:blur(4px);
  letter-spacing:.2px;
}
/* multi-source badge — shows when a film was merged from several sites */
.fv-src-sites{
  position:absolute; top:8px; right:8px;
  background:rgba(224,92,58,.9);
  color:#fff;
  font-size:.66rem; font-weight:700;
  padding:3px 8px; border-radius:999px;
  letter-spacing:.2px;
}

/* library-status badge (bottom-right of poster): green check / red X */
.fv-src-status{
  position:absolute; bottom:8px; right:8px;
  width:26px; height:26px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  color:#fff; box-shadow:0 2px 8px rgba(0,0,0,.5);
}
.fv-src-status-green{ background:#22c55e; }
.fv-src-status-red{ background:#ef4444; }

/* Add All button row */
.fv-src-actions{ margin-top:.8rem; display:flex; gap:.5rem; }
#fv-src-addall-btn{ min-height:42px; font-weight:800; }

/* bulk progress bar */
.fv-src-bulkbar{ margin:1rem 0 .25rem; }
.fv-src-bulkbar-label{
  display:flex; justify-content:space-between;
  font-size:.8rem; color:var(--muted); margin-bottom:.35rem;
}
.fv-src-bulkbar-track{
  height:8px; border-radius:6px; overflow:hidden;
  background:rgba(255,255,255,.08);
}
.fv-src-bulkbar-fill{
  height:100%; border-radius:6px;
  background:linear-gradient(90deg,#e8b84b,#e05c3a);
  transition:width .25s ease;
}

/* ── detailed results panel ─────────────────────────────────────── */
.fv-src-results{
  margin:1rem 0 .25rem;
  border:1px solid rgba(255,255,255,.1);
  border-radius:12px;
  background:rgba(255,255,255,.03);
  overflow:hidden;
}
.fv-res-head{
  display:flex; align-items:center; justify-content:space-between;
  gap:.75rem; padding:.7rem .9rem;
  border-bottom:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
}
.fv-res-summary{ font-size:.85rem; color:var(--muted,#9aa0aa); }
.fv-res-summary b{ color:#fff; }
.fv-res-c{ font-weight:700; }
.fv-res-clear{
  flex-shrink:0; cursor:pointer;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.16);
  color:#fff; font-size:.78rem; font-weight:700;
  padding:6px 12px; border-radius:8px;
}
.fv-res-clear:hover{ background:rgba(255,255,255,.12); }
.fv-res-list{ max-height:360px; overflow-y:auto; }
.fv-res-row{
  display:flex; align-items:center; gap:.6rem;
  padding:.5rem .9rem;
  border-bottom:1px solid rgba(255,255,255,.05);
  font-size:.85rem;
}
.fv-res-row:last-child{ border-bottom:none; }
.fv-res-ic{
  flex-shrink:0; width:20px; height:20px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:.8rem; color:#fff;
}
.fv-res-title{ color:#fff; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.fv-res-year{ color:var(--muted,#9aa0aa); font-weight:400; }
.fv-res-tag{ flex-shrink:0; color:var(--muted,#9aa0aa); font-size:.78rem; }
/* status colors */
.fv-res-added,  .fv-res-ic.fv-res-added  { color:#22c55e; }
.fv-res-merged, .fv-res-ic.fv-res-merged { color:#e8b84b; }
.fv-res-skip,   .fv-res-ic.fv-res-skip   { color:#9aa0aa; }
.fv-res-fail,   .fv-res-ic.fv-res-fail   { color:#ef4444; }
.fv-res-ic.fv-res-added  { background:rgba(34,197,94,.18); }
.fv-res-ic.fv-res-merged { background:rgba(232,184,75,.18); }
.fv-res-ic.fv-res-skip   { background:rgba(154,160,170,.18); }
.fv-res-ic.fv-res-fail   { background:rgba(239,68,68,.18); }

/* meta */
.fv-src-meta{ padding:.6rem .7rem .2rem; flex:1; }
.fv-src-title{
  font-family:'DM Sans',sans-serif;
  font-size:.88rem; font-weight:700; color:var(--text);
  line-height:1.3;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden;
}
.fv-src-sub{
  margin-top:.2rem;
  font-size:.74rem; color:var(--muted);
  text-transform:capitalize;
}

/* add button — full width, ≥44px tall, clear pressed + focus states */
.fv-src-add{
  margin:.6rem .7rem .7rem;
  min-height:42px;
  display:inline-flex; align-items:center; justify-content:center; gap:.4rem;
  background:linear-gradient(135deg,var(--accent,#e8b84b),#c8962b);
  color:#1a1205; font-weight:800; font-size:.82rem;
  font-family:'DM Sans',sans-serif;
  border:none; border-radius:9px;
  cursor:pointer;
  touch-action:manipulation;
  transition:filter .16s ease, transform .12s ease;
}
.fv-src-add:hover{ filter:brightness(1.07); }
.fv-src-add:active{ transform:scale(.97); }
.fv-src-add:focus-visible{ outline:3px solid rgba(232,184,75,.6); outline-offset:2px; }
.fv-src-add:disabled{ opacity:.5; cursor:default; filter:grayscale(.4); }
.fv-src-add.is-added{
  background:rgba(34,197,94,.16);
  border:1px solid rgba(34,197,94,.5);
  color:#22c55e;
  cursor:default;
}

/* per-card "Open" button — adds servers + removes Coming Soon + bumps to
   Recently Added. Sits directly under the gold Add/Merge button. */
.fv-src-open{
  margin:0 .7rem .7rem;
  min-height:40px;
  display:inline-flex; align-items:center; justify-content:center; gap:.4rem;
  background:linear-gradient(135deg,#22c55e,#15924a);
  color:#06210f; font-weight:800; font-size:.8rem;
  font-family:'DM Sans',sans-serif;
  border:none; border-radius:9px;
  cursor:pointer;
  touch-action:manipulation;
  transition:filter .16s ease, transform .12s ease;
}
.fv-src-open:hover{ filter:brightness(1.08); }
.fv-src-open:active{ transform:scale(.97); }
.fv-src-open:focus-visible{ outline:3px solid rgba(34,197,94,.6); outline-offset:2px; }
.fv-src-open:disabled{ opacity:.5; cursor:default; filter:grayscale(.4); }

#fv-src-openall-btn{ min-height:42px; font-weight:800; }

/* pager */
.fv-src-pager{
  display:flex; align-items:center; justify-content:center; gap:1rem;
  margin:1.4rem 0 .5rem;
}
.fv-src-page-btn{
  min-height:44px; min-width:88px;
  padding:0 1.1rem;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.12);
  color:var(--text);
  border-radius:9px;
  font-family:'DM Sans',sans-serif; font-size:.84rem; font-weight:600;
  cursor:pointer;
  touch-action:manipulation;
  transition:background .16s ease, border-color .16s ease;
}
.fv-src-page-btn:hover:not(:disabled){ background:rgba(232,184,75,.14); border-color:rgba(232,184,75,.45); }
.fv-src-page-btn:focus-visible{ outline:3px solid rgba(232,184,75,.6); outline-offset:2px; }
.fv-src-page-btn:disabled{ opacity:.4; cursor:default; }
.fv-src-page-info{ font-size:.82rem; color:var(--muted); font-weight:600; min-width:96px; text-align:center; }

/* empty / loading state */
.fv-src-empty{
  grid-column:1/-1;
  text-align:center;
  padding:3rem 1rem;
  color:var(--muted);
  font-size:.9rem;
  background:rgba(255,255,255,.02);
  border:1px dashed rgba(255,255,255,.1);
  border-radius:14px;
}

/* skeleton card lines */
.fv-src-card-skel{ pointer-events:none; }
.fv-skel-line{
  height:11px; border-radius:5px; margin:.5rem .1rem;
  background:linear-gradient(110deg,#15171f 8%,#1d2029 18%,#15171f 33%);
  background-size:200% 100%;
  animation:fvSrcShimmer 1.2s linear infinite;
}
.fv-skel-line.short{ width:55%; }

/* respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .fv-src-card,.fv-src-add,.fv-src-page-btn{ transition:none; }
  .fv-src-poster-img{ animation:none; }
  .fv-src-poster-skel,.fv-skel-line{ animation:none; background:#15171f; }
}

/* small screens — tighter grid */
@media (max-width:560px){
  .fv-src-grid{ grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); gap:.7rem; }
  .fv-src-title{ font-size:.82rem; }
}
