/* ==========================================================================
   Watch History Page — Premium Glassmorphic Styles
   ========================================================================== */

/* Page Container */
.hd-watch-history-page {
  margin-top: var(--hd-spacing-xl);
  min-height: 50vh;
}

/* ─── History Header ─── */
.hd-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--hd-spacing-lg);
  flex-wrap: wrap;
  gap: var(--hd-spacing-md);
}

.hd-history-header .hd-section-title {
  margin: 0;
}

.hd-history-desc {
  color: var(--hd-text-muted);
  margin-top: var(--hd-spacing-xxs);
  font-size: var(--hd-text-xs);
}

/* Clear All Button — secondary glassmorphic */
.hd-clear-all-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--hd-spacing-xs) var(--hd-spacing-md);
  font-family: var(--hd-font-display);
  font-size: var(--hd-text-xs);
  font-weight: 700;
  color: var(--hd-text-muted);
  background: var(--hd-surface-glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--hd-border-glass);
  border-radius: var(--hd-radius-md);
  cursor: pointer;
  transition: var(--hd-transition-all);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hd-clear-all-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--hd-primary);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.1);
}

.hd-clear-all-btn svg {
  flex-shrink: 0;
}

/* ─── History Grid ─── */
.hd-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--hd-spacing-md);
  margin-top: var(--hd-spacing-lg);
}

/* ─── Skeleton Loader ─── */
.hd-history-skeleton-loader {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--hd-spacing-md);
  width: 100%;
}

.hd-history-skeleton-item {
  height: 280px;
  border-radius: var(--hd-radius-md);
}

/* ─── History Card — Premium Glassmorphic ─── */
.hd-history-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--hd-radius-md);
  background: var(--hd-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--hd-border-glass);
  overflow: hidden;
  transition: var(--hd-transition-all);
}

.hd-history-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--hd-border-glass-active);
  box-shadow:
    var(--hd-shadow-lg),
    0 0 20px var(--hd-primary-glow);
}

/* Poster Image Area */
.hd-history-card-image {
  display: block;
  width: 100%;
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background-color: var(--hd-bg);
}

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

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

/* Gradient Overlay at bottom of poster */
.hd-history-card-image::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%;
  background: linear-gradient(to top, rgba(8, 9, 12, 0.85) 0%, rgba(8, 9, 12, 0) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Progress Bar — at bottom of poster */
.hd-history-progress-bar {
  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.4s var(--hd-ease-out);
}

/* Delete Button — × icon, top-right, hover only */
.hd-history-delete-btn {
  position: absolute;
  top: var(--hd-spacing-xs);
  right: var(--hd-spacing-xs);
  z-index: 3;
  width: 28px;
  height: 28px;
  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: 14px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.8);
  transition: var(--hd-transition-all);
  line-height: 1;
}

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

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

/* Card Info Section */
.hd-history-card-info {
  padding: var(--hd-spacing-sm);
  display: flex;
  flex-direction: column;
  gap: var(--hd-spacing-xxs);
  flex-grow: 1;
}

.hd-history-card-title {
  font-size: var(--hd-text-sm);
  font-weight: 600;
  color: var(--hd-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.hd-history-card-subtitle {
  font-size: var(--hd-text-xs);
  color: var(--hd-text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hd-history-card-time {
  font-size: 11px;
  color: var(--hd-text-dim);
  font-weight: 500;
}

/* Resume Button */
.hd-history-resume-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: var(--hd-spacing-xxs);
  padding: 4px 10px;
  font-family: var(--hd-font-display);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background-color: var(--hd-primary);
  border: none;
  border-radius: var(--hd-radius-xs);
  cursor: pointer;
  transition: var(--hd-transition-all);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.hd-history-resume-btn:hover {
  background-color: var(--hd-primary-hover);
  box-shadow: var(--hd-glow-primary);
  transform: translateY(-1px);
}

.hd-history-resume-btn svg {
  flex-shrink: 0;
}

/* ─── Empty State ─── */
.hd-history-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--hd-spacing-3xl) var(--hd-spacing-lg);
  text-align: center;
  gap: var(--hd-spacing-md);
}

.hd-history-empty-icon {
  width: 64px;
  height: 64px;
  color: var(--hd-text-dim);
  opacity: 0.5;
}

.hd-history-empty-title {
  font-family: var(--hd-font-display);
  font-size: var(--hd-text-lg);
  font-weight: 700;
  color: var(--hd-text-muted);
  margin: 0;
}

.hd-history-empty-text {
  font-size: var(--hd-text-sm);
  color: var(--hd-text-dim);
  max-width: 360px;
  line-height: var(--hd-leading-normal);
  margin: 0;
}

/* ==========================================================================
   🚨 RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Tablet — 2 columns */
@media (max-width: 768px) {
  .hd-history-grid,
  .hd-history-skeleton-loader {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--hd-spacing-sm) !important;
  }

  .hd-history-skeleton-item {
    height: 220px !important;
  }

  .hd-history-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--hd-spacing-sm);
  }

  /* Keep delete button visible on touch screens */
  .hd-history-delete-btn {
    opacity: 1;
    transform: scale(1);
  }
}

/* Mobile — 1 column for very small screens */
@media (max-width: 480px) {
  .hd-history-grid,
  .hd-history-skeleton-loader {
    grid-template-columns: 1fr !important;
  }

  .hd-history-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
  }

  .hd-history-card-image {
    aspect-ratio: auto;
    width: 100px;
    min-height: 140px;
    flex-shrink: 0;
  }

  .hd-history-card-info {
    flex: 1;
    min-width: 0;
    justify-content: center;
    padding: var(--hd-spacing-sm) var(--hd-spacing-md);
  }

  /* Move progress bar to bottom of entire card in horizontal mode */
  .hd-history-progress-bar {
    bottom: 0;
    left: 0;
    border-radius: 0 0 var(--hd-radius-md) 0;
  }
}

/* Card Overlay Hover State */
.hd-history-card .hd-card-overlay {
  transition: var(--hd-transition-fade);
}

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