/* =============================================================
   PRODUCT-CAROUSEL.CSS  –  Reusable Product Carousel
   Used on: Homepage sections, Product related, Cart suggested
   ============================================================= */

/* ── Carousel Wrapper ───────────────────────────────────────── */
.pc-carousel-wrap {
  position: relative;
}

/* ── Track + Viewport ───────────────────────────────────────── */
.pc-viewport {
  overflow: hidden;
  width: 100%;
}

.pc-track {
  display: flex;
  gap: 16px;
  transition: transform 0.42s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

/* ── Each slide (item) ──────────────────────────────────────── */
.pc-item {
  flex: 0 0 auto;
  /* Width set via JS / CSS variables per breakpoint */
}

/* ── Navigation arrows ──────────────────────────────────────── */
.pc-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(calc(-50% - 28px)); /* account for dots area */
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--card-shadow);
  font-size: 0.85rem;
}

.pc-arrow:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.35);
  transform: translateY(calc(-50% - 28px)) scale(1.08);
}

.pc-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.pc-arrow.pc-prev { left: -20px; }
.pc-arrow.pc-next { right: -20px; }

/* ── Dots ───────────────────────────────────────────────────── */
.pc-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.pc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.25s ease;
}

.pc-dot.active {
  background: var(--accent);
  width: 22px;
  border-radius: 4px;
}

/* ── Section header with arrows inline ─────────────────────── */
.pc-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.pc-section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pc-section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.2em;
  background: var(--accent);
  border-radius: 3px;
  vertical-align: middle;
}

.pc-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.pc-view-all {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: gap 0.2s;
  white-space: nowrap;
}
.pc-view-all:hover { gap: 8px; color: var(--accent-hover); }

/* Inline arrow buttons (inside header) */
.pc-header-arrows {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pc-header-arrow {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.8rem;
}

.pc-header-arrow:hover {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

.pc-header-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Fade edge masks (disabled) ─────────────────────────────── */
.pc-carousel-wrap::before,
.pc-carousel-wrap::after {
  content: none;
}

/* ── Responsive: items-per-view (via CSS custom props) ──────── */
/* Default: 4 cards on desktop */
.pc-item { width: calc((100% - 48px) / 4); } /* 3 gaps = 48px */

@media (max-width: 1100px) {
  .pc-item { width: calc((100% - 32px) / 3); }
}

@media (max-width: 768px) {
  .pc-item { width: calc((100% - 16px) / 2); }
  .pc-arrow.pc-prev { left: -12px; }
  .pc-arrow.pc-next { right: -12px; }
  .pc-arrow { width: 34px; height: 34px; font-size: 0.75rem; }
}

/* Always show at least 2 items */
@media (max-width: 480px) {
  .pc-item { width: calc((100% - 16px) / 2); }
  .pc-arrow { display: none; }
}

/* ── 2-column override (related/suggested, narrower containers) */
.pc-carousel-wrap[data-cols="2"] .pc-item {
  width: calc((100% - 16px) / 2);
}
@media (max-width: 600px) {
  .pc-carousel-wrap[data-cols="2"] .pc-item {
    width: 80%;
  }
}

/* ── 3-column override */
.pc-carousel-wrap[data-cols="3"] .pc-item {
  width: calc((100% - 32px) / 3);
}
@media (max-width: 900px) {
  .pc-carousel-wrap[data-cols="3"] .pc-item {
    width: calc((100% - 16px) / 2);
  }
}
@media (max-width: 500px) {
  .pc-carousel-wrap[data-cols="3"] .pc-item {
    width: 80%;
  }
}

/* ── Section container for carousel sections ────────────────── */
.fe-carousel-section {
  padding: 48px 0;
}

/* ── Suggested products (cart page) ─────────────────────────── */
.cart-suggested-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border-color);
}

.cart-suggested-section .pc-section-title {
  font-size: 1.15rem;
}

/* ── Related products (product page) ───────────────────────── */
.related-carousel-section {
  margin-top: 40px;
}

.related-carousel-section .pc-section-title {
  font-size: 1.2rem;
}

/* ── Touch drag cursor ──────────────────────────────────────── */
.pc-viewport.is-dragging {
  cursor: grabbing;
  user-select: none;
}
.pc-viewport { cursor: grab; }

/* ── Smooth card scale on hover in carousel ─────────────────── */
.pc-track .fe-product-card {
  height: 100%;
}

/* ── Animation for carousel section entry ───────────────────── */
@keyframes pcFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fe-carousel-section.pc-animated {
  animation: pcFadeUp 0.5s ease both;
}
