/**
 * پیشنهاد شگفت‌انگیز — باکس قرمز + کاروسل محصول (دیجی‌کالا)
 */

.hamta-flash-deals {
    --hamta-flash-color: #ef394e;
    --hamta-flash-h: 350px;
    --hamta-per-view: 4;
    margin: 1rem 0 1.5rem;
    direction: rtl;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.hamta-flash-deals,
.hamta-flash-deals * {
    box-sizing: border-box;
}

/* حاشیه سفید بیرونی مثل دیجی‌کالا */
.hamta-flash-deals--digikala {
    padding: 2px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.08);
}

.hamta-flash-deals__shell {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: var(--hamta-flash-color);
    border-radius: 16px;
    overflow: hidden;
    height: var(--hamta-flash-h);
    min-height: var(--hamta-flash-h);
    max-height: var(--hamta-flash-h);
    box-shadow: 0 4px 16px rgba(239, 57, 78, 0.12);
    padding: 5px;
}

/* ——— پنل کناری ——— */
.hamta-flash-deals__hero {
    flex: 0 0 clamp(132px, 13vw, 168px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    padding: 0.5rem 0.65rem;
}

.hamta-flash-deals--digikala .hamta-flash-deals__hero {
    border-left: none;
}

.hamta-flash-deals__hero-inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

/* دسکتاپ: برند (عنوان+آیکون) با display:contents → ترتیب تایمر/آیکون/لینک */
.hamta-flash-deals__hero-bar {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.hamta-flash-deals__hero-brand {
    display: contents;
}

.hamta-flash-deals__title {
    order: 0;
    margin: 0;
    font-size: clamp(0.88rem, 1.2vw, 1.05rem);
    font-weight: 800;
    line-height: 1.45;
    color: #fff;
}

.hamta-flash-deals__timer {
    order: 1;
}

.hamta-flash-deals__icon {
    order: 2;
}

.hamta-flash-deals__more {
    order: 3;
}

.hamta-flash-deals__hero-top {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.hamta-flash-deals__timer-label {
    display: none;
}

/* شمارنده ۳ باکس + دو‌نقطه (دیجی‌کالا) */
.hamta-flash-deals__timer--digikala {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    width: 100%;
    margin: 0 auto;
    direction: ltr;
}

.hamta-flash-deals__timer--digikala .hamta-flash-deals__timer-seg--days[hidden],
.hamta-flash-deals__timer--digikala .hamta-flash-deals__timer-colon--days[hidden] {
    display: none !important;
}

.hamta-flash-deals__timer--digikala .hamta-flash-deals__timer-seg--days:not([hidden]) {
    display: inline-flex;
}

.hamta-flash-deals__timer-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
}

.hamta-flash-deals__timer--digikala .hamta-flash-deals__timer-seg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1rem;
    min-height: 1.85rem;
    padding: 0.2rem 0.35rem;
    background: #fff;
    border-radius: 6px;
    color: #3f4064;
    box-shadow: none;
}

.hamta-flash-deals__timer--digikala .hamta-flash-deals__timer-val {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.hamta-flash-deals__timer--digikala .hamta-flash-deals__timer-colon {
    display: inline-block;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    padding: 0 0.05rem;
}

/* شمارنده ۴ باکس (صفحه فرود) */
.hamta-flash-deals__timer--full {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
    width: 100%;
    max-width: 11.5rem;
    margin: 0 auto;
    direction: ltr;
}

.hamta-flash-deals__timer--full .hamta-flash-deals__timer-seg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 2.85rem;
    padding: 0.28rem 0.2rem 0.22rem;
    background: #fff;
    border-radius: 10px;
    color: var(--hamta-flash-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.hamta-flash-deals__timer--full .hamta-flash-deals__timer-val {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.hamta-flash-deals__timer-unit {
    margin-top: 0.12rem;
    font-size: 0.58rem;
    font-weight: 700;
    line-height: 1;
    color: #81858b;
}

.hamta-flash-deals__desc {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.5;
    opacity: 0.92;
}

.hamta-flash-deals__icon {
    width: 3.5rem;
    height: 3.5rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.15rem 0 0;
}

.hamta-flash-deals--digikala .hamta-flash-deals__icon {
    width: 4.25rem;
    height: 4.25rem;
}

.hamta-flash-deals__icon::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    border-bottom-color: transparent;
    transform: rotate(-35deg);
}

.hamta-flash-deals__icon-pct {
    font-size: 1.65rem;
    font-weight: 900;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.hamta-flash-deals--digikala .hamta-flash-deals__icon-pct {
    font-size: 2rem;
}

.hamta-flash-deals__icon--image {
    width: 5rem;
    height: auto;
}

.hamta-flash-deals--digikala .hamta-flash-deals__icon--image {
    width: 147px;
    height: auto;
}

.hamta-flash-deals__icon--image::before {
    display: none;
}

.hamta-flash-deals__icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    display: block;
}

/* لینک متنی «مشاهده همه» */
.hamta-flash-deals__more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    margin-top: 0.25rem;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.hamta-flash-deals__more:hover,
.hamta-flash-deals__more:focus-visible {
    background: transparent;
    color: #fff;
    text-decoration: none;
    opacity: 0.88;
}

.hamta-flash-deals__more-arrow {
    display: inline-block;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.95;
}

/* ——— نوار محصولات روی پس‌زمینه قرمز ——— */
.hamta-flash-deals__products {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    background: var(--hamta-flash-color);
    position: relative;
    overflow: hidden;
    padding: 4px 0;
}

.hamta-flash-deals__carousel,
.hamta-flash-deals__frame,
.hamta-flash-deals__swiper {
    height: 100%;
}

.hamta-flash-deals__frame {
    position: relative;
    padding: 0 !important;
    gap: 0 !important;
    height: 100% !important;
    min-height: 100%;
    display: block !important;
}

.hamta-flash-deals__swiper {
    background: transparent;
    overflow: hidden !important;
}

/*
 * لایه‌بندی Swiper باید همیشه باشد — CSS کتابخانه hpb-lib روی مهمان
 * توسط SEO strip می‌شود؛ بدون display:flex بعد از init فقط یک کارت دیده می‌شود
 * و کلیک ناو به فضای خالی می‌رود.
 */
.hamta-flash-deals__swiper .swiper-wrapper {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch;
    box-sizing: border-box;
    height: 100%;
    width: 100%;
}

.hamta-flash-deals__slide,
.hamta-flash-deals__swiper .swiper-slide {
    flex-shrink: 0 !important;
    height: 100% !important;
    padding: 0 1px;
    box-sizing: border-box;
}

/* قبل از init — عرض موقت؛ بعد از init عرض را Swiper با inline می‌گذارد */
.hamta-flash-deals__swiper:not(.swiper-initialized) .hamta-flash-deals__slide {
    flex: 0 0 calc(100% / var(--hamta-per-view, 4));
    width: calc(100% / var(--hamta-per-view, 4));
    max-width: calc(100% / var(--hamta-per-view, 4));
}

/* فلش‌ها — prev چپ، next راست، وسط عمودی */
.hamta-flash-deals .hamta-flash-deals__frame .hamta-flash-deals__nav {
    position: absolute !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 2rem !important;
    height: 2rem !important;
    min-width: 2rem !important;
    margin: 0 !important;
    flex: none !important;
    align-self: auto !important;
    background: rgba(255, 255, 255, 0.92) !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
    color: #81858b !important;
    z-index: 6;
    opacity: 0.96;
    cursor: pointer;
    padding: 0 !important;
}

.hamta-flash-deals .hamta-flash-deals__nav::after {
    content: none !important;
    display: none !important;
}

.hamta-flash-deals .hamta-flash-deals__nav i {
    font-size: 0.85rem;
    line-height: 1;
    color: #81858b;
    pointer-events: none;
}

.hamta-flash-deals .hamta-flash-deals__nav--prev {
    left: 0.35rem !important;
    right: auto !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
}

.hamta-flash-deals .hamta-flash-deals__nav--next {
    right: 0.35rem !important;
    left: auto !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
}

.hamta-flash-deals .hamta-flash-deals__nav.swiper-button-disabled {
    opacity: 0 !important;
    pointer-events: none;
}

.hamta-flash-deals .hamta-design-carousel__pagination {
    display: none !important;
}

/* ——— کارت محصول ——— */
.hamta-flash-card {
    background: #fff;
    border-radius: 0;
    height: 100%;
    box-sizing: border-box;
}

.hamta-flash-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.65rem 0.55rem 0.75rem;
    color: inherit;
    text-decoration: none;
}

.hamta-flash-card__media {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 200px;
    margin-bottom: 0.5rem;
}

.hamta-flash-card__media img {
    max-width: 100%;
    max-height: max-content;
    width: auto;
    height: auto;
    object-fit: contain;
}

.hamta-flash-card__title {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.4;
    color: #3f4064;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: anywhere;
    min-height: calc(1.4em * 2);
    max-width: 100%;
}

.hamta-flash-card__price-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.4rem;
    width: 100%;
    margin-top: auto;
    padding-top: 0.3rem;
    direction: rtl;
}

.hamta-flash-card__price-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.08rem;
    min-width: 0;
    flex: 0 1 auto;
    text-align: right;
}

