/**
 * Flash Sale Section Styles
 */

/* ============================================
   Section Container
   ============================================ */

/* Full-width wrapper — no max-width cap, minimal edge padding */
.flash-sale-container {
  width: 100%;
  padding-inline: var(--space-3, 0.75rem);
  margin-inline: auto;
}

@media (min-width: 768px) {
  .flash-sale-container {
    padding-inline: var(--space-4, 1rem);
  }
}

@media (min-width: 1200px) {
  .flash-sale-container {
    padding-inline: var(--space-5, 1.25rem);
  }
}

.flash-sale-section {
  padding-block: var(--section-spacing-mobile);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--color-primary) 95%, black),
    color-mix(in srgb, var(--color-primary) 80%, var(--color-accent))
  );
  border-top: none;
  border-bottom: none;
}

@media (min-width: 768px) {
  .flash-sale-section {
    padding-block: var(--section-spacing);
  }
}

/* ============================================
   Header
   ============================================ */
.flash-sale-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  margin-bottom: var(--space-4, 1rem);
}

.flash-sale-title-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3, 0.75rem);
  flex: 1 1 auto;
}

.flash-sale-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full, 9999px);
  background: var(--color-accent);
  color: var(--color-white);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.flash-sale-title {
  font-size: var(--text-xl, 1.25rem);
  font-weight: var(--weight-bold, 700);
  color: var(--color-white);
  margin: 0;
}

@media (min-width: 768px) {
  .flash-sale-title {
    font-size: var(--text-2xl, 1.5rem);
  }
}

.flash-sale-description {
  font-size: var(--text-sm, 0.875rem);
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
  width: 100%;
}

.flash-sale-cta {
  flex-shrink: 0;
  align-items: center;
}

/* ============================================
   Countdown Timer
   ============================================ */
.flash-sale-countdown {
  display: flex;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.countdown-label {
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--weight-semibold, 600);
  color: var(--color-warning);
  white-space: nowrap;
}

.countdown-segments {
  display: flex;
  align-items: center;
  gap: 4px;
}

.countdown-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
  background: var(--color-accent);
  color: var(--color-white);
  border-radius: var(--radius-sm, 4px);
  padding: 4px 6px;
}

