.giftbox-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}
.giftbox-modal-content-wrapper {
    width: calc(100% - 100px);
    margin: 0 auto;
    height: calc(100% - 100px);
    padding: 10px;
    background: #fff;
    border-radius: 24px;
    top: 50px;
    position: relative;
}
.giftbox-modal-content {
    background:linear-gradient(180deg, #061e17 0%, #114835 100%);
    width: 100%;
    height: 100%;
    padding: 40px;
    box-sizing: border-box;
    overflow: auto;
    position: relative;
    border-radius: 24px;
}

.giftbox-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.giftbox-dialog {
    background: #fff;
    border-radius: 14px;
    max-width: 440px;
    width: 100%;
    padding: 24px 26px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}

.giftbox-dialog-title {
    margin: 0 0 12px 0;
    font-size: 1.15rem;
    color: #1d2327;
    line-height: 1.3;
}

.giftbox-dialog-message {
    margin: 0 0 20px 0;
    line-height: 1.55;
    color: #3c434a;
    font-size: 14px;
}

.giftbox-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.giftbox-product-remove-from-box-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 4;
    display: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 30px;
    height: 30px;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: rgba(214, 54, 56, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
    color: #fff !important;
    cursor: pointer !important;
    outline: 0 !important;
    line-height: 0 !important;
}

.giftbox-product-card.is-in-box .giftbox-product-remove-from-box-btn {
    display: flex;
}

.giftbox-product-remove-from-box-btn:hover,
.giftbox-product-remove-from-box-btn:focus {
    background: #b32d2e !important;
    border-color: rgba(255, 255, 255, 0.75) !important;
}

.giftbox-product-remove-from-box-btn:focus-visible {
    outline: 2px solid #fff !important;
    outline-offset: 2px;
}

.giftbox-product-add-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 30px;
    height: 30px;
    margin: 0 !important;
    padding: 0 !important;
    color: #fff !important;
    line-height: 0 !important;
    border-radius: 50% !important;
    background: rgba(6, 30, 23, 0.92) !important;
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    cursor: pointer !important;
    outline: 0 !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
}

.giftbox-product-card:hover:not(.is-in-box) .giftbox-product-add-btn,
.giftbox-product-card:focus-within:not(.is-in-box) .giftbox-product-add-btn {
    display: flex;
}

.giftbox-product-card.is-in-box .giftbox-product-add-btn {
    display: none !important;
}

/* Touch / coarse pointer: keep + visible when item is not already in box */
@media (hover: none) and (pointer: coarse) {
    .giftbox-product-card:not(.is-in-box) .giftbox-product-add-btn {
        display: flex;
    }
}

.giftbox-product-add-btn:hover,
.giftbox-product-add-btn:focus {
    background: rgba(17, 72, 53, 0.98) !important;
    border-color: rgba(255, 255, 255, 0.65) !important;
}

.giftbox-product-add-btn:focus-visible {
    outline: 2px solid #fff !important;
    outline-offset: 2px;
}

.giftbox-close-btn {
    width: 40px;
    height: 40px;
    position: absolute;
    top: 10px;
    right: 10px;
    border: 0;
    background: #fff !important;
    padding: 5px;
    border-radius: 32px !important;
    cursor: pointer;
    outline: 0 !important;
}

.giftbox-title {
    margin-top: 0;
}

.giftbox-size-text {
    color: #50575e;
}

.giftbox-size-hint {
    color: #787c82;
}

.giftbox-step {
    display: none;
}

.giftbox-step.giftbox-step--active {
    display: block;
}

.giftbox-front-notice {
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.giftbox-front-notice--success {
    background: rgba(46, 160, 67, 0.15);
    color: #d0ffd9;
}

.giftbox-front-notice--error {
    background: rgba(214, 54, 56, 0.18);
    color: #ffd2d2;
}

.giftbox-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: nowrap;
}

.giftbox-sidebar {
    width: 320px;
    min-width: 320px;
}

.giftbox-category-select {
    width: 100%;
    margin-bottom: 10px;
    backdrop-filter: blur(10px);
    border-radius: 5px;
    outline: 0;
    background: rgb(255 255 255 / 75%);
}

.giftbox-custom-box-option {
    margin-bottom: 14px;
    padding: 12px 12px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.giftbox-custom-box-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
    margin: 0;
}

.giftbox-custom-box-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #114835;
}

.giftbox-custom-box-desc {
    margin: 8px 0 0 28px;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.78);
}

.giftbox-products-grid {
    display: flex;
    /* grid-template-columns: repeat(2, minmax(0, 1fr)); */
    gap: 8px;
    height: 645px;
    overflow: auto;
    border: 1px solid #dcdcde;
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #114835;
    backdrop-filter: blur(5px);
    padding: 10px;
    border: 1px solid rgb(255 255 255 / 30%);
    flex-wrap: wrap;
    align-content: flex-start;
}
.giftbox-sidebar p {
    text-align: left;
}
.giftbox-product-card {
    /* background: rgb(255 255 255 / 10%);
    backdrop-filter: blur(5px); */
    position: relative;
    box-sizing: border-box;
    border: 1px solid rgb(255 255 255 / 30%);
    border-radius: 8px !important;
    cursor: pointer;
    text-align: center;
    background-image: url("../img/product-img-bg.png");
    background-size: cover;
    background-position: bottom center;
    background-repeat: no-repeat;
    text-align: center;
    padding: 15px;
    width: 48%;
    flex: 0 0 48%;
}

