/*
 * Checkout gift wizard (design: product page "send as a gift"). It renders inside the
 * shared payment popup, so it reads the popup palette (--tw-*) with dark fallbacks.
 */

.tw-gift {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
    font-family: inherit;
}

.tw-gift [hidden] {
    display: none !important;
}

/* Visually hidden native inputs; the styled sibling carries the state. */
.tw-gift__switch-input,
.tw-gift__seg-item input,
.tw-gift__cover input,
.tw-gift__hide input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* ── Switch ─────────────────────────────────────────────────────────── */

.tw-gift__toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    padding: 11px 14px;
    border-radius: 12px;
    background: var(--tw-bg-inset, #151517);
    border: 1px solid var(--tw-border, #26262b);
    cursor: pointer;
}

.tw-gift__toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--tw-muted-2, #c9c9cf);
    font-size: 13px;
    font-weight: 700;
}

.tw-gift__switch {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: var(--tw-border-soft, #2c2c31);
    transition: background .3s;
}

.tw-gift__switch::after {
    content: '';
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: inset-inline-start .3s;
}

.tw-gift__switch-input:checked + .tw-gift__switch {
    background: var(--tw-grad, linear-gradient(110deg, var(--tw-brand), var(--tw-brand-2)));
}

.tw-gift__switch-input:checked + .tw-gift__switch::after {
    inset-inline-start: 23px;
}

.tw-gift__switch-input:focus-visible + .tw-gift__switch {
    box-shadow: 0 0 0 3px rgba(var(--tw-brand-rgb), .35);
}

/* ── Panel and steps ────────────────────────────────────────────────── */

.tw-gift__panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    background: var(--tw-bg-inset, #151517);
    border: 1px solid var(--tw-border, #26262b);
    animation: tw-gift-in .3s ease-out;
}

@keyframes tw-gift-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.tw-gift__steps {
    display: flex;
    gap: 6px;
}

.tw-gift__step {
    flex: 1;
    padding: 7px 4px;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, .4);
    color: var(--tw-muted, #8b8b93);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 800;
    cursor: pointer;
    transition: all .25s;
}

.tw-gift__step.is-active {
    color: #fff;
    background: var(--tw-grad, linear-gradient(110deg, var(--tw-brand), var(--tw-brand-2)));
}

.tw-gift__body {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

/* ── Live card ──────────────────────────────────────────────────────── */

.tw-gift__preview {
    position: relative;
    overflow: hidden;
    flex: 0 0 150px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 10px;
    border-radius: 16px;
    text-align: center;
    color: #fff;
    background-color: #1e1e21;
    background-position: center;
    background-size: cover;
    box-shadow: 0 14px 30px rgba(0, 0, 0, .35);
    transition: background .3s;
}

.tw-gift__preview-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, .15), rgba(0, 0, 0, .6));
}

.tw-gift__preview > :not(.tw-gift__preview-shade) {
    position: relative;
}

.tw-gift__preview-emoji {
    font-size: 34px;
}

