
:root {
    --hf-text: #252525;
    --hf-muted: #88817d;
    --hf-line: #ece8e4;
    --hf-soft: #fbfaf8;
    --hf-accent: #f07a42;
    --hf-accent-2: #ef5a4f;
    --hf-accent-soft: #fff3ec;
    --hf-success: #52755d;
    --hf-shadow: 0 18px 55px rgba(33, 28, 25, .12);
}

.hf-extras {
    box-sizing: border-box;
    margin: 24px 0 18px;
    padding: 18px 18px 16px;
    background: #fff;
    border: 1px solid var(--hf-line);
    border-radius: 18px;
    box-shadow: 0 8px 28px rgba(35, 30, 27, .045);
    direction: rtl;
}

.hf-extras__head {
    text-align: right;
}

.hf-extras__title {
    margin: 0;
    color: var(--hf-text);
    font-size: 20px;
    line-height: 1.35;
    font-weight: 800;
    letter-spacing: -.1px;
}

.hf-extras__subtitle {
    margin: 5px 0 0;
    color: var(--hf-muted);
    font-size: 13px;
    line-height: 1.55;
}

.hf-extras__categories {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    margin-top: 14px;
}

.hf-extra-category {
    appearance: none;
    -webkit-appearance: none;
    min-width: 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 10px;
    background: #fff;
    border: 1px solid var(--hf-line);
    border-radius: 12px;
    color: var(--hf-text);
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background-color .18s ease;
}

.hf-extra-category:hover,
.hf-extra-category:focus-visible {
    transform: translateY(-1px);
    border-color: #f0b393;
    box-shadow: 0 7px 18px rgba(82, 55, 41, .08);
    outline: none;
}

.hf-extra-category.is-selected {
    border-color: #d8e2da;
    background: #fbfdfb;
}

.hf-extra-category__icon {
    width: 26px;
    height: 26px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 26px;
    border-radius: 50%;
    background: var(--hf-accent-soft);
    font-size: 15px;
    line-height: 1;
}

.hf-extra-category.is-selected .hf-extra-category__icon {
    background: #eef5ef;
}

.hf-extra-category__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hf-extra-category__plus {
    width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 20px;
    border-radius: 50%;
    background: #f6f3f1;
    color: var(--hf-accent);
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
}

.hf-extra-category.is-selected .hf-extra-category__plus {
    background: #eef5ef;
    color: var(--hf-success);
}

.hf-extras__selected {
    display: grid;
    gap: 7px;
    margin-top: 11px;
}

.hf-extras__selected:empty {
    display: none;
}

.hf-extra-selected-pill {
    appearance: none;
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0,1fr) auto auto;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    background: var(--hf-soft);
    border: 1px solid var(--hf-line);
    border-radius: 11px;
    color: var(--hf-text);
    font: inherit;
    text-align: right;
    cursor: pointer;
}

.hf-extra-selected-pill__icon {
    width: 26px;
    height: 26px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: #eef5ef;
    font-size: 14px;
}

.hf-extra-selected-pill__main {
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.hf-extra-selected-pill__label {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 800;
    color: var(--hf-success);
}

.hf-extra-selected-pill__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: #4d4a48;
}

.hf-extra-selected-pill__price {
    white-space: nowrap;
    font-size: 12px;
    font-weight: 800;
}

.hf-extra-selected-pill__price del {
    opacity: .45;
    margin-left: 4px;
}

.hf-extra-selected-pill__price ins {
    text-decoration: none;
}

.hf-extra-selected-pill__change {
    color: var(--hf-accent);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.hf-extra-modal[hidden] {
    display: none !important;
}

.hf-extra-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    padding: 18px;
}

.hf-extra-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 21, 20, .52);
    backdrop-filter: blur(4px);
}

