/* =====================================================================
   Public Offers page  —  scoped entirely under .offers-page
   File: resources/views/web/offers/index.blade.php
   Nothing here affects Home / Category / Product / Cart / Checkout.
   ===================================================================== */

.offers-page {
    --off-brand: #883576;
    --off-brand-d: #6d2a5e;
    --off-buy: #e11d2e;
    --off-buy-d: #c2182780;
    --off-ink: #221826;
    --off-muted: #6f6675;
    --off-line: #ece6ec;
    --off-soft: #f7f2f6;
    --off-radius: 16px;
    --off-shadow: 0 4px 18px rgba(34, 24, 38, .06);
    background: #fbfafc;
    padding: 22px 0 60px;
    /* شبكة الاعتماديات (badges/أزرار/سعر) يمكن أن تكون كثيفة داخل بطاقة ضيقة - هذا يمنع أي
       عنصر عرضه أكبر من العرض المتاح من إحداث Scroll أفقي للصفحة كاملة على الجوال. */
    max-width: 100%;
    overflow-x: hidden;
}

.offers-page .container {
    max-width: 1280px;
}

.offers-page *,
.offers-page *::before,
.offers-page *::after {
    box-sizing: border-box;
}

/* ----------------------------- page head ----------------------------- */
.offers-head {
    text-align: center;
    margin-bottom: 30px;
}

.offers-head-title {
    font-size: clamp(24px, 3.2vw, 34px);
    font-weight: 800;
    color: var(--off-brand);
    margin: 0 0 8px;
}

.offers-head-subtitle {
    color: var(--off-muted);
    font-size: 15px;
    margin: 0;
    line-height: 1.7;
}

/* ----------------------------- filter bar ----------------------------- */
.offers-filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 28px;
}

.offers-filter-btn {
    background: #fff;
    border: 1px solid var(--off-line);
    color: var(--off-ink);
    font-weight: 700;
    font-size: 13.5px;
    padding: 8px 18px;
    width: fit-content;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.offers-filter-btn:hover {
    border-color: var(--off-brand);
    color: var(--off-brand);
}

.offers-filter-btn.is-active {
    background: var(--off-brand);
    border-color: var(--off-brand);
    color: #fff;
}

.offers-filter-empty {
    text-align: center;
    color: var(--off-muted);
    font-size: 14.5px;
    padding: 40px 0;
    margin: 0;
}

/* --------------------------- one offer block ------------------------- */
.offers-offer {
    margin-bottom: 40px;
}

/* ------------------------------- hero ------------------------------- */
.offers-hero {
    display: none !important;
    width: 100%;
    border-radius: var(--off-radius);
    overflow: hidden;
    aspect-ratio: 1200 / 340;
    background: var(--off-soft);
}

.offers-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.offers-hero--fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(120deg, var(--off-brand-d), var(--off-brand));
    color: #fff;
    text-align: center;
    padding: 24px;
}

.offers-hero-fallback-badge {
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 999px;
    padding: 5px 16px;
    font-size: 13px;
    font-weight: 700;
}

.offers-hero-fallback-title {
    font-size: clamp(20px, 3vw, 30px);
    font-weight: 800;
}

/* --------------------------- offer info ---------------------------- */
.offers-info {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 18px 6px 6px;
}

.offers-info-main {
    flex: 1 1 300px;
    min-width: 0;
}

.offers-info-type {
    display: inline-block;
    background: var(--off-soft);
    color: var(--off-brand);
    font-weight: 700;
    font-size: 12.5px;
    padding: 5px 14px;
    border-radius: 999px;
    margin-bottom: 8px;
}

.offers-info-title {
    font-size: clamp(19px, 2.4vw, 25px);
    font-weight: 800;
    color: var(--off-ink);
    margin: 0 0 6px;
}

.offers-info-desc {
    color: var(--off-muted);
    font-size: 14px;
    line-height: 1.8;
    margin: 0;
}

.offers-info-valid {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #fff5f6;
    color: var(--off-buy);
    border: 1px solid #f6d5d9;
    font-weight: 700;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 12px;
    white-space: nowrap;
}

/* ------------------------ products heading ------------------------ */
.offers-products-heading {
    font-size: 17px;
    font-weight: 800;
    color: var(--off-ink);
    margin: 18px 6px 14px;
    padding-inline-start: 12px;
    border-inline-start: 4px solid var(--off-brand);
    line-height: 1.2;
}

.offers-noproducts {
    text-align: center;
    color: var(--off-muted);
    font-size: 14.5px;
    padding: 26px 0;
    margin: 0;
}

/* ------------------------------- grid ----------------------------- */
.offers-grid {
    margin-inline: 0;
}

/* ------------------------------- card ----------------------------- */
.offers-card {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    /* border: 1px solid var(--off-line); */
    border-radius: var(--off-radius);
    overflow: hidden;
    transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

.offers-card:hover {
    box-shadow: 0 12px 30px rgba(34, 24, 38, .1);
    transform: translateY(-3px);
    border-color: #e2d5df;
}

.offers-card-badge {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    z-index: 2;
    background: var(--off-buy);
    color: #fff;
    font-size: 11.5px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 8px;
    line-height: 1.4;
}

.offers-card-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 14px;
    background: #fff;
    /* الصندوق دائمًا مربّع بنفس المقاس بغض النظر عن أبعاد صورة المنتج الأصلية - يمنع هذا وحده
       أي احتمال لظهور صورة "أطول" من البقية حتى لو فشل aspect-ratio لأي سبب */
    overflow: hidden;
}

.offers-card-thumb img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    /* contain (وليس cover) يعرض الصورة كاملة دون أي قص، حتى لو تركت مساحة فارغة حول الصورة
       عندما تختلف أبعادها الأصلية عن المربع */
    object-fit: contain;
    object-position: center;
    display: block;
}

