/**
 * 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: #fff5f5;
  border-top: 3px solid var(--color-error, #dc3545);
  border-bottom: 3px solid var(--color-error, #dc3545);
}

@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-error, #dc3545);
  color: #fff;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.flash-sale-title {
  font-size: var(--text-2xl, 1.5rem);
  font-weight: var(--weight-bold, 700);
  color: var(--color-text-primary, #1a1a1a);
  margin: 0;
}

.flash-sale-description {
  font-size: var(--text-sm, 0.875rem);
  color: var(--color-text-secondary, #666);
  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-error, #dc3545);
  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-error, #dc3545);
  color: #fff;
  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-error, #dc3545);
  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-lg, 12px);
  border: 1px solid rgba(220, 53, 69, 0.15);
  background: #fff;
}

/* ============================================
   Slider Wrapper (for arrow positioning)
   ============================================ */
.flash-sale-slider-wrapper {
  position: relative;
  padding-inline: 40px;
  padding-block: var(--space-4, 1rem);
}

@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: 34px;
  height: 34px;
  background: var(--color-error, #dc3545);
  border: none;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background var(--transition-fast, 150ms);
  cursor: pointer;
  padding: 0;
}

.flash-sale-arrow:hover {
  background: #b02a37;
}

.flash-sale-arrow-prev { inset-inline-start: 0; }
.flash-sale-arrow-next { inset-inline-end: 0; }

.flash-sale-arrow i {
  font-size: 1rem;
  line-height: 1;
}

/* RTL: flip prev/next positions */
[dir="rtl"] .flash-sale-arrow-prev { left: auto; right: 0; }
[dir="rtl"] .flash-sale-arrow-next { right: auto; left: 0; }

/* ============================================
   Side Banner
   ============================================ */
.flash-sale-banner-wrap {
  width: 100%;
  height: auto;
  overflow: hidden;
}

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

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

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

/* ============================================
   Flash Sale Product Card Overrides
   ============================================ */
.flash-sale-card .btn-add-to-cart {
  background: var(--color-error, #dc3545);
  border-color: var(--color-error, #dc3545);
}

.flash-sale-card .btn-add-to-cart:hover {
  background: #b02a37;
  border-color: #b02a37;
}

/* Savings badge */
.flash-sale-save-badge {
  display: inline-block;
  background: #ffc107;
  color: #1a1a1a;
  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;
  }
}