.hf-extra-modal__dialog {
    position: relative;
    width: min(780px, 100%);
    max-height: min(84vh, 800px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(255,255,255,.6);
    border-radius: 22px;
    box-shadow: var(--hf-shadow);
    direction: rtl;
}

.hf-extra-modal__close {
    position: absolute;
    top: 13px;
    left: 13px;
    z-index: 2;
    width: 34px;
    height: 34px;
    border: 1px solid var(--hf-line);
    border-radius: 50%;
    background: #fff;
    color: #5f5b58;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}

.hf-extra-modal__header {
    padding: 20px 24px 14px;
    border-bottom: 1px solid var(--hf-line);
}

.hf-extra-modal__eyebrow {
    margin: 0 0 2px;
    color: var(--hf-accent);
    font-size: 11px;
    font-weight: 800;
}

.hf-extra-modal__title {
    margin: 0;
    color: var(--hf-text);
    font-size: 23px;
    line-height: 1.35;
    font-weight: 800;
}

.hf-extra-modal__body {
    min-height: 180px;
    overflow-y: auto;
    padding: 15px 18px 18px;
    scrollbar-width: thin;
}

.hf-extra-modal__products {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 12px;
}

.hf-extra-card {
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--hf-line);
    border-radius: 14px;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.hf-extra-card:hover {
    transform: translateY(-2px);
    border-color: #e6d9d2;
    box-shadow: 0 10px 24px rgba(35, 30, 27, .07);
}

.hf-extra-card__image-wrap {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #fff;
    border-bottom: 1px solid #f4f1ef;
}

.hf-extra-card__image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    padding: 7px;
    box-sizing: border-box;
}

.hf-extra-card__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 11px;
}

.hf-extra-card__name {
    min-height: 2.75em;
    margin: 0;
    color: var(--hf-text);
    font-size: 13px;
    line-height: 1.38;
    font-weight: 750;
}

.hf-extra-card__price {
    margin: 7px 0 10px;
    color: var(--hf-text);
    font-size: 14px;
    font-weight: 800;
}

.hf-extra-card__price del {
    opacity: .42;
    margin-left: 4px;
    font-weight: 500;
}

.hf-extra-card__price ins {
    text-decoration: none;
}

.hf-extra-card__add {
    width: 100%;
    min-height: 39px;
    margin-top: auto;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--hf-accent), var(--hf-accent-2));
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .18s ease, filter .18s ease, opacity .18s ease;
}

.hf-extra-card__add:hover {
    filter: brightness(.97);
    transform: translateY(-1px);
}

.hf-extra-card__add:disabled {
    cursor: default;
    transform: none;
    opacity: .68;
}

.hf-extra-modal__loading,
.hf-extra-modal__empty,
.hf-extra-modal__error {
    padding: 42px 10px;
    text-align: center;
    color: var(--hf-muted);
}

.hf-extra-modal__footer {
    display: flex;
    justify-content: flex-start;
    padding: 12px 18px 15px;
    border-top: 1px solid var(--hf-line);
    background: #fff;
}

