/**
 * WPHZ UGC Carousel — Frontend Styles
 * Phase 6: Core layout, animations, and typography
 * Pure CSS (No JS logic here, Phase 7 JS adds/removes modifier classes)
 */

.wphz-ugc-carousel {
  --wphz-bg: transparent;
  --wphz-text: #333;
  --wphz-primary: #007cba;

  font-family: inherit;
  color: var(--wphz-text);
  margin: 2rem 0;
  position: relative;
  box-sizing: border-box;
}

.wphz-ugc-carousel * {
  box-sizing: border-box;
}

/* ── Header Area ────────────────────────────── */
.wphz-ugc-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding: 0 10px;
}

.wphz-ugc-header__text h2.wphz-ugc-heading {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
  line-height: 1.2;
}

.wphz-ugc-header__text p.wphz-ugc-subheading {
  margin: 0;
  font-size: 1rem;
  color: #666;
}

/* ── Arrow Navigation (Header & Carousel) ─── */
.wphz-ugc-arrows {
  display: flex;
  gap: 8px;
}

.wphz-ugc-arrow,
.wphz-product-arrow {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #555;
  transition: all 0.2s ease;
  padding: 0;
}

.wphz-ugc-arrow:hover:not(:disabled),
.wphz-product-arrow:hover:not(:disabled) {
  background: #f0f0f0;
  color: #111;
  border-color: #bbb;
}

.wphz-ugc-arrow:disabled,
.wphz-product-arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Stage & Track (Desktop: ~5 slides visible) ── */
.wphz-ugc-stage {
  overflow: hidden;
  position: relative;
}

/* Flex layout with transition for sliding */
.wphz-ugc-track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.33, 1, 0.68, 1);
  will-change: transform;
}

/* Individual Slide Container — ~4.5 visible so edges peek */
.wphz-ugc-slide {
  flex: 0 0 calc(100% / 4.5);
  padding: 0 4px;
  min-width: 0;
}

/* ── Video Wrap & Element ───────────────────── */
.wphz-ugc-video-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.4s ease,
    box-shadow 0.4s ease;
  cursor: pointer;
  aspect-ratio: 3.25/4.5;
}

/* Scale up the center/active video */
.wphz-ugc-slide--active .wphz-ugc-video-wrap {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 2;
}

.wphz-ugc-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Mute Button ────────────────────────────── */
.wphz-ugc-mute-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s ease;
  padding: 0;
}

.wphz-ugc-mute-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

.wphz-icon-mute,
.wphz-icon-unmute {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.wphz-ugc-mute-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.wphz-ugc-mute-btn:focus {
  outline: none;
  box-shadow: none;
  background: rgba(0, 0, 0, 0.5);
}

.wphz-ugc-mute-btn:focus-visible {
  outline: none;
  box-shadow: none;
}
/* ── Product Strip (Under Video) ────────────── */
.wphz-ugc-products {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0 8px;
  overflow: hidden;
}

.wphz-ugc-products--carousel {
  position: relative;
  overflow: hidden;
}

.wphz-ugc-products-track {
  display: flex;
  gap: 12px;
  transition: transform 0.3s ease;
  will-change: transform;
  width: 100%;
}

/* Product internal sub-carousel arrows */
.wphz-ugc-products--carousel .wphz-product-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.wphz-ugc-products--carousel .wphz-product-arrow--prev {
  left: -8px;
}
.wphz-ugc-products--carousel .wphz-product-arrow--next {
  right: -8px;
}

/* ── Single Product Card ────────────────────── */
.wphz-ugc-product-item {
  flex: 0 0 100%; /* Match exactly the width of the video wrapper */
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid rgba(216, 216, 216);
  padding: 8px;
  border-radius: 8px;
}

.wphz-ugc-products--carousel .wphz-ugc-product-item {
  flex: 0 0 100%; /* If multiple, show 1 at a time in sub-carousel */
}

.wphz-ugc-product-img {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  background: #fafafa;
}

.wphz-ugc-product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wphz-ugc-product-info {
  flex: 1;
  min-width: 0;
}

.wphz-ugc-product-name {
  margin: 0 0 4px 0;
  font-size: 13px;
  line-height: 16px;
  font-weight: 600;
  min-height: 32px;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wphz-ugc-product-price {
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
  line-height: 1;
}

.wphz-ugc-product-price del {
  opacity: 0.6;
  margin-right: 4px;
  font-size: 11px;
}

.wphz-ugc-atc-btn {
  display: inline-block;
  background: var(--wphz-primary);
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  line-height: 1.5;
}

.wphz-ugc-atc-btn:hover {
  opacity: 0.85;
}

.wphz-ugc-atc-btn.loading {
  opacity: 0.6;
  pointer-events: none;
  cursor: wait;
}

/* ── Tablet Responsive ──────────────────────── */
@media (max-width: 1024px) {
  .wphz-ugc-slide {
    flex: 0 0 calc(100% / 3.3);
  }
}

/* ── Mobile Responsive ──────────────────────── */
@media (max-width: 768px) {
  .wphz-ugc-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .wphz-ugc-arrows {
    align-self: flex-end;
  }

  /* Show ~1.3 slides to hint there's more */
  .wphz-ugc-slide {
    flex: 0 0 75%;
  }

  .wphz-ugc-video-wrap {
    aspect-ratio: 3/5;
  }
}