.tw-gift__preview-msg {
    max-width: 100%;
    font-size: 14.5px;
    font-weight: 800;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.tw-gift__preview-from {
    font-size: 10px;
    font-weight: 700;
    opacity: .92;
}

.tw-gift__preview-brand {
    font-size: 9px;
    letter-spacing: 1px;
    opacity: .75;
}

/* ── Step content ───────────────────────────────────────────────────── */

.tw-gift__content {
    flex: 1;
    min-width: 230px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tw-gift__pane {
    display: none;
    flex-direction: column;
    gap: 10px;
}

.tw-gift__pane.is-active {
    display: flex;
    animation: tw-gift-in .3s ease-out;
}

.tw-gift__hint,
.tw-gift__label {
    color: var(--tw-muted, #8b8b93);
    font-size: 11.5px;
}

.tw-gift__seg {
    display: inline-flex;
    flex-wrap: wrap;
    align-self: flex-start;
    gap: 3px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .4);
}

.tw-gift__seg-item {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.tw-gift__seg > button,
.tw-gift__seg-item > span {
    display: block;
    padding: 5px 12px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--tw-muted, #8b8b93);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    transition: all .25s;
}

.tw-gift__seg > button.is-active,
.tw-gift__seg-item input:checked + span {
    color: #fff;
    background: #2c2c31;
}

.tw-gift__seg-item input:focus-visible + span {
    box-shadow: 0 0 0 2px rgba(var(--tw-brand-rgb), .5);
}

.tw-gift__covers {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.tw-gift__cover {
    position: relative;
    overflow: hidden;
    margin: 0;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all .2s;
}

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

.tw-gift__cover:has(input:checked) {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--tw-primary, var(--tw-brand));
}

.tw-gift__cover:has(input:focus-visible) {
    box-shadow: 0 0 0 2px rgba(var(--tw-brand-rgb), .6);
}

/* Theme tiles: same selectable grid as the old covers, a colour swatch + name instead of an image. */
.tw-gift__theme {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: rgba(0, 0, 0, .3);
}

.tw-gift__theme-swatch {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
}

.tw-gift__theme-swatch span {
    width: 20px;
    height: 20px;
    border-radius: 6px;
}

.tw-gift__theme-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--tw-muted-2, #c9c9cf);
    text-align: center;
}

body.lightMode .tw-gift__theme {
    background: rgba(24, 24, 40, .06);
}

.tw-gift__pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.tw-gift__pager button {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .4);
    color: var(--tw-muted-2, #c9c9cf);
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
}

.tw-gift__pager span {
    color: var(--tw-muted, #8b8b93);
    font-size: 11px;
    font-weight: 800;
}

.tw-gift__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tw-gift__chip {
    max-width: 100%;
    overflow: hidden;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--tw-border-strong, #3a3a40);
    background: transparent;
    color: var(--tw-muted-2, #c9c9cf);
    font-family: inherit;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.tw-gift__chip:hover {
    border-color: var(--tw-primary, var(--tw-brand));
    color: var(--tw-primary, var(--tw-brand));
}

.tw-gift textarea,
.tw-gift__input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 11px;
    border: 1px solid var(--tw-border-strong, #3a3a40);
    background: rgba(255, 255, 255, .05);
    color: var(--tw-text, #fff);
    font-family: inherit;
    font-size: 12.5px;
    outline: none;
    resize: none;
    transition: border-color .2s;
}

.tw-gift textarea:focus,
.tw-gift__input:focus,
.tw-gift__phone:focus-within {
    border-color: var(--tw-primary, var(--tw-brand));
}

.tw-gift__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tw-gift__row--stretch {
    flex-wrap: nowrap;
    align-items: stretch;
}

.tw-gift__row--stretch .tw-gift__input {
    flex: 1;
    min-width: 0;
}

.tw-gift__hide {
    position: relative;
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
}

.tw-gift__hide span {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid var(--tw-border-strong, #3a3a40);
    color: var(--tw-muted, #8b8b93);
    font-size: 10.5px;
    font-weight: 800;
    white-space: nowrap;
    transition: all .25s;
}

.tw-gift__hide input:checked + span {
    border-color: var(--tw-primary, var(--tw-brand));
    background: rgba(var(--tw-brand-rgb), .1);
    color: var(--tw-primary, var(--tw-brand));
}

.tw-gift__phone {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    border-radius: 11px;
    border: 1px solid var(--tw-border-strong, #3a3a40);
    background: rgba(255, 255, 255, .05);
}

.tw-gift__phone select {
    max-width: 96px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--tw-muted-2, #c9c9cf);
    font-family: inherit;
    font-size: 12px;
}

.tw-gift__phone select option {
    color: #16161a;
}

.tw-gift__phone input {
    flex: 1;
    min-width: 0;
    padding: 10px 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--tw-text, #fff);
    font-family: inherit;
    font-size: 12.5px;
}

.tw-gift__schedule-preview {
    margin: 4px 0 0;
    color: var(--tw-muted, #8b8b93);
    font-size: 11px;
}

.tw-gift__nav {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.tw-gift__back {
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid var(--tw-border-strong, #3a3a40);
    background: transparent;
    color: var(--tw-muted-2, #c9c9cf);
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.tw-gift__next {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 999px;
    background: var(--tw-grad, linear-gradient(110deg, var(--tw-brand), var(--tw-brand-2)));
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.tw-gift.is-ready .tw-gift__next {
    background: rgba(74, 222, 128, .14);
    color: var(--tw-ok, #4ade80);
}

.tw-gift__error {
    margin: 0;
    color: var(--tw-primary, var(--tw-brand));
    font-size: 11px;
}

.tw-gift__error:empty {
    display: none;
}

/* AirDatepicker renders on <body>; keep it above the payment popup. */
.gift-checkout-datetime-picker,
.air-datepicker-overlay {
    z-index: 1000002 !important;
}

/* ── Light theme ────────────────────────────────────────────────────── */

body.lightMode .tw-gift__step,
body.lightMode .tw-gift__seg,
body.lightMode .tw-gift__pager button {
    background: rgba(24, 24, 40, .07);
}

body.lightMode .tw-gift__seg > button.is-active,
body.lightMode .tw-gift__seg-item input:checked + span {
    background: #fff;
    color: #16161a;
    box-shadow: 0 1px 3px rgba(24, 24, 40, .15);
}

body.lightMode .tw-gift textarea,
body.lightMode .tw-gift__input,
body.lightMode .tw-gift__phone {
    background: #fff;
}

@media (max-width: 520px) {
    .tw-gift__preview {
        flex: 1 1 100%;
        min-height: 160px;
    }
}