.hf-extra-modal__done {
    min-width: 110px;
    min-height: 40px;
    padding: 8px 17px;
    border: 1px solid var(--hf-line);
    border-radius: 10px;
    background: #fff;
    color: var(--hf-text);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

body.hf-extra-modal-open {
    overflow: hidden;
}

.hf-extras--cart {
    margin-top: 22px;
}

.product-main-info .hf-extras--product {
    margin-top: 21px;
    margin-bottom: 17px;
}

@media (max-width: 767px) {
    .hf-extras {
        margin: 17px 0 15px;
        padding: 15px;
        border-radius: 16px;
        box-shadow: 0 6px 20px rgba(35, 30, 27, .035);
    }

    .hf-extras__title {
        font-size: 18px;
    }

    .hf-extras__subtitle {
        font-size: 12px;
    }

    .hf-extras__categories {
        grid-template-columns: repeat(2, minmax(0,1fr));
        gap: 8px;
        margin-top: 12px;
    }

    .hf-extra-category {
        min-height: 46px;
        padding: 8px 9px;
        border-radius: 11px;
        font-size: 12.5px;
    }

    .hf-extra-selected-pill {
        grid-template-columns: auto minmax(0,1fr) auto;
        gap: 8px;
        padding: 8px 9px;
    }

    .hf-extra-selected-pill__main {
        display: block;
    }

    .hf-extra-selected-pill__label {
        display: block;
        margin-bottom: 1px;
    }

    .hf-extra-selected-pill__name {
        display: block;
        font-size: 11.5px;
    }

    .hf-extra-selected-pill__change {
        display: none;
    }

    .hf-extra-modal {
        align-items: end;
        padding: 0;
    }

    .hf-extra-modal__dialog {
        width: 100%;
        max-height: 89vh;
        border-radius: 20px 20px 0 0;
    }

    .hf-extra-modal__header {
        padding: 18px 18px 13px;
    }

    .hf-extra-modal__title {
        font-size: 20px;
    }

    .hf-extra-modal__body {
        padding: 12px 12px 16px;
    }

    .hf-extra-modal__products {
        grid-template-columns: repeat(2, minmax(0,1fr));
        gap: 9px;
    }

    .hf-extra-card__content {
        padding: 9px;
    }

    .hf-extra-card__name {
        font-size: 12.5px;
    }

    .hf-extra-card__price {
        font-size: 13px;
    }

    .hf-extra-modal__footer {
        padding: 10px 12px max(12px, env(safe-area-inset-bottom));
    }

    .product-main-info .hf-extras--product {
        margin-top: 16px;
        margin-bottom: 14px;
    }
}


/* v1.5 — Mobile-first purchase path:
   price -> extras -> gift card -> add to cart -> descriptive content */
@media (max-width: 767px) {
    .hf-mobile-purchase-zone {
        width: 100%;
        margin-top: 14px;
        box-sizing: border-box;
    }

    .hf-mobile-purchase-zone::before {
        content: "אפשר לשדרג את המתנה בכמה שניות";
        display: block;
        margin: 0 0 8px;
        color: #6f6965;
        font-size: 12px;
        line-height: 1.45;
        text-align: right;
    }

    .hf-mobile-purchase-zone .hf-extras--product {
        margin-top: 0;
        margin-bottom: 14px;
    }

    .hf-mobile-purchase-zone .hf-gift-card {
        margin-top: 0;
        margin-bottom: 14px;
    }

    .hf-mobile-purchase-zone .buy-area {
        margin-top: 0;
    }

    .hf-mobile-purchase-zone + *,
    .hf-mobile-purchase-zone ~ .short-description,
    .hf-mobile-purchase-zone ~ .product-short-description {
        clear: both;
    }
}


/* v1.6 final polish */
@media (max-width: 767px) {
    .hf-mobile-purchase-zone::before {
        content: none !important;
        display: none !important;
    }
}


/* ===== Final visual polish v1.6 ===== */

/* Desktop: slightly tighter and more premium */
@media (min-width: 768px) {
    .hf-extras {
        padding: 17px 17px 15px;
        border-radius: 16px;
        box-shadow: 0 5px 18px rgba(35, 30, 27, .035);
    }

    .hf-extras__title {
        font-size: 19px;
    }

    .hf-extra-category {
        min-height: 46px;
        border-radius: 11px;
    }

    .hf-extra-modal__dialog {
        width: min(740px, 100%);
    }

    .hf-extra-card__image-wrap {
        aspect-ratio: 1.08 / 1;
    }

    .hf-extra-card__content {
        padding: 10px;
    }

    .hf-extra-card__name {
        font-size: 12.5px;
        min-height: 2.65em;
    }
}

/* Mobile: compact conversion flow */
@media (max-width: 767px) {
    .hf-mobile-purchase-zone {
        margin-top: 10px;
    }

    .hf-mobile-purchase-zone .hf-extras--product {
        margin-bottom: 10px;
    }

    .hf-extras {
        padding: 14px;
        border-radius: 15px;
    }

    .hf-extras__title {
        font-size: 17px;
        line-height: 1.3;
    }

    .hf-extras__subtitle {
        margin-top: 4px;
        font-size: 11.5px;
    }

    .hf-extras__categories {
        gap: 7px;
        margin-top: 10px;
    }

    .hf-extra-category {
        min-height: 44px;
        padding: 7px 8px;
        border-radius: 10px;
    }

    .hf-extra-category__icon {
        width: 24px;
        height: 24px;
        flex-basis: 24px;
        font-size: 14px;
    }

    .hf-extra-category__plus {
        width: 19px;
        height: 19px;
        flex-basis: 19px;
    }

    .hf-gift-card-mobile-toggle {
        width: 100%;
        min-height: 52px;
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 10px;
        padding: 10px 13px;
        margin: 0 0 10px;
        background: #fff;
        border: 1px solid var(--hf-line);
        border-radius: 13px;
        color: var(--hf-text);
        font: inherit;
        text-align: right;
        cursor: pointer;
        box-shadow: 0 4px 14px rgba(35, 30, 27, .025);
    }

    .hf-gift-card-mobile-toggle__icon {
        width: 30px;
        height: 30px;
        display: inline-grid;
        place-items: center;
        border-radius: 50%;
        background: var(--hf-accent-soft);
        font-size: 17px;
    }

    .hf-gift-card-mobile-toggle__text {
        min-width: 0;
        display: flex;
        align-items: baseline;
        gap: 7px;
    }

    .hf-gift-card-mobile-toggle__text strong {
        font-size: 14px;
        font-weight: 800;
    }

    .hf-gift-card-mobile-toggle__text small {
        font-size: 11px;
        color: var(--hf-success);
        font-weight: 700;
    }

    .hf-gift-card-mobile-toggle__arrow {
        color: var(--hf-accent);
        font-size: 18px;
        line-height: 1;
        transition: transform .18s ease;
    }

    .hf-mobile-purchase-zone .hf-gift-card.is-collapsed {
        display: none !important;
    }

    .hf-mobile-purchase-zone .hf-gift-card:not(.is-collapsed) {
        display: block;
        margin: 0 0 10px !important;
        padding-top: 0 !important;
    }

    .hf-mobile-purchase-zone .buy-area {
        margin-top: 4px !important;
    }

    .hf-mobile-purchase-zone .buy-area button,
    .hf-mobile-purchase-zone .buy-area .button,
    .hf-mobile-purchase-zone .buy-area input[type="submit"] {
        min-height: 52px;
    }

    .hf-extra-modal__dialog {
        max-height: 88vh;
    }

    .hf-extra-modal__products {
        gap: 8px;
    }

    .hf-extra-card {
        border-radius: 12px;
    }

    .hf-extra-card__image-wrap {
        aspect-ratio: 1.03 / 1;
    }

    .hf-extra-card__content {
        padding: 8px;
    }

    .hf-extra-card__name {
        min-height: 2.6em;
        font-size: 12px;
    }

    .hf-extra-card__price {
        margin: 6px 0 8px;
        font-size: 12.5px;
    }

    .hf-extra-card__add {
        min-height: 38px;
        border-radius: 9px;
        font-size: 12.5px;
    }
}


/* v1.7 — larger, more tappable mobile add-on controls */
@media (max-width: 767px) {
    .hf-extras {
        padding: 15px;
    }

    .hf-extras__categories {
        gap: 10px;
        margin-top: 12px;
    }

    .hf-extra-category {
        min-height: 58px;
        padding: 10px 12px;
        border-radius: 12px;
        font-size: 14px;
        gap: 9px;
    }

    .hf-extra-category__icon {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
        font-size: 17px;
    }

    .hf-extra-category__plus {
        width: 23px;
        height: 23px;
        flex-basis: 23px;
        font-size: 16px;
    }

    .hf-gift-card-mobile-toggle {
        min-height: 58px;
        padding: 11px 14px;
        border-radius: 13px;
    }

    .hf-gift-card-mobile-toggle__icon {
        width: 34px;
        height: 34px;
        font-size: 18px;
    }

    .hf-gift-card-mobile-toggle__text strong {
        font-size: 15px;
    }

    .hf-gift-card-mobile-toggle__text small {
        font-size: 11.5px;
    }
}


/* v1.8 — final mobile size bump */
@media (max-width: 767px) {
    .hf-extras {
        padding: 16px;
    }

    .hf-extras__title {
        font-size: 18px;
    }

    .hf-extras__categories {
        gap: 11px;
        margin-top: 13px;
    }

    .hf-extra-category {
        min-height: 64px;
        padding: 11px 13px;
        border-radius: 13px;
        font-size: 15px;
        gap: 10px;
    }

    .hf-extra-category__icon {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
        font-size: 18px;
    }

    .hf-extra-category__plus {
        width: 24px;
        height: 24px;
        flex-basis: 24px;
        font-size: 17px;
    }

    .hf-gift-card-mobile-toggle {
        min-height: 62px;
        padding: 12px 15px;
    }

    .hf-gift-card-mobile-toggle__icon {
        width: 36px;
        height: 36px;
        font-size: 19px;
    }

    .hf-gift-card-mobile-toggle__text strong {
        font-size: 15.5px;
    }
}
