/* ── Offers Widget ──────────────────────────────── */

.kf-offers {
    --kf-ink: #1d2327;
    --kf-muted: #646970;
    --kf-line: #e0e0e0;
    --kf-soft: #f8f9fa;
    --kf-blue: #0073aa;
    --kf-blue-soft: #f0f7ff;
    --kf-blue-border: #cce5ff;
    --kf-green: #00a32a;
    --kf-green-soft: #edf7ed;
    --kf-radius: 12px;
    margin: 24px 0;
    font-family: inherit;
    direction: rtl;
}

.kf-offers-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.kf-offers-head::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--kf-line);
}

.kf-offers-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 800;
    color: var(--kf-ink);
    white-space: nowrap;
}

.kf-offers-title::before {
    content: '';
    width: 4px;
    height: 18px;
    border-radius: 4px;
    background: var(--kf-blue);
}

.kf-offers-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.kf-offer-item {
    margin: 0;
    padding: 0;
}

.kf-offer-item-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    height: 100%;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--kf-line);
    border-radius: var(--kf-radius);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

a.kf-offer-item-inner:hover {
    border-color: var(--kf-blue);
    box-shadow: 0 4px 16px rgba(0, 115, 170, 0.12);
    transform: translateY(-2px);
}

.kf-offer-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--kf-blue) 0%, #005f92 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
    box-shadow: 0 2px 6px rgba(0, 115, 170, 0.25);
}

.kf-offer-badge svg {
    flex-shrink: 0;
    opacity: 0.9;
}

.kf-offer-desc {
    font-size: 13px;
    line-height: 1.7;
    color: var(--kf-muted);
}

.kf-offer-scope {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    background: var(--kf-soft);
    border: 1px solid var(--kf-line);
    font-size: 12px;
    font-weight: 600;
    color: var(--kf-muted);
}

.kf-offer-cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
    padding: 8px 18px;
    border-radius: 8px;
    background: var(--kf-blue);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    transition: background 0.15s ease;
}

a.kf-offer-item-inner:hover .kf-offer-cta {
    background: #005f92;
}

/* ── Product page card variant ────────────────────── */

.kf-landing .kf-order-price-section .kf-offers {
    grid-template-columns: 1fr;
}

/* ── Responsive ──────────────────────────────── */

@media (max-width: 640px) {
    .kf-offers-list {
        grid-template-columns: 1fr;
    }

    .kf-offer-item-inner {
        padding: 14px;
    }

    .kf-offers-title {
        font-size: 14px;
    }
}

/* ── Free-unit (bonus) line ───────────────────────────
   The bonus frame is owned by the offer engine: the quantity is derived
   from the paid quantity and is never editable by the customer. */

.kf-free-unit-marker {
    display: none;
}

.kf-free-unit-tag {
    display: inline-block;
    margin-inline-start: 6px;
    padding: 2px 9px;
    border-radius: 999px;
    background: #e8f5e9;
    color: #1b5e20;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.kf-free-unit-price {
    font-weight: 700;
    color: #1b5e20;
}

.kf-free-unit-qty {
    display: inline-block;
    min-width: 26px;
    text-align: center;
    font-weight: 700;
}

.kf-free-unit-row {
    position: relative;
}

.kf-free-unit-note {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}

/* First line of defence (before the script runs) for the cart block. */
.wc-block-cart-items__row:has(.kf-free-unit-marker) .wc-block-cart-item__quantity,
.wc-block-cart-items__row:has(.kf-free-unit-marker) .wc-block-cart-item__remove-link {
    display: none !important;
}

tr.cart_item:has(.kf-free-unit-marker) .quantity input,
tr.cart_item:has(.kf-free-unit-marker) .product-remove {
    display: none !important;
}


/* Bundle button on product cards: "اشتري 3 + 1 مجانا". */
.button.buy-4.kf-buy-bundle,
.kf-buy-bundle {
    display: block;
    width: 100%;
    margin-top: 8px;
    text-align: center;
    cursor: pointer;
    font-weight: 700;
}