.giftbox-product-card:hover {
    background: transparent !important;
}

.giftbox-product-card:hover .giftbox-product-size,
.giftbox-product-card:hover .giftbox-product-title {
    color: #fff;
}

.giftbox-product-card.is-selected {
    outline: 2px solid #061e17;
    border-color: #061e17;
    background: #061e17 !important;
}

.giftbox-product-card.is-selected .giftbox-product-size,
.giftbox-product-card.is-selected .giftbox-product-title {
    color: #fff;
}

.giftbox-product-image {
    width: 100%;
    height: 72px !important;
    object-fit: contain;
    display: block;
    margin-bottom: 4px;
}

.giftbox-no-image {
    height: 72px;
    border: 1px dashed #c3c4c7;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    color: #777;
}

.giftbox-product-title {
    display: block;
    font-size: 14px;
    color: #fff;
    font-weight: 400;
    word-wrap: break-word;
    white-space: normal;
    margin-bottom: 10px
}

.giftbox-product-size {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: #fff;
}

.giftbox-fit-message {
    margin-top: 10px;
    color: #d63638;
    display: none;
}

.giftbox-step-footer {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

#giftbox-save-next-btn {
    min-width: 145px;
}

.giftbox-review-layout {
    display: flex;
    flex-wrap: nowrap;
    gap: 32px;
    align-items: stretch;
}

.giftbox-review-shot-col {
    flex: 1 1 0;
    min-width: 0;
    max-width: 65%;
}

.giftbox-review-shot-heading {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.giftbox-preview-frame {
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    background: rgba(6, 30, 23, 0.55);
    padding: 12px;
    max-height: min(62vh, 570px);
    overflow: auto;
    box-sizing: border-box;
}

.giftbox-preview-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 8px;
    background: #0f3a2d;
    box-sizing: border-box;
}

.giftbox-review-form-col {
    flex: 0 0 500px;
    max-width: 100%;
    min-width: 280px;
}

.giftbox-request-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    padding: 22px 22px 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.giftbox-request-title {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    line-height: 1.25;
}

.giftbox-request-desc {
    margin: 0 0 20px 0;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.78);
}

.giftbox-field {
    margin-bottom: 16px;
}

.giftbox-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.92);
}

.giftbox-required {
    color: #ffb4b4;
    font-weight: 700;
}

.giftbox-field input,
.giftbox-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    padding: 11px 14px;
    font-size: 14px;
    color: #1d2327;
}

.giftbox-field input::placeholder,
.giftbox-field textarea::placeholder {
    color: #787c82;
}

.giftbox-field textarea {
    resize: vertical;
    min-height: 96px;
}

.giftbox-field input:focus,
.giftbox-field textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 0 2px rgba(17, 72, 53, 0.45);
}

.giftbox-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    margin-bottom: 0;
}

.giftbox-submit-btn {
    width: 100%;
    padding: 12px 20px !important;
    font-size: 15px !important;
    border-radius: 52px !important;
}

@media (max-width: 900px) {
    .giftbox-review-layout {
        flex-direction: column;
        gap: 24px;
    }

    .giftbox-review-shot-col {
        max-width: 100%;
    }

    .giftbox-review-form-col {
        flex: 1 1 auto;
        width: 100%;
    }
}

.giftbox-canvas-wrap {
    flex: 1;
    min-width: 0;
}

.giftbox-canvas {
    position: relative;
    border: 0;
    overflow: hidden;
}

/* Custom box: JS sets aspect-ratio; image keeps native proportions (no stretch blur). */
.giftbox-canvas--dynamic-plan .giftbox-canvas-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center center;
    background: #0f3a2d;
}

.giftbox-canvas-image {
    width: 100%;
    display: block;
}

@media (max-width: 1024px) {
    .giftbox-layout {
        flex-direction: column;
        gap: 14px;
    }

    .giftbox-canvas-wrap,
    .giftbox-sidebar {
        width: 100%;
        min-width: 0;
    }

    .giftbox-canvas {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }
}

.giftbox-front-layer {
    position: absolute;
    inset: 0;
    pointer-events: auto;
    border: 0 !important;
}

@keyframes giftbox-item-drop-in {
    0% {
        opacity: 0;
        transform: translateX(-90px) translateY(-10px) scale(0.9) rotate(-5deg);
    }
    60% {
        opacity: 1;
        transform: translateX(6px) translateY(2px) scale(1.01) rotate(1deg);
    }
    80% {
        opacity: 1;
        transform: translateX(-2px) translateY(-1px) scale(1) rotate(0deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) translateY(0) scale(1) rotate(0deg);
    }
}

.giftbox-item-holder--enter {
    animation: giftbox-item-drop-in 0.6s cubic-bezier(0.2, 0.78, 0.22, 1) forwards;
    transform-origin: center center;
}

@media (prefers-reduced-motion: reduce) {
    .giftbox-item-holder--enter {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
