/*
 * Prosazeh Flash Sale - Elementor Widget: Amazing Deals
 * Digikala-like "شگفت‌انگیز" UI (mobile-first)
 */

.psfs-amazing {
  --psfs-accent: #E53935;
  background: var(--psfs-accent);
  border-radius: 18px;
  padding: 12px;
  overflow: hidden;
  direction: rtl;
}

.psfs-amazing *,
.psfs-amazing *::before,
.psfs-amazing *::after {
  box-sizing: border-box;
}

.psfs-amazing__inner {
  display: flex;
  flex-direction: row-reverse;
  gap: 12px;
  align-items: stretch;
}

.psfs-amazing__panel {
  flex: 0 0 220px;
  width: 220px;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  padding: 14px 10px;
}

.psfs-amazing__panel-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.psfs-amazing__logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
}

.psfs-amazing__title {
  font-weight: 800;
  font-size: 22px;
  line-height: 1.25;
}

/* Responsive label text: desktop (2 lines) vs mobile (1 line) */
.psfs-amazing__title-desktop {
  display: inline-block;
}

.psfs-amazing__title-line {
  display: block;
  white-space: nowrap;
}

.psfs-amazing__title-mobile {
  display: none;
  white-space: nowrap;
}

.psfs-amazing__percent {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 42px;
  background: rgba(255, 255, 255, 0.18);
}

.psfs-amazing__all {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.psfs-amazing__all:hover {
  background: rgba(255, 255, 255, 0.20);
}

.psfs-amazing__all-short {
  display: none;
}

.psfs-amazing__scroller {
  flex: 1 1 auto;
  background: #fff;
  border-radius: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

/* Wrapper (injected by JS) so desktop arrows don't overlap the red panel */
.psfs-amazing__scroller-wrap {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
}

.psfs-amazing__nav {
  display: none;
}

@media (min-width: 769px) {
  /* Reserve space so cards don't sit under the arrows */
  .psfs-amazing__scroller-wrap .psfs-amazing__scroller {
    padding-left: 54px;
    padding-right: 54px;
    padding-inline: 54px;
    scroll-padding-left: 54px;
    scroll-padding-right: 54px;
    scroll-padding-inline: 54px;
  }

  .psfs-amazing__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(17, 24, 39, 0.12);
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #111827;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(17, 24, 39, 0.14);
    user-select: none;
  }

  .psfs-amazing__nav:focus {
    outline: 2px solid rgba(17, 24, 39, 0.28);
    outline-offset: 2px;
  }

  .psfs-amazing__nav:hover {
    background: rgba(255, 255, 255, 0.98);
  }

  .psfs-amazing__nav:active {
    background: #ffffff;
  }

  .psfs-amazing__nav:disabled {
    opacity: 0.35;
    cursor: default;
    box-shadow: none;
  }

  .psfs-amazing__nav--prev {
    left: 10px;
    inset-inline-start: 10px;
  }

  .psfs-amazing__nav--next {
    right: 10px;
    inset-inline-end: 10px;
  }

  /* Fallback positioning for older browsers (explicit RTL swaps) */
  .psfs-amazing[dir='rtl'] .psfs-amazing__nav--prev {
    left: auto;
    right: 10px;
  }

  .psfs-amazing[dir='rtl'] .psfs-amazing__nav--next {
    right: auto;
    left: 10px;
  }

  .psfs-amazing__nav-icon {
    font-size: 26px;
    line-height: 1;
    font-weight: 900;
  }

  .psfs-amazing__scroller-wrap.is-no-overflow .psfs-amazing__nav {
    display: none;
  }

  .psfs-amazing__scroller-wrap.is-no-overflow .psfs-amazing__scroller {
    padding-left: 0;
    padding-right: 0;
    padding-inline: 0;
    scroll-padding-left: 0;
    scroll-padding-right: 0;
    scroll-padding-inline: 0;
  }
}

.psfs-amazing__scroller::-webkit-scrollbar {
  display: none;
}

.psfs-amazing__track {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  min-height: 270px;
}

.psfs-amazing__card {
  width: 190px;
  min-width: 190px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: #111827;
  position: relative;
}

.psfs-amazing__card + .psfs-amazing__card {
  border-left: 2px solid rgba(229, 57, 53, 0.55);
}

.psfs-amazing__card:focus {
  outline: 2px solid rgba(17, 24, 39, 0.25);
  outline-offset: -2px;
}

.psfs-amazing__img {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.psfs-amazing__img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.psfs-amazing__img-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: #f3f4f6;
}

.psfs-amazing__product-title {
  font-size: 13px;
  line-height: 1.45;
  color: #374151;
  height: 40px;
  overflow: hidden;
  margin-bottom: 12px;
}

.psfs-amazing__prices {
  margin-top: auto;
}

.psfs-amazing__regular {
  min-height: 16px;
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 2px;
}

.psfs-amazing__regular del {
  text-decoration-thickness: 1px;
}

.psfs-amazing__sale-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.psfs-amazing__badge {
  background: var(--psfs-accent);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  padding: 3px 9px;
  line-height: 1.4;
  flex: 0 0 auto;
}

.psfs-amazing__badge--empty {
  opacity: 0;
}

.psfs-amazing__sale {
  font-size: 18px;
  font-weight: 900;
  color: #111827;
}

.psfs-amazing__currency {
  margin-top: 2px;
  font-size: 12px;
  color: #6b7280;
}

.psfs-amazing__extras {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.psfs-amazing__countdown,
.psfs-amazing__sold {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  line-height: 1.45;
  color: #6b7280;
}

.psfs-amazing__countdown.is-hidden {
  display: none;
}

.psfs-amazing__countdown-label {
  font-weight: 800;
  color: #374151;
  white-space: nowrap;
}

.psfs-amazing__countdown-value {
  font-weight: 700;
  color: #6b7280;
  white-space: nowrap;
}

.psfs-amazing__sold {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.psfs-amazing__sold-text {
  display: block;
  font-weight: 700;
  color: #6b7280;
}

.psfs-amazing__sold--mini .psfs-amazing__sold-bar {
  height: 4px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.psfs-amazing__sold--mini .psfs-amazing__sold-bar-fill {
  display: block;
  height: 100%;
  background: var(--psfs-accent);
  width: 0;
}

.psfs-amazing__scroller.is-dragging {
  cursor: grabbing;
}

/* Mobile layout: header strip + horizontal row */
@media (max-width: 768px) {
  .psfs-amazing {
    padding: 0;
    border-radius: 14px;
  }

  .psfs-amazing__inner {
    flex-direction: column;
    gap: 0;
  }

  .psfs-amazing__panel {
    width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 14px 12px;
    text-align: right;
  }

  .psfs-amazing__panel-top {
    flex-direction: row;
    gap: 10px;
  }

  .psfs-amazing__logo {
    width: 44px;
    height: 44px;
  }

  .psfs-amazing__title {
    font-size: clamp(14px, 5vw, 20px);
  }

  .psfs-amazing__title-desktop {
    display: none;
  }

  .psfs-amazing__title-mobile {
    display: inline-block;
  }

  .psfs-amazing__percent {
    width: 38px;
    height: 38px;
    font-size: 22px;
  }

  .psfs-amazing__all {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 14px;
  }

  .psfs-amazing__all-full {
    display: none;
  }

  .psfs-amazing__all-short {
    display: inline;
  }

  .psfs-amazing__scroller {
    border-radius: 0 0 14px 14px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    touch-action: auto;
  }

  .psfs-amazing__track {
    min-height: 310px;
  }

  .psfs-amazing__card {
    width: 220px;
    min-width: 220px;
    padding: 16px 14px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }
}
