/* ==========================================================================
   VIDEO CAROUSEL — Tolstoy-Style Shoppable Carousel
   Developer: imcreative.dev
   Scoped entirely under .vc-section — no global resets, safe for WoodMart.
   ========================================================================== */

/* ── Carousel CSS Variables ── */
/* (WoodMart vars are inherited from theme; we define only carousel-specific ones) */
.vc-section {
  --vc-bg:              #f7f7f7;
  --vc-tile-radius:     8px;
  --vc-card-bg:         #ffffff;
  --vc-card-border:     1px solid #e8e8e8;
  --vc-card-radius:     8px;
  --vc-overlay-bg:      rgba(0,0,0,0.35);
  --vc-mute-size:       38px;
  --vc-nav-size:        44px;
  --vc-nav-bg:          rgba(255,255,255,0.92);
  --vc-speed:           0.6s;
  --vc-ease:            cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --vc-section-py:      40px;
  /* WoodMart fallbacks (theme will override these) */
  --wd-primary-color:   #83b735;
  --wd-title-color:     #333333;
  --wd-text-color:      #777777;
  --wd-title-font:      'Lato', 'Helvetica Neue', sans-serif;
  --wd-text-font:       'Lato', 'Helvetica Neue', sans-serif;
}

/* ── Box-sizing scoped (no global * reset) ── */
.vc-section,
.vc-section *,
.vc-section *::before,
.vc-section *::after {
  box-sizing: border-box;
}

/* ── Section Wrapper ── */
.vc-section {
  padding: var(--vc-section-py) 0;
  overflow: hidden;
  position: relative;
  background: transparent;
  -webkit-font-smoothing: antialiased;
  font-family: var(--wd-text-font);
}

.vc-section__header {
  text-align: center;
  margin-bottom: 28px;
  padding: 0 20px;
}

.vc-section__title {
  font-family: var(--wd-title-font);
  font-size: 28px;
  font-weight: 600;
  color: var(--wd-title-color);
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  line-height: 1.2;
}

.vc-section__subtitle {
  font-size: 14px;
  color: var(--wd-text-color);
  opacity: 0.75;
  margin: 0;
}

/* ── Carousel Container ── */
.vc-carousel-wrap {
  position: relative;
  width: 100%;
}

.vc-carousel-wrap .swiper,
.vc-products-wrap .swiper {
  overflow: visible !important;
  padding: 0 60px;
}

/* Core Swiper Layout Fixes */
.vc-carousel-wrap .swiper-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: flex !important;
  flex-direction: row !important;
  transition-property: transform;
  box-sizing: content-box;
}

/* ── Slide ── */
.vc-slide {
  cursor: pointer;
  transition: opacity var(--vc-speed) var(--vc-ease);
  will-change: opacity;
  flex-shrink: 0 !important;
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}

.vc-slide:not(.swiper-slide-active) { opacity: 0.55; }
.vc-slide:not(.swiper-slide-active):hover { opacity: 0.8; }
.vc-slide.swiper-slide-active { opacity: 1; z-index: 5; }

/* ── Tile ── */
.vc-tile {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: var(--vc-tile-radius);
  overflow: hidden;
  background: #1a1a1a;
  isolation: isolate;
}

.swiper-slide-active .vc-tile {
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

/* Loading placeholder (animated preview.webp as background) */
.vc-tile__loader {
  position: absolute;
  inset: 0;
  background-color: #1a1a1a;
  background-size: cover;
  background-position: center;
  z-index: 0;
  transition: opacity 0.4s ease;
}

.vc-tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
}

/* Hide loader once video is playing */
.vc-slide.is-active .vc-tile__loader {
  opacity: 0;
  pointer-events: none;
}

/* ── Overlay ── */
.vc-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.5) 0%,
    rgba(0,0,0,0.1) 30%,
    transparent 55%
  );
  border-radius: var(--vc-tile-radius);
}

.vc-overlay > * { pointer-events: auto; }

/* Author label */
.vc-author {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,0.4);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  position: absolute;
  bottom: 14px;
  left: 14px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  line-height: 1.4;
}

.vc-author::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wd-primary-color);
  flex-shrink: 0;
}

/* Mute button */
.vc-mute-btn {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: var(--vc-mute-size) !important;
  height: var(--vc-mute-size) !important;
  min-width: var(--vc-mute-size) !important;
  min-height: var(--vc-mute-size) !important;
  border-radius: 50% !important;
  aspect-ratio: 1 / 1;
  background: var(--vc-overlay-bg);
  border: none !important;
  color: #fff;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s, transform 0.15s;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1 !important;
  z-index: 3;
  box-sizing: border-box !important;
}

.vc-mute-btn:hover {
  background: rgba(0,0,0,0.6);
  transform: scale(1.08);
}

.vc-mute-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  display: block;
}

/* ── Product Cards ── */
.vc-product-wrap {
  position: relative;
  margin-top: 14px;
  width: 100%;
}

.vc-product-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--vc-card-bg);
  border: var(--vc-card-border);
  border-radius: var(--vc-card-radius);
  text-decoration: none;
  color: var(--wd-title-color);
  transition: box-shadow 0.25s, border-color 0.25s, transform 0.2s;
  height: 100%;
  min-height: 70px;
}

.vc-product-card:hover {
  border-color: var(--wd-primary-color);
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  color: var(--wd-title-color);
  text-decoration: none;
}

.vc-product-img {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
  background: #f5f5f5;
}

.vc-product-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.vc-product-name {
  font-family: var(--wd-title-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--wd-title-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.vc-product-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--wd-primary-color);
  line-height: 1;
}

/* ── Navigation Arrows ── */
.vc-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: var(--vc-nav-size);
  height: var(--vc-nav-size);
  border-radius: 50%;
  background: var(--vc-nav-bg);
  border: 1px solid #e0e0e0;
  color: var(--wd-title-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  padding: 0;
}

.vc-nav-btn:hover {
  background: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.14);
  transform: translateY(-50%) scale(1.06);
}

.vc-nav-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: block;
}

.vc-nav-prev { left: 10px; }
.vc-nav-next { right: 10px; }
.vc-nav-btn.swiper-button-disabled { opacity: 0.3; pointer-events: none; }

/* ── Responsive ── */
@media (min-width: 1440px) {
  .vc-carousel-wrap .swiper { padding: 0 80px; }
}

@media (max-width: 1279px) {
  .vc-carousel-wrap .swiper { padding: 0 50px; }
}

@media (max-width: 1024px) {
  .vc-carousel-wrap .swiper { padding: 0 40px; }
  .vc-nav-btn { width: 38px; height: 38px; }
  .vc-nav-prev { left: 4px; }
  .vc-nav-next { right: 4px; }
}

@media (max-width: 768px) {
  .vc-section { --vc-section-py: 28px; }
  .vc-section__title { font-size: 22px; }
  .vc-carousel-wrap .swiper { padding: 0 30px; }
  .vc-slide:not(.swiper-slide-active) { opacity: 0.45; }
  .vc-nav-btn { display: none; }
}

@media (max-width: 480px) {
  .vc-carousel-wrap .swiper { padding: 0 20px; }
  .vc-section__header { margin-bottom: 18px; }
  .vc-section__title { font-size: 20px; }
  .vc-product-wrap { margin-top: 10px; }
  .vc-product-card { padding: 10px 12px; }
  .vc-product-img { width: 42px; height: 42px; }
  .vc-mute-btn { width: 34px; height: 34px; }
  .vc-author { font-size: 11px; bottom: 10px; }
}
