/* Premium Anime Cards - Glass overlays and scale zoom */
.hd-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--hd-spacing-md);
  margin-bottom: var(--hd-spacing-lg);
}

.hd-cards-grid.scrollable {
  display: flex;
  overflow-x: auto;
  gap: var(--hd-spacing-md);
  padding-bottom: var(--hd-spacing-sm);
  scroll-snap-type: x mandatory;
}

.hd-cards-grid.scrollable .hd-card {
  flex-shrink: 0;
  width: 190px;
  scroll-snap-align: start;
}

.hd-cards-grid.grid-6 {
  grid-template-columns: repeat(6, 1fr);
}

.hd-cards-grid.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1200px) {
  .hd-cards-grid.grid-6 {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 768px) {
  .hd-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hd-cards-grid.grid-6,
  .hd-cards-grid.grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Card Design */
.hd-card {
  position: relative;
  border-radius: var(--hd-radius-md);
  background-color: var(--hd-surface);
  border: 1px solid var(--hd-border-glass);
  overflow: hidden;
  transition: var(--hd-transition-all);
}

.hd-card:hover {
  transform: translateY(-6px);
  border-color: var(--hd-border-glass-active);
  box-shadow: var(--hd-shadow-lg);
}

.hd-card-image-wrapper {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background-color: var(--hd-bg);
}

.hd-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--hd-duration-slow) var(--hd-ease-out);
}

.hd-card:hover .hd-card-img {
  transform: scale(1.08);
}

.hd-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 9, 12, 0.9) 0%, rgba(8, 9, 12, 0) 60%);
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--hd-transition-fade);
}

.hd-card:hover .hd-card-overlay {
  opacity: 1;
}

.hd-play-icon {
  width: 48px;
  height: 48px;
  background-color: var(--hd-primary);
  color: var(--hd-text-main);
  border-radius: var(--hd-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--hd-shadow-md), var(--hd-glow-primary);
  transform: scale(0.8);
  transition: transform var(--hd-duration-normal) var(--hd-ease-elastic);
}

.hd-card:hover .hd-play-icon {
  transform: scale(1);
}

.hd-card-badge {
  position: absolute;
  z-index: 2;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--hd-radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1.3;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
  white-space: nowrap;
}

.hd-card-badge svg {
  flex-shrink: 0;
}

