/* ── Container: base styles ── */
.wc-reels {
  position: relative;
  background: #0b0b0c;
  color: #fff;
  overflow: hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

/* ── Fullscreen mode: takeover ── */
.wc-reels--fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  width: 100%;
  z-index: 999999;
}

/* ── Card mode: inline widget ── */
.wc-reels--card {
  position: relative;
  width: 100%;
  border-radius: 16px;
  /* height is set via inline style from PHP */
}

/* ── Header: always visible, pinned at top ── */
.wc-reels__top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding: 12px 12px 10px;
  background: linear-gradient(to bottom, rgba(0,0,0,.8) 0%, rgba(0,0,0,.5) 60%, rgba(0,0,0,0) 100%);
  pointer-events: auto;
}

.wc-reels--card .wc-reels__top {
  border-radius: 16px 16px 0 0;
}

.wc-reels__brand {
  font-weight: 700;
  letter-spacing: .2px;
  margin-bottom: 8px;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
  text-align: center;
  flex: 1;
}

/* ── Top row: brand + action icons ── */
.wc-reels__top-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wc-reels__top-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  z-index: 36;
  pointer-events: auto;
}

.wc-reels__icon-btn {
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background .15s ease, transform .15s ease;
  padding: 0;
  flex-shrink: 0;
  pointer-events: auto;
  position: relative;
  z-index: 36;
}

.wc-reels__icon-btn:active {
  transform: scale(.9);
  background: rgba(255,255,255,.15);
}

.wc-reels__icon-btn svg {
  display: block;
}

.wc-reels__cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.wc-reels__cats::-webkit-scrollbar { display: none; }

.wc-reels__cat {
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.4);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.wc-reels__cat.is-active {
  border-color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.18);
}

/* Group buttons styling - same as regular category buttons */
.wc-reels__cats--groups .wc-reels__cat--group {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Swiper: fill container ── */
.wc-reels__swiper {
  height: 100%;
  width: 100%;
}

.wc-reels__swiper .swiper-wrapper {
  height: 100%;
}

/* ── Slide ── */
.wc-reels__slide {
  position: relative;
  height: 100% !important;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.wc-reels__swiper .swiper-slide {
  height: 100% !important;
  min-height: 100%;
}

/* ── Product image background ── */
.wc-reels__media {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: saturate(1.05) contrast(1.05);
}

.wc-reels--card .wc-reels__media {
  border-radius: 16px;
}

/* Dark gradient overlay for text readability on ANY image */
.wc-reels__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top,  rgba(0,0,0,.92) 0%, rgba(0,0,0,.65) 30%, rgba(0,0,0,.15) 55%, rgba(0,0,0,0) 65%),
    linear-gradient(to bottom, rgba(0,0,0,.7) 0%, rgba(0,0,0,0) 25%);
}

.wc-reels--card .wc-reels__media::after {
  border-radius: 16px;
}

/* ── Content overlay (title, price, buttons) ── */
.wc-reels__content {
  position: relative;
  z-index: 5;
  width: min(680px, 100%);
  padding: 18px 16px 0;
  padding-bottom: var(--wcr-content-bottom-padding, 30px);
  margin-top: auto;
  text-shadow: 0 1px 4px rgba(0,0,0,.9), 0 0 12px rgba(0,0,0,.6), 0 2px 16px rgba(0,0,0,.5);
  color: #fff;
}

.wc-reels__title {
  font-size: 18px;
  font-weight: 650;
  margin: 0 0 6px;
  line-height: 1.3;
  color: #fff;
}

.wc-reels__price {
  font-size: 16px;
  opacity: .95;
  margin: 0 0 14px;
  color: #fff;
}

.wc-reels__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.wc-reels__btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 650;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  text-align: center;
  text-shadow: none;
}

.wc-reels__btn.buy {
  background: #ffffff;
  color: #000;
  flex: 1;
}

