/* Main gift wrap container - base hides when -active class missing */
.amwrap-gift-wrap:not(.-active) {
    display: block !important;
}

/* All amwrap-btn elements - force enabled */
.amwrap-btn {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Finish / Apply Gift Wrap button */
.finish-btn.amwrap-btn,
.finish-btn {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Next/Back buttons - let Alpine :disabled handle state */
.amwrap-btn-next,
.amwrap-btn-back {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Disabled buttons via Alpine :disabled binding */
.amwrap-btn-next:disabled,
.amwrap-btn-back:disabled {
    opacity: 0.3 !important;
    pointer-events: none !important;
}

/* Popup block - base sets display:none by default */
.amwrap-popup-block {
    display: none;
}

.amwrap-popup-block.-active {
    display: flex !important;
    justify-content: center;
    align-items: center;
}

/* Disabled/loading state - keep for elements that truly need it */
.-amwrap-disabled,
.-loading {
    opacity: 0.3;
    pointer-events: none;
}

/* Slider description - base hides by default */
.amwrap-slider-block .amwrap-description {
    display: none;
}

/* Slider check input - hidden by default */
.amwrap-slider-block .amwrap-check {
    opacity: 0;
}

/* Gift message word break */
.amwrap-gift_message {
    word-break: break-word;
}

/* Price container font weight */
.amwrap-price-container .price-including-tax+.price-excluding-tax:before {
    font-weight: 400;
}

/* List reset */
.amwrap-list {
    padding: 0;
    list-style: none;
}

/* Checker input - base hides the native checkbox */
.amwrap-checkbox-block .amwrap-input {
    display: none;
}

/* Keep wrap slider responsive on mobile without affecting message-card slider layout */
.amwrap-gift-wrap .amwrap-slider-wrap .js_slide {
    width: 100% !important;
    min-width: 100% !important;
    flex-shrink: 0 !important;
}

/* Prevent template utility classes (mr-1 + p-1) from causing mobile overflow */
.amwrap-gift-wrap .amwrap-slider-wrap .js_slide,
.amwrap-gift-wrap .amwrap-slider-card .js_slide {
    box-sizing: border-box;
    margin-right: 0 !important;
}

@media (min-width: 768px) {
    .amwrap-gift-wrap .amwrap-slider-wrap .js_slide {
        width: 50% !important;
        min-width: 50% !important;
    }
}

@media (min-width: 1024px) {
    .amwrap-gift-wrap .amwrap-slider-wrap .js_slide {
        width: 33.3333% !important;
        min-width: 33.3333% !important;
    }
}

@media (min-width: 1280px) {
    .amwrap-gift-wrap .amwrap-slider-wrap .js_slide {
        width: 25% !important;
        min-width: 25% !important;
    }
}

/* Gift message card slider alignment fix on mobile */
.amwrap-gift-wrap .amwrap-slider-card .js_slide {
    justify-content: center !important;
}

.amwrap-gift-wrap .amwrap-slider-card .amwrap-slide {
    width: 100%;
    max-width: 220px;
    margin-left: auto;
    margin-right: auto;
}

.amwrap-gift-wrap .amwrap-slider-block,
.amwrap-gift-wrap .amwrap-slider-nav,
.amwrap-gift-wrap .amwrap-steps-wrapper,
.amwrap-gift-wrap .amwrap-step {
    max-width: 100%;
    overflow-x: clip;
}

@media (max-width: 767px) {
    .amwrap-gift-wrap .amwrap-slider-wrap .js_slide {
        width: 50% !important;
        min-width: 50% !important;
        flex-shrink: 0 !important;
    }

    .amwrap-gift-wrap .amwrap-slider-card .js_slide {
        width: 50% !important;
        min-width: 50% !important;
        flex-shrink: 0 !important;
    }

    .amwrap-gift-wrap .amwrap-slider-nav .w-3.h-3 {
        margin: 0.375rem !important;
    }
}

/* Mobile PDP overflow guard: keep gift-wrap and its flex children inside viewport */
@media (max-width: 767px) {

    .catalog-product-view .info-main-items,
    .catalog-product-view .info-main-items>.w-full,
    .catalog-product-view .info-main-items .product-form,
    .catalog-product-view .info-main-items .amwrap-gift-wrap,
    .catalog-product-view .info-main-items .amwrap-gift-wrap>[x-show],
    .catalog-product-view .info-main-items .amwrap-steps-wrapper,
    .catalog-product-view .info-main-items .amwrap-steps-block,
    .catalog-product-view .info-main-items .amwrap-step,
    .catalog-product-view .info-main-items .amwrap-slider-block,
    .catalog-product-view .info-main-items .amwrap-slider-wrap,
    .catalog-product-view .info-main-items .amwrap-slider-card,
    .catalog-product-view .info-main-items .amwrap-toolbar-block {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .catalog-product-view .info-main-items {
        overflow-x: clip;
    }

    .catalog-product-view .info-main-items .amwrap-gift-wrap {
        max-width: 100vw;
        overflow-x: clip;
    }

    .catalog-product-view .info-main-items .amwrap-slider-wrap .js_slides,
    .catalog-product-view .info-main-items .amwrap-slider-card .js_slides {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .catalog-product-view .info-main-items .amwrap-toolbar-block .amwrap-title {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .catalog-product-view .info-main-items .amwrap-pagination-block {
        flex: 0 0 auto;
        min-width: auto;
        max-width: 155px;
    }
}

/* Steps wrapper – ensure full width */
.amwrap-gift-wrap .amwrap-steps-wrapper {
    width: 100%;
}

/* Steps list and step items – full width */
.amwrap-gift-wrap .amwrap-steps-block {
    width: 100%;
}

.amwrap-gift-wrap .amwrap-step {
    width: 100%;
    max-width: 100%;
}

/* Slider block – full width */
.amwrap-gift-wrap .amwrap-slider-block {
    width: 100%;
    display: block;
}

/* Finish step – choose list and items full width */
.amwrap-gift-wrap .amwrap-choose-list {
    width: 100%;
}

.amwrap-gift-wrap .amwrap-choose {
    width: 100%;
}

/* Card step – textarea block full width */
.amwrap-gift-wrap .amwrap-textarea-block {
    width: 100%;
}

.amwrap-gift-wrap .amwrap-textarea-block textarea {
    width: 100%;
}

/* PDP selected Gift Wrap row */
.catalog-product-view .amwrap-gift-wrap .amwrap-selected-items {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 18px;
    padding: 0;
    width: 100%;
    max-width: 100%;
    background: transparent;
    border: 0;
    box-sizing: border-box;
}

.catalog-product-view .amwrap-gift-wrap .amwrap-selected-items .amwrap-title {
    margin: 0;
    color: #2f2f2f;
    font-size: 16px;
    line-height: 1.4;
}

.catalog-product-view .amwrap-gift-wrap .amwrap-selected-items .amwrap-name {
    margin: 0 3px;
    font-weight: 700;
}

.catalog-product-view .amwrap-gift-wrap .amwrap-selected-items .amwrap-edit-btn,
.catalog-product-view .amwrap-gift-wrap .amwrap-selected-items .amwrap-trash-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    padding: 0;
    background: transparent;
    color: #2f2f2f;
    cursor: pointer;
}

.catalog-product-view .amwrap-gift-wrap .amwrap-selected-items .amwrap-edit-btn {
    margin-left: auto;
}

.catalog-product-view .amwrap-gift-wrap .amwrap-selected-items .amwrap-edit-btn svg,
.catalog-product-view .amwrap-gift-wrap .amwrap-selected-items .amwrap-trash-btn svg {
    width: 20px;
    height: 20px;
}

.catalog-product-view .amwrap-gift-wrap .amwrap-selected-items .amwrap-edit-btn:hover,
.catalog-product-view .amwrap-gift-wrap .amwrap-selected-items .amwrap-trash-btn:hover {
    color: #111827;
}

/* Remove ::after pseudo-element from edit/delete buttons - iOS Safari fix */
.catalog-product-view .amwrap-gift-wrap .amwrap-selected-items .amwrap-edit-btn::after,
.catalog-product-view .amwrap-gift-wrap .amwrap-selected-items .amwrap-trash-btn::after {
    content: none !important;
    display: none !important;
}

/* ── Cart Added Gift Wrap(s) block – same row structure as Amasty demo ── */

.amwrap-added-block {
    margin: 0 0 24px;
    padding: 0;
}

.amwrap-added-block .amwrap-info-block {
    margin: 24px 0 0;
    padding: 10px 14px;
    background: #d9edf7;
    font-weight: 700;
    border-radius: 0;
}

.amwrap-added-block .alh-amwrap-wrap-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.amwrap-added-block .alh-amwrap-item {
    margin: 0;
    padding: 22px 0 16px !important;
    border-top: 0 !important;
    border-bottom: 1px solid #d1d5db;
}

.amwrap-added-block .alh-amwrap-products {
    margin: 0;
}

.amwrap-added-block .alh-amwrap-product:not(:first-child) {
    margin-top: 20px;
}

.amwrap-added-block .alh-amwrap-product,
.amwrap-added-inline .alh-amwrap-product,
.amwrap-list-block .alh-amwrap-product,
div.alh-amwrap-product {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
}

.amwrap-added-block .alh-amwrap-product-name,
.amwrap-added-inline .alh-amwrap-product-name,
.amwrap-list-block .alh-amwrap-product-name,
span.alh-amwrap-product-name {
    display: inline !important;
    margin: 0 !important;
    font-size: 15px;
    line-height: 1.35;
}

.amwrap-added-block .alh-amwrap-qty {
    display: inline-block;
    box-sizing: border-box;
    min-width: 40px;
    padding: 4px 8px;
    background: #d9edf7;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.amwrap-added-block .alh-amwrap-qty::before,
.amwrap-added-block .amwrap-qty::before {
    content: none !important;
}

.amwrap-added-block .alh-amwrap-details {
    margin: 18px 0;
}

.amwrap-added-block .alh-amwrap-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.amwrap-added-block .alh-amwrap-detail-row:last-child {
    margin-bottom: 0;
}

.amwrap-added-block .alh-amwrap-detail-label {
    flex: 0 0 95px;
    font-weight: 700;
    white-space: nowrap;
}

.amwrap-added-block .alh-amwrap-detail-value {
    display: block;
    min-width: 0;
    word-break: normal !important;
    overflow-wrap: anywhere;
    white-space: normal;

}

.amwrap-added-block .alh-amwrap-price {
    margin: 0 0 12px;
    font-weight: 700;
    line-height: 1.35;
}

.amwrap-added-block .alh-amwrap-price .price-wrapper {
    display: block;
}

.amwrap-added-block .alh-amwrap-actions,
.amwrap-added-block .amwrap-wrap-list .alh-amwrap-actions {
    display: flex !important;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 8px;
    width: auto !important;
}

.amwrap-added-block .alh-amwrap-action-btn,
.amwrap-added-block .alh-amwrap-action-btn:hover,
.amwrap-added-block .alh-amwrap-action-btn:focus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    min-height: 22px;
}

.amwrap-added-block .alh-amwrap-action-btn::after {
    content: none !important;
}

.amwrap-added-block .alh-amwrap-action-btn svg {
    width: 20px;
    height: 20px;
    margin: 0 !important;
    color: #2b2b2b;
}

@media (min-width: 768px) {
    .amwrap-added-block .alh-amwrap-item {
        display: grid !important;
        grid-template-columns: minmax(170px, 22%) minmax(240px, 1fr) minmax(90px, 120px) auto;
        align-items: start;
        column-gap: 28px;
    }

    .amwrap-added-block .alh-amwrap-products {
        margin: 0;
    }

    .amwrap-added-block .alh-amwrap-details {
        margin: 0;
    }

    .amwrap-added-block .alh-amwrap-price {
        margin: 0;
    }

    .amwrap-added-block .alh-amwrap-actions {
        margin-left: auto;
        align-self: end;
    }
}

/* ── Per-item inline gift wrap row inside cart table ── */

/* Hide the original grouped "Added Gift Wrap(s)" block (keep in DOM for JS events) */
.amwrap-added-block:not(.amwrap-added-inline) {
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
}

.item-giftwrap-row {
    background: #fff;
}

.item-giftwrap-row>td {
    padding-top: 0 !important;
}

.amwrap-added-inline {
    margin: 0;
    padding: 0;
    border-top: 1px dashed #d1d5db;
}

.amwrap-added-inline .amwrap-info-block {
    margin: 8px 0 !important;
    padding: 6px 0 !important;
    background: transparent !important;
    font-weight: 600;
    font-size: 13px;
    color: #888;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 0;
}

.amwrap-added-inline .alh-amwrap-item:last-child {
    border-bottom: 0 !important;
}

@media (min-width: 768px) {
    .amwrap-added-inline .alh-amwrap-item {
        display: grid !important;
        grid-template-columns: minmax(150px, 20%) minmax(200px, 1fr) minmax(80px, 100px) auto;
        align-items: start;
        column-gap: 20px;
    }

    .amwrap-added-inline .alh-amwrap-products {
        margin: 0 !important;
    }

    .amwrap-added-inline .alh-amwrap-details {
        margin: 0 !important;
    }

    .amwrap-added-inline .alh-amwrap-price {
        margin: 0 !important;
    }
}

.amwrap-make-gift {
    margin: 0 !important;
    padding-top: 2rem !important;
}
/* Mobile English only - reduce gift checkbox spacing */
@media (max-width: 767px) {
    body:not(.ar-store) .amwrap-make-gift {
        padding-top: 0 !important;
        padding-bottom: 2rem !important;
    }
}
.amwrap-item-option {
    background-color: #f0ece7 !important;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0.5rem 0.375rem 0.75rem;
    margin: 0;
    border: none;
    border-radius: 1.5rem !important;
}

.amwrap-item-option .amwrap-title {
    background: none;
    color: #232323;
    padding: 0;
    border-radius: 0;
    font-size: 0.8125rem;
    font-weight: 400;
}

.amwrap-item-option button {
    color: #232323;
    border: none;
    border-radius: 1.25rem;
    cursor: pointer;
    font-size: 0.8125rem;
    padding: 0.25rem 0.75rem;
    line-height: 1.4;
    font-weight: 500;
}

/* ── Gift Wrap modal toolbar buttons (buttons_toolbar.phtml) ── */

.amwrap-btn-back {
    background: none;
    border: none;
    color: #232323;
    cursor: pointer;
    font-size: 0.8125rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    text-decoration: none;
}

.amwrap-btn-next {
    background-color: #ae9164;
    color: #fff;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.8125rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    height: 1.875rem;
    line-height: 1;
}

.finish-btn.amwrap-btn {
    background-color: #ae9164;
    color: #fff;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.8125rem;
    padding: 0 1.5rem;
    height: 1.875rem;
    line-height: 1;
}

.finish-btn.amwrap-btn:hover,
.finish-btn.amwrap-btn:focus {
    background-color: #c5a575;
    color: #fff;
}

.amwrap-btn-next:hover,
.amwrap-btn-next:focus {
    background-color: #c5a575;
    color: #fff;
}

/* Pagination block - keep natural order, flip progress line direction */
.ar-store .amwrap-pagination-block {
    direction: ltr;
}

.ar-store .amwrap-pagination-block:after {
    right: 0;
    left: auto;
}

/* Step page spacing - flip margin */
.ar-store .amwrap-pagination-block .amwrap-page:not(:last-child) {
    margin-right: 0;
    margin-left: 3rem;
}

.amwrap-giftwrap-totals .amwrap-giftwrap-tax{
    border-bottom-width: 0;
}
.amwrap-giftwrap-totals .amwrap-giftwrap-label span {
    font-size: 1.125rem; /* 18px */
}
.amwrap-giftwrap-totals .amwrap-giftwrap-label {
    text-align: left;
}

.amwrap-giftwrap-totals .amwrap-giftwrap-price,
.amwrap-giftwrap-totals .amwrap-giftwrap-price .price {
    font-size: 1rem; /* 16px */
    text-align: right;
}

.ar-store .amwrap-giftwrap-totals .amwrap-giftwrap-tax {
    font-weight: 400;
    display: flex !important;
    justify-content: space-between !important;
}
.ar-store .amwrap-selected-items .amwrap-edit-btn {
    margin-right: auto !important;
    margin-left: 0 !important;
}
/* Mobile - Gift Wrap font size */
@media (max-width: 767px) {
    .amwrap-giftwrap-totals .amwrap-giftwrap-label span {
        font-size: 15px !important;
    }
    .amwrap-added-block .alh-amwrap-detail-row {
        justify-content: space-between;
    }
    .ar-store .amwrap-giftwrap-totals .amwrap-giftwrap-label  {
        text-align: unset !important;
    }
    .ar-store .amwrap-giftwrap-totals .amwrap-giftwrap-price,
    .ar-store .amwrap-giftwrap-totals .amwrap-giftwrap-price .price {
        text-align: left !important;
    }

    .checkout-cart-index .item-giftwrap-row .amwrap-added-block {
        padding-inline: 0;
        padding-bottom: 0;
    }

    .checkout-cart-index .item-giftwrap-row li.alh-amwrap-item {
        display: flex;
        flex-wrap: wrap;
        padding-top: 10px !important;
        gap: 10px;
        padding-bottom: 0 !important;
    }

    .checkout-cart-index .item-giftwrap-row .alh-amwrap-products {
        flex-basis: 100%;
        margin: 0 !important;
    }

    .checkout-cart-index .item-giftwrap-row .alh-amwrap-details {
        display: flex;
        gap: 10px;
        align-items: center;
        margin: 0 !important;
        flex-basis: 60%;
    }

    .checkout-cart-index .item-giftwrap-row .amwrap-added-block .alh-amwrap-detail-label {
        flex: 0 0 max-content !important;
    }

    .checkout-cart-index .item-giftwrap-row span.alh-amwrap-detail-value {
        font-size: 11px;
        line-height: 26.5px;
    }

    .checkout-cart-index .item-giftwrap-row .alh-amwrap-detail-row {
        margin: 0 !important;
        width: 100%;
        justify-content: flex-start;
    }

    .checkout-cart-index .item-giftwrap-row .alh-amwrap-details + div {
        flex-basis: calc(40% - 10px);
    }

    .checkout-cart-index .item-giftwrap-row .alh-amwrap-price {
        margin: 0;
    }

    .checkout-cart-index .item-giftwrap-row .alh-amwrap-products {
        display: flex;
        align-items: center;
        gap: 10px;
    }
}
