/**
 * featured-products.css — Netflix-style horizontal product carousel
 */

/* =============================================
   SECTION
============================================= */

.featured {
  background-color: var(--color-bg-secondary);
  overflow: visible;
}

/* =============================================
   HEADER ROW
============================================= */

.featured__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  gap: var(--space-6);
}

.featured__header-text .section__title {
  margin-bottom: var(--space-2);
}

.featured__header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  padding-bottom: var(--space-2);
}

.featured__ctrl-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg-card);
  border: 1.5px solid var(--color-border-light);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-base);
  flex-shrink: 0;
}

.featured__ctrl-btn svg {
  width: 18px;
  height: 18px;
}

.featured__ctrl-btn:hover {
  background-color: var(--color-primary-700);
  border-color: var(--color-primary-700);
  color: #fff;
  transform: scale(1.05);
  box-shadow: var(--shadow-primary);
}

.featured__ctrl-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* =============================================
   SCROLL VIEWPORT
============================================= */

.featured__viewport {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  /* Hide scrollbar visually — JS scroll-thumb replaces it */
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE/Edge */
  /* side padding so first/last card align with container */
  padding-inline: max(var(--space-6), calc((100vw - var(--container-xl)) / 2 + var(--space-6)));
  padding-bottom: var(--space-4); /* room for card hover shadow */
  margin-inline: 0;
  cursor: grab;
}

/* Hide webkit scrollbar */
.featured__viewport::-webkit-scrollbar {
  display: none;
}

.featured__viewport:active {
  cursor: grabbing;
}

.featured__track {
  display: flex;
  gap: var(--space-5);
  width: max-content;
  user-select: none;
  -webkit-user-select: none;
}

/* =============================================
   PRODUCT CARD
============================================= */

.product-card {
  width: 260px;
  flex-shrink: 0;
  background-color: var(--color-bg-card);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
  transition: var(--transition-base);
  position: relative;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
  border-color: transparent;
}

/* ─── Image area ──── */

.product-card__image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: var(--color-bg-tertiary);
  overflow: hidden;
  flex-shrink: 0;
}

.product-card__image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card__image-placeholder svg {
  width: 100%;
  height: 100%;
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: var(--space-4);
  transition: transform 0.4s var(--ease-out);
}

.product-card:hover .product-card__image,
.product-card:hover .product-card__image-placeholder {
  transform: scale(1.05);
}

/* Badge */
.product-card__badge {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  padding: var(--space-1) var(--space-2);
  font-size: 10px;
  font-weight: var(--font-bold);
  border-radius: var(--radius-md);
  letter-spacing: 0.03em;
  z-index: 1;
}

.product-card__badge--primary {
  background-color: var(--color-primary-700);
  color: #fff;
}

.product-card__badge--accent {
  background-color: var(--color-accent-500);
  color: #fff;
}

.product-card__badge--success {
  background-color: var(--color-success-500);
  color: #fff;
}

/* Wishlist button */
.product-card__wishlist {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.9);
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: var(--transition-fast);
  opacity: 0;
  transform: scale(0.8);
  z-index: 1;
}

.product-card__wishlist svg {
  width: 16px;
  height: 16px;
}

.product-card:hover .product-card__wishlist {
  opacity: 1;
  transform: scale(1);
}

.product-card__wishlist:hover {
  color: #ef4444;
  background-color: #fff;
}

/* ─── Body ──── */

.product-card__body {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.product-card__brand {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.product-card__name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
  line-height: var(--leading-snug);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Rating */
.product-card__rating {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.product-card__stars {
  display: flex;
  gap: 1px;
}

.product-card__star {
  width: 12px;
  height: 12px;
  fill: var(--color-warning-500);
}

.product-card__star--empty {
  fill: var(--gray-300);
}

.product-card__review-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Price */
.product-card__price {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: auto;
}

.product-card__price-sale {
  font-size: var(--text-xl);
  font-weight: var(--font-extrabold);
  color: var(--color-text-primary);
}

.product-card__price-original {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: line-through;
}

.product-card__price-discount {
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  color: var(--color-success-600);
  background-color: #dcfce7;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
}

/* ─── Footer / CTA ──── */

.product-card__footer {
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid var(--color-border-light);
}

.product-card__cta {
  width: 100%;
  justify-content: center;
  font-size: var(--text-sm);
  padding-block: var(--space-3);
}

/* =============================================
   SCROLL PROGRESS BAR
============================================= */

.featured__scroll-bar {
  height: 3px;
  background-color: var(--color-border-light);
  border-radius: var(--radius-full);
  margin-top: var(--space-8);
  overflow: hidden;
}

.featured__scroll-thumb {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary-700), var(--color-accent-500));
  border-radius: var(--radius-full);
  width: 20%;
  transition: width 0.2s ease;
}

/* =============================================
   SKELETON LOADING UI
============================================= */

.product-card--skeleton {
  pointer-events: none;
  user-select: none;
  cursor: default;
}

.product-card--skeleton:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--color-border-light);
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 0%,
    var(--color-border-light) 50%,
    var(--color-bg-tertiary) 100%
  );
  background-size: 200% 100%;
  animation: featuredShimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes featuredShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-shimmer--image {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.skeleton-shimmer--brand {
  width: 32%;
  height: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
}

.skeleton-shimmer--title {
  width: 92%;
  height: 16px;
  border-radius: var(--radius-sm);
}

.skeleton-shimmer--title-short {
  width: 62%;
  height: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-1);
}

.skeleton-shimmer--rating {
  width: 48%;
  height: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

.skeleton-shimmer--price {
  width: 55%;
  height: 24px;
  border-radius: var(--radius-md);
  margin-top: auto;
}

.skeleton-shimmer--btn {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-lg);
}

/* =============================================
   EMPTY & ERROR STATUS STATES
============================================= */

.featured__track--status {
  width: 100%;
  justify-content: center;
}

.featured__status {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-10) var(--space-6);
  background-color: var(--color-bg-card);
  border: 1px dashed var(--color-border-medium);
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 560px;
  margin: var(--space-4) auto;
  gap: var(--space-4);
}

.featured__status-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-muted);
}

.featured__status--error .featured__status-icon {
  background-color: #fee2e2;
  color: var(--color-error-600);
}

.featured__status-icon svg {
  width: 28px;
  height: 28px;
}

.featured__status-title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.featured__status-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  max-width: 420px;
  margin: 0 auto;
  line-height: var(--leading-relaxed);
}

.featured__retry-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
  cursor: pointer;
  background-color: var(--color-primary-700);
  color: #fff;
  border: 1px solid var(--color-primary-700);
  transition: var(--transition-base);
  margin-top: var(--space-2);
}

.featured__retry-btn:hover:not(:disabled) {
  background-color: var(--color-primary-800);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.featured__retry-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.featured__retry-btn svg {
  width: 16px;
  height: 16px;
}

.featured__retry-btn.loading svg {
  animation: featuredSpin 1s linear infinite;
}

@keyframes featuredSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* =============================================
   RESPONSIVE
============================================= */

@media (max-width: 768px) {
  .featured {
    overflow-x: clip;
    max-width: 100%;
  }

  .featured__header {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: var(--space-6);
    min-width: 0;
  }

  .featured__viewport {
    padding-inline: var(--space-4);
    max-width: 100%;
    min-width: 0;
  }

  .product-card {
    width: 220px;
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .featured__viewport {
    padding-inline: var(--space-3);
  }

  .product-card {
    width: 196px;
  }
}