.offers-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 14px 14px;
    flex: 1 1 auto;
}

.offers-card-name,
.offers-card-name:link,
.offers-card-name:visited {
    color: var(--off-ink) !important;
    font-weight: 700;
    font-size: 13.5px;
    line-height: 1.5;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.9em;
}

.offers-card-name:hover {
    color: var(--off-brand) !important;
}

.offers-card-prices {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}

.offers-card-price {
    color: var(--off-brand);
    font-weight: 800;
    font-size: 16px;
    white-space: nowrap;
}

.offers-card-old {
      color: #000000 !important;
    font-size: 14.5px !important;
    text-decoration: line-through;
    font-weight: 700 !important;
    white-space: nowrap;
    text-decoration-color: red !important;
    text-decoration-thickness: 2px !important;
}

.offers-card-price .sicon-sar,
.offers-card-old .sicon-sar {
    font-size: .85em;
}

.offers-card-monthly {
    color: var(--off-brand-d);
    font-size: 12px;
    font-weight: 700;
}

/* ----------------------------- actions ---------------------------- */
.offers-card-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 6px;
}

.offers-card-actions form {
    margin: 0;
}

.offers-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 0;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    padding: 10px 8px;
    cursor: pointer;
    transition: filter .15s ease, opacity .15s ease;
    line-height: 1.2;
}

.offers-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.offers-btn-cart {
    background: var(--off-brand);
    color: #fff;
}

.offers-btn-cart:hover:not(:disabled) {
    filter: brightness(1.08);
}

.offers-btn-buy {
    background: var(--off-buy);
    color: #fff;
}

.offers-btn-buy:hover:not(:disabled) {
    filter: brightness(1.08);
}

/* --------------------------- empty state -------------------------- */
.offers-empty {
    text-align: center;
    padding: 64px 20px;
    max-width: 460px;
    margin: 0 auto;
}

.offers-empty-icon {
    width: 74px;
    height: 74px;
    margin: 0 auto 18px;
    border-radius: 20px;
    background: var(--off-soft);
    color: var(--off-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.offers-empty-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--off-ink);
    margin: 0 0 8px;
}

.offers-empty-desc {
    color: var(--off-muted);
    font-size: 14.5px;
    line-height: 1.8;
    margin: 0 0 20px;
}

.offers-empty-btn {
    display: inline-block;
    background: var(--off-brand);
    color: #fff;
    font-weight: 700;
    font-size: 14.5px;
    padding: 12px 26px;
    border-radius: 12px;
    text-decoration: none;
    transition: filter .15s;
}

.offers-empty-btn:hover {
    filter: brightness(1.07);
    color: #fff;
}

/* ---------------------------- responsive -------------------------- */
@media (max-width: 991px) {
    .offers-hero {
        aspect-ratio: 1200 / 420;
    }
}

@media (max-width: 767px) {
    .offers-page {
        padding: 16px 0 44px;
    }

    .offers-filter-bar {
        /* flex-wrap: nowrap; */
        /* overflow-x: auto; */
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        margin-bottom: 20px;
    }

    .offers-filter-btn {
        flex: 0 0 auto;
        font-size: 12.5px;
        padding: 7px 14px;
    }

    .offers-offer {
        margin-bottom: 26px;
    }

    .offers-hero {
        aspect-ratio: 16 / 11;
        border-radius: 12px;
    }

    .offers-info {
        padding: 14px 4px 4px;

    }

    /* شارة "ساري حتى..." تلتف على أكثر من سطر بدل أن تُقص أو تُخرج السلة عن حدود الشاشة */
    .offers-info-valid {
        font-size: 12px;
        padding: 7px 12px;
        white-space: normal;
        width: 100%;
    }

    .offers-products-heading {
        font-size: 15.5px;
        margin: 14px 4px 12px;
    }

    /* البطاقة تبقى عمودين (col-6) على الجوال، لذا نُحكم كل التفاصيل الداخلية لتبقى واضحة
       وغير متلاصقة رغم ضيق المساحة */
    .offers-card-thumb {
        padding: 8px;
    }

    .offers-card-body {
        padding: 4px 8px 10px;
        gap: 5px;
    }

    .offers-card-name {
        font-size: 12px;
        line-height: 1.4;
        min-height: 2.6em;
    }

    .offers-card-price {
        font-size: 13.5px;
    }

    .offers-card-old {
        font-size: 11px;
    }

    .offers-card-monthly {
        font-size: 11px;
    }

    /* شارتا "تركيب مجاني" / "توصيل مجاني" بجانب بعض داخل عمود بعرض النصف - نُصغّرهما بما يكفي
       ليبقيا بجانب بعض بدل أن يُصفّا فوق بعض، حتى لا يصبح ارتفاع بطاقاتهما مختلفًا بشكل واضح
       عن باقي البطاقات في نفس الصف */
    .offers-card-body .free-install-delivery-badges {
        flex-wrap: wrap;
        gap: 4px;
    }

    .offers-card-body .free-install-delivery-badges .badge-pill {
        font-size: 9.5px;
        padding: 2px 4px;
    }

    .offers-card-actions {
        gap: 6px;
    }

    .offers-btn {
        font-size: 11.5px;
        padding: 9px 4px;
        gap: 5px;
    }

    .offers-btn i {
        font-size: 11px;
    }
}

/* هاتف صغير جدًا: نفس عمودين، لكن تصغير إضافي بسيط للصورة والنصوص لمزيد من الوضوح */
@media (max-width: 380px) {
    .offers-card-thumb {
        aspect-ratio: 4 / 3;
    }

    .offers-card-name {
        font-size: 11.5px;
    }

    .offers-btn span {
        font-size: 11px;
    }
}