.hamta-flash-card__price-now {
    font-size: 0.88rem;
    font-weight: 800;
    color: #3f4064;
    white-space: nowrap;
}

.hamta-flash-card__price-was {
    font-size: 0.66rem;
    color: #a1a3a8;
    text-decoration: line-through;
    white-space: nowrap;
}

.hamta-flash-card__pct {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.28rem;
    margin-inline-start: 0;
    border-radius: 999px;
    background: var(--hamta-flash-color);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
}

.hamta-flash-deals__empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 1rem;
    color: #fff;
    font-size: 0.95rem;
}

/* ——— موبایل ——— */
@media (max-width: 767px) {
    .hamta-flash-deals {
        --hamta-flash-h: auto;
    }

    .hamta-flash-deals__shell {
        flex-direction: column;
        height: auto;
        min-height: 0;
        max-height: none;
        border-radius: 8px;
    }

    .hamta-flash-deals__hero {
        flex: none;
        width: 100%;
        padding: 0.55rem 0.7rem 0.35rem;
    }

    /* موبایل: بدون تصویر هیرو — شمارنده جای تصویر (سمت راست) */
    .hamta-flash-deals__hero-bar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.45rem;
        width: 100%;
    }

    .hamta-flash-deals__icon {
        display: none !important;
    }

    .hamta-flash-deals__hero-brand:not(:has(.hamta-flash-deals__title)) {
        display: none !important;
    }

    .hamta-flash-deals__hero-brand {
        display: inline-flex;
        flex-direction: row;
        align-items: center;
        gap: 0.35rem;
        flex: 0 1 auto;
        min-width: 0;
        max-width: 38%;
        order: 1;
    }

    .hamta-flash-deals__title,
    .hamta-flash-deals__timer,
    .hamta-flash-deals__more {
        margin: 0;
    }

    .hamta-flash-deals__title {
        font-size: 0.92rem;
        font-weight: 800;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: right;
    }

    /* RTL: order کمتر = سمت راست‌تر — تایمر جای تصویر */
    .hamta-flash-deals__timer {
        order: 0;
        flex: 0 0 auto;
        width: auto;
        display: flex;
        justify-content: center;
        min-width: 0;
    }

    .hamta-flash-deals__more {
        order: 2;
        flex: 0 0 auto;
        margin: 0;
        font-size: 0.78rem;
        font-weight: 600;
    }

    .hamta-flash-deals__timer--digikala {
        width: auto;
        margin: 0;
    }

    .hamta-flash-deals__timer--digikala .hamta-flash-deals__timer-seg {
        min-width: 1.45rem;
        min-height: 1.45rem;
        padding: 0.12rem 0.2rem;
        border-radius: 5px;
    }

    .hamta-flash-deals__timer--digikala .hamta-flash-deals__timer-val {
        font-size: 0.8rem;
    }

    .hamta-flash-deals__timer--digikala .hamta-flash-deals__timer-colon {
        font-size: 0.8rem;
        margin: 0 0.08rem;
    }

    .hamta-flash-deals__desc {
        display: none;
    }

    .hamta-flash-card__title {
        font-size: 0.64rem;
        line-height: 1.35;
        min-height: calc(1.35em * 2);
    }

    .hamta-flash-card__price-now {
        font-size: 0.8rem;
    }

    .hamta-flash-deals__products {
        height: 250px;
        min-height: 250px;
        padding: 3px 0 6px;
        width: 100%;
    }

    .hamta-flash-deals__carousel,
    .hamta-flash-deals__frame,
    .hamta-flash-deals__swiper {
        width: 100%;
        min-width: 0;
    }

    .hamta-flash-deals__swiper:not(.swiper-initialized) .hamta-flash-deals__slide {
        flex: 0 0 calc(100% / 2.15);
        width: calc(100% / 2.15);
        max-width: calc(100% / 2.15);
    }

    .hamta-flash-deals .hamta-flash-deals__nav--prev {
        left: 0.25rem !important;
        right: auto !important;
    }

    .hamta-flash-deals .hamta-flash-deals__nav--next {
        right: 0.25rem !important;
        left: auto !important;
    }
}

@media (min-width: 768px) {
    .hamta-flash-deals .hamta-flash-deals__frame {
        display: block !important;
        position: relative !important;
        height: 100% !important;
    }

    .hamta-flash-deals .hamta-flash-deals__frame .hamta-flash-deals__nav {
        position: absolute !important;
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
        align-self: auto !important;
    }
}

/* صفحه فرود کمپین در فروشگاه */
.hamta-promo-landing-head {
    margin: 0 0 1rem;
    border-radius: 12px;
    overflow: hidden;
    background: var(--hamta-flash-color, #ef394e);
    color: #fff;
}

.hamta-promo-landing-head__inner {
    padding: 1rem 1.1rem 1.15rem;
    text-align: center;
}

.hamta-promo-landing-head__title {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
}

.hamta-promo-landing-head__badge {
    margin: 0 0 0.5rem;
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 0.78rem;
    font-weight: 600;
}

.hamta-promo-landing-head__desc {
    margin: 0.65rem 0 0;
    font-size: 0.88rem;
    line-height: 1.6;
    opacity: 0.95;
}

.hamta-promo-landing-head__timer {
    margin: 0.35rem auto 0;
    max-width: 18rem;
}
