/* BLUVIA User Library — Favorites, My List and Watch History */
#fav-container, .home-content { min-width:0; }
.fav-count, #mylist-count {
  display:inline-flex;
  align-items:center;
  min-height:30px;
  padding:5px 11px;
  border:1px solid rgba(59,130,246,.2);
  border-radius:999px;
  background:rgba(59,130,246,.09);
  color:var(--text-secondary);
  font-size:.8rem;
  font-weight:650;
}
.fav-grid, #mylist-grid {
  display:grid !important;
  grid-template-columns:repeat(auto-fill,minmax(145px,1fr));
  gap:clamp(12px,1.7vw,20px);
}
.library-card {
  position:relative;
  min-width:0;
  overflow:hidden;
  border:1px solid var(--border);
  border-radius:16px;
  background:var(--bg-card,var(--surface));
  transition:transform .2s ease,border-color .2s ease,box-shadow .2s ease;
}
.library-card:hover {
  transform:translateY(-3px);
  border-color:rgba(59,130,246,.5);
  box-shadow:0 14px 32px rgba(0,0,0,.2);
}
.library-card-link { display:block; color:inherit; text-decoration:none; min-width:0; }
.library-poster {
  display:block;
  width:100%;
  aspect-ratio:2/3;
  object-fit:cover;
  background:linear-gradient(135deg,#182235,#0b1220);
}
.library-poster.is-missing { object-fit:contain; }
.library-card-info { padding:11px 12px 13px; }
.library-card-title {
  margin:0;
  color:var(--text-primary);
  font-size:.9rem;
  font-weight:700;
  line-height:1.4;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.library-card-meta, .history-time {
  margin-top:5px;
  color:var(--text-muted);
  font-size:.75rem;
}
.library-remove {
  position:absolute;
  top:9px;
  right:9px;
  z-index:2;
  min-height:32px;
  padding:0 10px;
  border:1px solid rgba(255,255,255,.18);
  border-radius:999px;
  background:rgba(5,10,20,.78);
  color:#fff;
  font:inherit;
  font-size:.72rem;
  font-weight:700;
  cursor:pointer;
  backdrop-filter:blur(8px);
}
.library-remove:hover { background:#b91c1c; border-color:#ef4444; }
.library-empty {
  grid-column:1/-1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  min-height:270px;
  padding:32px 20px;
  text-align:center;
  border:1px dashed var(--border);
  border-radius:18px;
  background:rgba(17,27,45,.28);
}
.library-empty-icon {
  display:grid;
  place-items:center;
  width:58px;
  height:58px;
  margin-bottom:14px;
  border-radius:18px;
  background:rgba(59,130,246,.12);
  color:#93c5fd;
  font-size:2rem;
}
.library-empty h3 { margin:0 0 7px; color:var(--text-primary); font-size:1.08rem; }
.library-empty p { max-width:420px; margin:0; color:var(--text-muted); line-height:1.6; }
.library-primary-action {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:42px;
  margin-top:18px;
  padding:0 18px;
  border-radius:999px;
  background:linear-gradient(135deg,#3b82f6,#2563eb);
  color:#fff;
  text-decoration:none;
  font-weight:700;
}
#history-list {
  grid-template-columns:repeat(auto-fill,minmax(min(100%,330px),1fr));
  align-items:stretch;
}
.history-card {
  position:relative;
  display:flex;
  min-width:0;
  padding:12px;
  gap:13px;
  border:1px solid var(--border);
  border-radius:16px;
  background:var(--bg-card,var(--surface));
  transition:border-color .2s ease,transform .2s ease;
}
.history-card:hover { transform:translateY(-2px); border-color:rgba(59,130,246,.45); }
.history-card-link {
  display:flex;
  flex:1;
  min-width:0;
  gap:13px;
  color:inherit;
  text-decoration:none;
}
.history-card .library-poster {
  flex:0 0 88px;
  width:88px;
  height:124px;
  border-radius:10px;
}
.history-card-body {
  display:flex;
  flex:1;
  min-width:0;
  flex-direction:column;
  justify-content:space-between;
  padding:3px 0;
}
.history-episode { margin-top:5px; color:var(--accent); font-size:.82rem; font-weight:650; }
.history-progress { display:flex; align-items:center; gap:9px; margin-top:14px; color:var(--text-muted); font-size:.72rem; }
.history-progress-track { flex:1; height:5px; overflow:hidden; border-radius:99px; background:var(--border); }
.history-progress-fill { height:100%; border-radius:inherit; background:linear-gradient(90deg,#3b82f6,#60a5fa); }
.history-remove { top:auto; right:10px; bottom:10px; min-height:27px; }
.library-clear-button {
  border:0;
  padding:7px 12px;
  border-radius:9px;
  background:rgba(239,68,68,.1);
  color:#f87171;
  font:inherit;
  font-size:.82rem;
  cursor:pointer;
}
.library-clear-button:hover { background:rgba(239,68,68,.18); }
@media (max-width:700px) {
  .fav-grid, #mylist-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; }
  #history-list { grid-template-columns:1fr; gap:11px; }
  .history-card { padding:10px; gap:10px; }
  .history-card-link { gap:10px; padding-bottom:22px; }
  .history-card .library-poster { flex-basis:76px; width:76px; height:108px; }
  .library-card-info { padding:9px 10px 11px; }
}
@media (prefers-reduced-motion:reduce) {
  .library-card,.history-card { transition:none !important; }
}

/* v7 cloud sync feedback */
.library-sync-status {
  max-width:960px;
  margin:8px auto 14px;
  padding:8px 14px;
  border:1px solid rgba(59,130,246,.22);
  border-radius:10px;
  background:rgba(59,130,246,.07);
  color:var(--text-muted);
  font-size:.78rem;
}
.library-sync-status.is-error {
  border-color:rgba(245,158,11,.28);
  background:rgba(245,158,11,.07);
  color:var(--text-secondary,var(--text-muted));
}
.library-sync-status[hidden] { display:none; }