.kf-buy-bundle.is-loading {
    opacity: 0.7;
    cursor: progress;
}

.kf-buy-bundle-wrap {
    margin-top: 8px;
}

/* ── Offer chip on product cards ───────────────────────
   Printed with the card (see Offers::card_offer_marker_html), so it is there
   from the first paint — carousels included. It also carries the data of the
   card's bundle button. */

.kf-card-offer {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    margin: 2px 0 6px;
    padding: 3px 10px 3px 9px;
    border: none;
    border-radius: 999px;
    background: #0073aa;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    vertical-align: middle;
}

.kf-card-offer .kf-ico {
    flex: none;
}

.kf-card-offer[hidden],
.kf-card-offer + .kf-card-offer {
    display: none;
}

/* On an offer landing page every card has the same offer: the hero says it
   once, the chips would only repeat it. */
.kf-oc-grid .kf-card-offer {
    display: none;
}


/* ── Single-product payment card and sticky gallery ───── */

/*
 * WoodMart's sticky gallery anchors itself to the bottom of .product-images.
 * The payment-discount card lives in that column, so the stuck gallery must
 * be lifted by exactly the height the card adds. --kf-notice-h is measured
 * by the payment-discount script.
 */
.single-product .product-images .woocommerce-product-gallery {
    position: relative;
    z-index: 1;
}

.single-product .product-images.kf-has-offers-notice .woocommerce-product-gallery.is_stuck {
    bottom: var(--kf-notice-h, 0px) !important;
}

@media (prefers-reduced-motion: reduce) {
    .kf-buy-bundle {
        transition: none;
    }
}

/* ── applied / pending offer notices (cart + checkout) ───── */

.kf-offers-notice {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid #d3e1f5;
    border-inline-start: 3px solid #185ABD;
    border-radius: 6px;
    background: #eef4fd;
    color: #103f86;
    font-size: 13px;
    line-height: 1.6;
}

.kf-offers-notice strong {
    display: block;
    font-weight: 800;
}

.kf-offers-notice ul {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
}

.kf-offers-notice li {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
    margin: 2px 0;
}

.kf-offers-notice li > span {
    color: #4b5563;
    font-weight: 500;
}

/* A sub-offer sits under its main offer in the applied-offers banner. */
.kf-offers-notice li.is-sub {
    padding-inline-start: 10px;
}

.kf-offers-notice li > .kf-offer-child-tag {
    flex: none;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(24, 90, 189, 0.1);
    color: #185ABD;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.7;
}

.kf-offers-notice--active li > .kf-offer-child-tag {
    background: rgba(27, 94, 32, 0.12);
    color: #1b5e20;
}

.kf-offers-notice .kf-offer-cond {
    flex: 0 0 100%;
    color: #185ABD;
    font-size: 11.5px;
    font-style: normal;
    font-weight: 600;
}

.kf-offers-notice--active {
    border-color: #cfe8d8;
    border-inline-start-color: #1b5e20;
    background: #eef7ee;
    color: #1b5e20;
}

.kf-offers-notice--active li > span {
    color: #1b5e20;
}

.kf-offers-notice--muted {
    border-color: #e5e7eb;
    border-inline-start-color: #9ca3af;
    background: #f8fafc;
    color: #374151;
}

.kf-gateway-notice > span {
    display: block;
    margin-top: 2px;
    color: #103f86;
    font-size: 12px;
}

.kf-gateway-notice .kf-gateway-notice-hint {
    color: #4b5563;
    font-size: 11.5px;
}

/* The auto coupon only exists so the discount reaches the order. Its row is
   already explained by the kafraty status line (and would otherwise render as
   an empty "coupon" line now that the amount is applied). */
tr.cart-discount[class*="coupon-kf-offer-"],
.wc-block-components-totals-item[class*="coupon-kf-offer-"] {
    display: none !important;
}