.countdown-value {
  font-size: 1.125rem;
  font-weight: var(--weight-bold, 700);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.countdown-unit {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.9;
}

.countdown-sep {
  font-size: 1.125rem;
  font-weight: var(--weight-bold, 700);
  color: var(--color-warning);
  line-height: 1;
  margin-bottom: 14px; /* align with value */
}

.countdown-ended {
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--weight-semibold, 600);
  color: var(--color-text-secondary, #666);
  font-style: italic;
}

/* ============================================
   Body Layout
   ============================================ */
.flash-sale-body {
  overflow: hidden;
  border-radius: var(--radius-xl, 16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(6px);
  align-items: stretch;
}

/* ============================================
   Slider Wrapper (for arrow positioning)
   ============================================ */
.flash-sale-slider-wrapper {
  position: relative;
  padding-inline: 52px;  /* wider — gives arrows breathing room */
  padding-block: var(--space-4, 1rem);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (max-width: 575px) {
  .flash-sale-slider-wrapper {
    padding-inline: 36px;
  }
}

/* ============================================
   Slide Row (flex container for cards in one slide)
   ============================================ */
.flash-sale-slide-row {
  display: flex;
  gap: var(--space-3, 0.75rem);
}

/* Desktop: fixed width based on --slides-to-show CSS variable set inline on each row */
.flash-sale-product-col {
  flex: 0 0 calc((100% - (var(--slides-to-show, 3) - 1) * 0.75rem) / var(--slides-to-show, 3));
  max-width: calc((100% - (var(--slides-to-show, 3) - 1) * 0.75rem) / var(--slides-to-show, 3));
  min-width: 0;
}

/* Mobile: 1 card, full width */
@media (max-width: 575px) {
  .flash-sale-product-col {
    flex: 0 0 100%;
    max-width: 100%;
  }
  .flash-sale-product-col:not(:first-child) {
    display: none;
  }
}

/* Tablet: 2 cards */
@media (min-width: 576px) and (max-width: 767px) {
  .flash-sale-product-col {
    flex: 0 0 calc(50% - 0.375rem);
    max-width: calc(50% - 0.375rem);
  }
  .flash-sale-product-col:nth-child(n+3) {
    display: none;
  }
}

/* ============================================
   Prev / Next Arrows
   ============================================ */
.flash-sale-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: var(--color-surface, #fff);
  border: none;
  border-radius: var(--radius-full);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
  padding: 0;
  box-shadow: var(--shadow-md);
  transition: background var(--transition-fast),
              color var(--transition-fast),
              transform var(--transition-fast),
              box-shadow var(--transition-fast);
}

.flash-sale-arrow:hover {
  background: var(--color-primary);
  color: var(--color-white);
  box-shadow: var(--shadow-lg);
  transform: translateY(-50%) scale(1.08);
}

.flash-sale-arrow-prev {
  inset-inline-start: var(--space-2);
}

.flash-sale-arrow-next {
  inset-inline-end: var(--space-2);
}

.flash-sale-arrow i {
  font-size: var(--text-base);
  line-height: 1;
}

/* ============================================
   Side Banner — fills column height, never dictates it
   ============================================ */
/* Banner column — flex row handles stretch, wrap drives height via aspect-ratio */
.flash-sale-banner-col {
  overflow: hidden;
}

/* aspect-ratio gives the wrap a concrete height (width × 3/5) so
   height:100% on the image resolves correctly and the image never
   expands the container beyond the card-column height */
.flash-sale-banner-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.flash-sale-banner-link {
  display: block;
  width: 100%;
  height: 100%;
}

.flash-sale-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform var(--transition-slow, 300ms);
}

.flash-sale-banner-wrap:hover .flash-sale-banner-img {
  transform: scale(1.04);
}

/* Savings badge */
.flash-sale-save-badge {
  display: inline-block;
  background: var(--color-warning, #E9C46A);
  color: var(--color-text);
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--weight-bold, 700);
  padding: 2px 8px;
  border-radius: var(--radius-full, 9999px);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .flash-sale-carousel {
    --bs-carousel-transition: none;
  }

  .flash-sale-arrow {
    transition: none;
  }

  .flash-sale-banner-img {
    transition: none;
  }
}

/* ============================================
   Section-level Title & Link Overrides
   (ensures legibility on dark gradient bg)
   ============================================ */
.flash-sale-section .flash-sale-title {
  color: var(--color-white);
}

.flash-sale-section .flash-sale-description {
  color: rgba(255, 255, 255, 0.75);
}

.flash-sale-section .btn-link {
  color: var(--color-warning);
}

.flash-sale-section .btn-link:hover {
  color: var(--color-accent);
}

/* ============================================
   Flash Sale Card — compact variant
   Smaller image, tighter text, equal heights
   ============================================ */

/* Equal-height columns: slide row is already flex; cards fill column */
.flash-sale-product-col {
  display: flex;
  flex-direction: column;
}

.flash-sale-card {
  flex: 1 1 auto;
}

/* Square image — matches regular product cards */
.flash-sale-card .product-image-wrapper {
  aspect-ratio: 1 / 1;
  padding: 4px;
}

/* Tighter content area */
.flash-sale-card .product-content {
  padding: var(--space-2) var(--space-2);
  gap: 2px;
}

/* Smaller text */
.flash-sale-card .product-category {
  font-size: 0.65rem;
}

.flash-sale-card .product-title {
  font-size: var(--text-xs);
  line-height: 1.3;
}

.flash-sale-card .product-brand {
  font-size: var(--text-xs);
}

.flash-sale-card .product-card-rating {
  font-size: 0.65rem;
  min-height: unset;
  margin-bottom: 0;
}

.flash-sale-card .product-price,
.flash-sale-card .product-price-current {
  font-size: var(--text-sm) !important;
}

.flash-sale-card .product-price-old {
  font-size: 0.65rem;
}

/* Compact button */
.flash-sale-card .btn-add-to-cart,
.flash-sale-card .btn-view-options {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  margin-top: var(--space-1);
}