/* ───── QUALITY BADGES ─ Top Left ───── */
.hd-badge-quality {
  top: var(--hd-spacing-xs);
  left: var(--hd-spacing-xs);
  font-size: 9px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.hd-badge-quality.q-4k {
  background: linear-gradient(135deg, #f5af19, #f12711, #f5af19);
  background-size: 200% 200%;
  animation: hd-shimmer-gold 3s ease infinite;
  color: #fff;
  border-color: rgba(245, 175, 25, 0.4);
  box-shadow: 0 0 8px rgba(245, 175, 25, 0.35);
}

@keyframes hd-shimmer-gold {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hd-badge-quality.q-fhd {
  background: linear-gradient(135deg, #0cebeb, #20e3b2);
  color: #0a1628;
  border-color: rgba(12, 235, 235, 0.3);
  box-shadow: 0 0 6px rgba(12, 235, 235, 0.25);
}

.hd-badge-quality.q-hd {
  background: linear-gradient(135deg, #8e9eab, #eef2f3);
  color: #1a1a2e;
  border-color: rgba(142, 158, 171, 0.3);
  box-shadow: 0 0 5px rgba(142, 158, 171, 0.2);
}

/* ───── TYPE BADGES ─ Top Right ───── */
.hd-badge-type {
  top: var(--hd-spacing-xs);
  right: var(--hd-spacing-xs);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.hd-badge-type.t-tv {
  background: rgba(124, 77, 255, 0.85);
  color: #f0eaff;
  border-color: rgba(124, 77, 255, 0.3);
}

.hd-badge-type.t-movie {
  background: rgba(255, 167, 38, 0.88);
  color: #3e1f00;
  border-color: rgba(255, 167, 38, 0.35);
}

.hd-badge-type.t-ona {
  /* Compact icon-heavy micro badge */
  background: rgba(0, 200, 150, 0.85);
  color: #fff;
  border-color: rgba(0, 200, 150, 0.3);
  padding: 2px 5px;
  font-size: 8px;
  letter-spacing: 0.5px;
}

.hd-badge-type.t-donghua {
  background: rgba(230, 57, 70, 0.88);
  color: #fff;
  border-color: rgba(230, 57, 70, 0.3);
}

.hd-badge-type.t-anime {
  background: rgba(33, 150, 243, 0.88);
  color: #e3f2fd;
  border-color: rgba(33, 150, 243, 0.3);
}

.hd-badge-type.t-special {
  background: rgba(233, 30, 99, 0.85);
  color: #fce4ec;
  border-color: rgba(233, 30, 99, 0.3);
}

/* ───── STATUS BADGES ─ Bottom Left ───── */
.hd-badge-status {
  bottom: var(--hd-spacing-xs);
  left: var(--hd-spacing-xs);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}

.hd-badge-status.s-completed {
  background: rgba(46, 125, 50, 0.88);
  color: #c8e6c9;
  border-color: rgba(46, 125, 50, 0.35);
}

.hd-badge-status.s-ongoing,
.hd-badge-status.s-airing {
  background: rgba(211, 47, 47, 0.88);
  color: #ffcdd2;
  border-color: rgba(211, 47, 47, 0.35);
}

/* Pulse dot for ongoing */
.hd-badge-status.s-ongoing .hd-badge-dot,
.hd-badge-status.s-airing .hd-badge-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff5252;
  box-shadow: 0 0 4px #ff5252;
  animation: hd-pulse-dot 1.5s ease-in-out infinite;
}

@keyframes hd-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.hd-badge-status.s-drop {
  background: rgba(97, 97, 97, 0.85);
  color: #e0e0e0;
  border-color: rgba(97, 97, 97, 0.3);
}

/* ───── EPISODE BADGE ─ Bottom Right ───── */
.hd-badge-ep {
  bottom: var(--hd-spacing-xs);
  right: var(--hd-spacing-xs);
  background-color: var(--hd-primary);
  color: var(--hd-text-main);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  border-color: rgba(255, 255, 255, 0.1);
}

/* ───── RATING BADGE ─ (legacy compat) ───── */
.hd-card-badge.rating {
  top: var(--hd-spacing-xs);
  left: var(--hd-spacing-xs);
  background-color: rgba(8, 9, 12, 0.85);
  backdrop-filter: blur(4px);
  border: 1px solid var(--hd-border-glass);
  color: var(--hd-accent);
}

/* Legacy ep-count compat */
.hd-card-badge.ep-count,
.hd-card-badge.ep-num {
  bottom: var(--hd-spacing-xs);
  right: var(--hd-spacing-xs);
  background-color: var(--hd-primary);
  color: var(--hd-text-main);
}

/* ───── RESPONSIVE: Stack badges tighter on mobile ───── */
@media (max-width: 480px) {
  .hd-card-badge,
  .hd-badge-quality,
  .hd-badge-type,
  .hd-badge-status,
  .hd-badge-ep {
    font-size: 8px;
    padding: 1px 4px;
    gap: 2px;
  }
  .hd-badge-type.t-ona {
    font-size: 7px;
    padding: 1px 3px;
  }
}

/* Card Info */
.hd-card-info {
  padding: var(--hd-spacing-sm);
}

.hd-card-title {
  font-size: var(--hd-text-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: var(--hd-spacing-xxs);
}

.hd-card-ep-title {
  font-size: var(--hd-text-xs);
  color: var(--hd-text-muted);
}

.hd-card-genres {
  font-size: 11px;
  color: var(--hd-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* Compact card layout */
.hd-card-anime-card-compact {
  display: flex;
}

.hd-compact-link {
  display: flex;
  gap: var(--hd-spacing-sm);
  width: 100%;
}

.hd-compact-img {
  width: 50px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--hd-radius-sm);
  flex-shrink: 0;
}

.hd-compact-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hd-compact-title {
  font-size: var(--hd-text-sm);
  font-weight: 600;
  margin-bottom: var(--hd-spacing-xxs);
}

.hd-compact-meta {
  font-size: var(--hd-text-xs);
  color: var(--hd-text-muted);
  display: flex;
  align-items: center;
}

/* ==========================================================================
   ─── Continue Watching Progress Bar ───
   ========================================================================== */

/* Progress bar at bottom of continue-watching card poster */
.hd-continue-card-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--hd-primary), var(--hd-accent));
  border-radius: 0 0 var(--hd-radius-md) var(--hd-radius-md);
  z-index: 2;
  transition: width 0.3s ease;
  pointer-events: none;
}

/* Remove button — hidden by default, revealed on card hover */
.hd-continue-card .hd-card-remove-btn {
  position: absolute;
  top: var(--hd-spacing-xs);
  right: var(--hd-spacing-xs);
  z-index: 3;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--hd-radius-full);
  background: var(--hd-surface-glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--hd-border-glass);
  color: var(--hd-text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.8);
  transition: var(--hd-transition-all);
  line-height: 1;
}

.hd-continue-card:hover .hd-card-remove-btn {
  opacity: 1;
  transform: scale(1);
}

.hd-continue-card .hd-card-remove-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--hd-primary);
}

/* ───── MINI PLAY ICON BADGE ───── */
.hd-play-mini {
  width: 36px;
  height: 36px;
  background-color: var(--hd-primary);
  color: #fff;
  border-radius: var(--hd-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--hd-shadow-md), var(--hd-glow-primary);
  transform: scale(0.8);
  transition: transform var(--hd-duration-normal) var(--hd-ease-elastic);
}

/* Hover scales mini play icon */
.hd-card:hover .hd-play-mini,
.hd-history-card:hover .hd-play-mini {
  transform: scale(1);
}