.wc-reels__btn.view {
  background: rgba(255,255,255,.15);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ── Bottom bar: always visible, pinned ── */
.wc-reels__bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
  background: linear-gradient(to top, rgba(0,0,0,.7) 0%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}

.wc-reels--card .wc-reels__bottom {
  border-radius: 0 0 16px 16px;
  padding-bottom: 10px;
}

.wc-reels__hint {
  text-align: center;
  font-size: 12px;
  opacity: .6;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

/* ── Toast ── */
.wc-reels__toast {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.75);
  border: 1px solid rgba(255,255,255,.2);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  opacity: 0;
  transition: opacity .2s ease;
  z-index: 40;
  text-shadow: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}
.wc-reels__toast.is-on { opacity: 1; }

/* ── Tap zones (invisible hit areas for tap navigation) ── */
.wc-reels__tap-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  z-index: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.wc-reels__tap-zone--prev { left: 0; }
.wc-reels__tap-zone--next { right: 0; }

/* Tap flash feedback */
.wc-reels__tap-zone.is-tapped {
  background: rgba(255,255,255,.06);
  transition: background .1s;
}

/* ── Horizontal mode overrides ── */
.wc-reels--horizontal .wc-reels__slide {
  width: 100%;
  height: 100%;
}

/* ── Safe area for notched phones (fullscreen only) ── */
@supports (padding-top: env(safe-area-inset-top)) {
  .wc-reels--fullscreen .wc-reels__top {
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .wc-reels--fullscreen .wc-reels__bottom {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}

/* ── Story-style progress bar ── */
.wc-reels__progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 35;
  display: flex;
  gap: 3px;
  padding: 6px 8px 0;
  pointer-events: none;
}

.wc-reels__progress-seg {
  flex: 1;
  height: 2.5px;
  border-radius: 2px;
  background: rgba(255,255,255,.3);
  overflow: hidden;
  position: relative;
}

.wc-reels__progress-seg__fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 2px;
  transition: width .3s linear;
}

.wc-reels__progress-seg.is-seen .wc-reels__progress-seg__fill {
  width: 100%;
}

.wc-reels__progress-seg.is-active .wc-reels__progress-seg__fill {
  width: 0%;
  animation: wcr-progress-fill var(--wcr-advance-duration, 5s) linear forwards;
}

/* If auto-advance is off, just fill immediately */
.wc-reels__progress-seg.is-active.no-auto .wc-reels__progress-seg__fill {
  width: 100%;
  animation: none;
  transition: width .3s ease;
}

@keyframes wcr-progress-fill {
  from { width: 0%; }
  to   { width: 100%; }
}

/* ── Loading indicator ── */
.wc-reels__loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  opacity: .7;
  font-size: 14px;
  pointer-events: none;
}

/* ── Full-screen loading spinner overlay ── */
.wc-reels__loader {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(11, 11, 12, .95);
  align-items: center;
  justify-content: center;
}

.wc-reels__loader.is-on {
  display: flex;
}

.wc-reels__loader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: wcr-spin .7s linear infinite;
}

@keyframes wcr-spin {
  to { transform: rotate(360deg); }
}

/* ── NEW badge for fresh products ── */
.wc-reels__new-badge {
  display: inline-block;
  background: #ff3b5c;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 6px;
  margin-bottom: 8px;
  text-transform: uppercase;
  text-shadow: none;
}

/* ── Product view: card mode (image as card, not stretched) ── */
.wc-reels__slide--card-view .wc-reels__media {
  inset: 16px;
  border-radius: 20px;
  background-size: contain;
  background-repeat: no-repeat;
}

.wc-reels__slide--card-view .wc-reels__media::after {
  border-radius: 20px;
  background:
    linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.45) 25%, rgba(0,0,0,.05) 50%, rgba(0,0,0,0) 60%),
    linear-gradient(to bottom, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 20%);
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE: Desktop (wider than 768px)
   ═══════════════════════════════════════════════════ */
@media (min-width: 769px) {

  /* Fullscreen desktop: image stays full-bleed, content is centered */
  .wc-reels--fullscreen .wc-reels__content {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Card desktop: constrain width */
  .wc-reels--card {
    max-width: 480px;
  }

  /* Larger tap zones text on desktop */
  .wc-reels__tap-zone {
    width: 25%;
  }

  /* Slightly larger text on desktop */
  .wc-reels__brand {
    font-size: 18px;
  }

  .wc-reels__title {
    font-size: 22px;
  }

  .wc-reels__price {
    font-size: 18px;
  }

  .wc-reels__cat {
    padding: 8px 16px;
    font-size: 14px;
  }

  .wc-reels__btn {
    padding: 14px 18px;
    font-size: 15px;
  }

  .wc-reels__top {
    padding: 16px 20px 12px;
  }

  .wc-reels__content {
    padding: 24px 20px 0;
  }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE: Mobile (up to 768px)
   ═══════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Card mode on mobile: full width, taller */
  .wc-reels--card {
    border-radius: 0;
    max-width: 100%;
  }

  .wc-reels--card .wc-reels__media,
  .wc-reels--card .wc-reels__media::after,
  .wc-reels--card .wc-reels__top,
  .wc-reels--card .wc-reels__bottom {
    border-radius: 0;
  }

  /* Compact padding on mobile */
  .wc-reels__content {
    padding: 14px 14px 0;
  }

  .wc-reels__top {
    padding: 10px 10px 8px;
  }

  .wc-reels__title {
    font-size: 16px;
  }

  .wc-reels__price {
    font-size: 15px;
  }

  .wc-reels__btn {
    padding: 11px 12px;
    font-size: 13px;
  }

  .wc-reels__cat {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* ── All Caught Up End Card ── */
.wc-reels__slide--end-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.wc-reels__end-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 32px;
  color: #fff;
}

.wc-reels__end-card__check {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 3px solid rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 24px;
  animation: checkBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkBounce {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.wc-reels__end-card__title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px 0;
  letter-spacing: -0.5px;
}

.wc-reels__end-card__subtitle {
  font-size: 16px;
  opacity: 0.9;
  margin: 0;
}
