/* Coupon drawer. Nudge cycle is 6.9s: a 6s rest, then four 225ms moves.
   20px of the handle stays off-screen so the 12px nudge and 14px hover pull never open a gap. */
.coupon-tab {
    --coupon-brand: #CC2121;
    --coupon-handle-visible: max(44px, 3rem);
    --coupon-handle-bleed: 20px;
    --coupon-handle-size: calc(var(--coupon-handle-visible) + var(--coupon-handle-bleed));
    --coupon-pull: 14px;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    overflow: hidden;
    pointer-events: none;
    container: coupon-tab / inline-size;
}

.coupon-tab *,
.coupon-tab *::before,
.coupon-tab *::after {
    box-sizing: border-box;
}

.coupon-tab__drawer {
    position: absolute;
    top: 50%;
    left: 0;
    display: flex;
    align-items: center;
    width: max-content;
    pointer-events: auto;
    transform: translate3d(calc(-100% + var(--coupon-handle-visible)), -50%, 0);
    transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
    animation: coupon-tab-nudge-left 6.9s ease-in-out infinite;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.22));
}

.coupon-tab__handle {
    position: relative;
    z-index: 2;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: var(--coupon-handle-size);
    min-width: calc(44px + var(--coupon-handle-bleed));
    min-height: 44px;
    padding: 0.85rem 0;
    border: 0;
    background: var(--coupon-brand);
    color: #F6D56A;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 0.2s ease;
}

.coupon-tab__icon {
    display: block;
    width: 1.65rem;
    height: 1.65rem;
}

.coupon-tab__panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    width: min(20rem, calc(100cqw - var(--coupon-handle-size) - 0.75rem));
    max-height: calc(100dvh - 8rem);
    overflow: hidden;
    background: #fff;
    color: #222;
    font-family: "Roboto", sans-serif;
    visibility: hidden;
    border-style: solid;
    border-color: var(--coupon-brand);
    border-width: 4px 4px 4px 0;
    border-radius: 0 12px 12px 0;
}

.coupon-tab.is-open .coupon-tab__panel,
.coupon-tab.is-closing .coupon-tab__panel {
    visibility: visible;
}

.coupon-tab__toolbar {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    padding: 0.25rem 0.25rem 0;
}

.coupon-tab__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 0.65rem;
    background: #fff;
    color: #333;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.coupon-tab__close:hover {
    background: rgba(204, 33, 33, 0.08);
    color: var(--coupon-brand);
}

.coupon-tab__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 1.15rem 1.25rem;
    -webkit-overflow-scrolling: touch;
}

.coupon-tab__heading {
    margin: 0 0 0.4rem;
    color: #111;
    font-size: 1.35rem;
    font-weight: 500;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.coupon-tab__form {
    margin: 0;
}

.coupon-tab__label {
    display: block;
    margin: 0;
    color: #555;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.coupon-tab__input {
    display: block;
    width: 100%;
    min-height: 44px;
    margin-top: 0.85rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid #e3e3e3;
    border-radius: 0.65rem;
    background: #fff;
    color: #222;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.4;
}

.coupon-tab__input:focus {
    border-color: var(--coupon-brand);
    outline: 2px solid var(--coupon-brand);
    outline-offset: 1px;
}

.coupon-tab__submit {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    width: 100%;
    min-height: 44px;
    margin-top: 0.85rem;
    padding: 0.55rem 0.9rem;
    border: 1px dashed var(--coupon-brand);
    border-radius: 0.7rem;
    background: #faf7f7;
    color: #333;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    cursor: not-allowed;
    opacity: 1;
}

.coupon-tab__submit-label,
.coupon-tab__soon {
    overflow-wrap: anywhere;
}

.coupon-tab__soon {
    color: var(--coupon-brand);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.coupon-tab__handle:focus-visible,
.coupon-tab__close:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -5px;
    box-shadow: inset 0 0 0 2px #111;
}

.coupon-tab__close:focus-visible {
    outline: 2px solid var(--coupon-brand);
    outline-offset: 2px;
    box-shadow: none;
}

.coupon-tab--left .coupon-tab__handle {
    margin-left: -4px;
    padding-left: var(--coupon-handle-bleed);
    border-radius: 0 0.9rem 0.9rem 0;
}

.coupon-tab--left .coupon-tab__panel {
    border-width: 4px 4px 4px 0;
    border-radius: 0 12px 12px 0;
}

.coupon-tab--right .coupon-tab__drawer {
    left: auto;
    right: 0;
    flex-direction: row-reverse;
    transform: translate3d(calc(100% - var(--coupon-handle-visible)), -50%, 0);
    animation-name: coupon-tab-nudge-right;
}

.coupon-tab--right .coupon-tab__handle {
    margin-right: -4px;
    padding-right: var(--coupon-handle-bleed);
    border-radius: 0.9rem 0 0 0.9rem;
}

.coupon-tab--right .coupon-tab__panel {
    border-width: 4px 0 4px 4px;
    border-radius: 12px 0 0 12px;
}

.coupon-tab--center .coupon-tab__drawer {
    top: 50%;
}

.coupon-tab.is-open .coupon-tab__drawer,
.coupon-tab.is-closing .coupon-tab__drawer,
.coupon-tab--left.is-open .coupon-tab__drawer,
.coupon-tab--right.is-open .coupon-tab__drawer,
.coupon-tab--left.is-closing .coupon-tab__drawer,
.coupon-tab--right.is-closing .coupon-tab__drawer {
    animation: none;
    transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.coupon-tab--left.is-open .coupon-tab__drawer,
.coupon-tab--right.is-open .coupon-tab__drawer {
    transform: translate3d(0, -50%, 0);
}

.coupon-tab--left.is-closing .coupon-tab__drawer {
    transform: translate3d(calc(-100% + var(--coupon-handle-visible)), -50%, 0);
}

.coupon-tab--right.is-closing .coupon-tab__drawer {
    transform: translate3d(calc(100% - var(--coupon-handle-visible)), -50%, 0);
}

.coupon-tab.is-pulled .coupon-tab__drawer,
.coupon-tab.is-pull-return .coupon-tab__drawer {
    animation: none;
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.coupon-tab--left.is-pulled .coupon-tab__drawer {
    transform: translate3d(calc(-100% + var(--coupon-handle-visible) + var(--coupon-pull)), -50%, 0);
}

.coupon-tab--right.is-pulled .coupon-tab__drawer {
    transform: translate3d(calc(100% - var(--coupon-handle-visible) - var(--coupon-pull)), -50%, 0);
}

.coupon-tab--left.is-pull-return .coupon-tab__drawer {
    transform: translate3d(calc(-100% + var(--coupon-handle-visible)), -50%, 0);
}

.coupon-tab--right.is-pull-return .coupon-tab__drawer {
    transform: translate3d(calc(100% - var(--coupon-handle-visible)), -50%, 0);
}

.coupon-tab.is-open .coupon-tab__drawer,
.coupon-tab.is-closing .coupon-tab__drawer {
    animation: none;
    transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.coupon-tab--left.is-open .coupon-tab__drawer,
.coupon-tab--right.is-open .coupon-tab__drawer {
    transform: translate3d(0, -50%, 0);
}

.coupon-tab--left.is-closing .coupon-tab__drawer {
    transform: translate3d(calc(-100% + var(--coupon-handle-visible)), -50%, 0);
}

.coupon-tab--right.is-closing .coupon-tab__drawer {
    transform: translate3d(calc(100% - var(--coupon-handle-visible)), -50%, 0);
}

@media (hover: hover) and (pointer: fine) {
    .coupon-tab__handle:hover {
        background: #b51e1e;
    }
}

@media (max-width: 991.98px) {
    .coupon-tab__panel {
        max-height: calc(100dvh - 9.5rem - env(safe-area-inset-bottom, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .coupon-tab__drawer,
    .coupon-tab--right .coupon-tab__drawer {
        animation: none;
        transition: none;
    }

    .coupon-tab.is-open .coupon-tab__drawer,
    .coupon-tab.is-closing .coupon-tab__drawer,
    .coupon-tab--left.is-open .coupon-tab__drawer,
    .coupon-tab--right.is-open .coupon-tab__drawer,
    .coupon-tab--left.is-closing .coupon-tab__drawer,
    .coupon-tab--right.is-closing .coupon-tab__drawer,
    .coupon-tab.is-pulled .coupon-tab__drawer,
    .coupon-tab.is-pull-return .coupon-tab__drawer,
    .coupon-tab--left.is-pulled .coupon-tab__drawer,
    .coupon-tab--right.is-pulled .coupon-tab__drawer,
    .coupon-tab--left.is-pull-return .coupon-tab__drawer,
    .coupon-tab--right.is-pull-return .coupon-tab__drawer {
        transition: none;
    }
}

@keyframes coupon-tab-nudge-left {
    0%,
    86.9565%,
    93.4783%,
    100% {
        transform: translate3d(calc(-100% + var(--coupon-handle-visible)), -50%, 0);
    }

    90.2174%,
    96.7391% {
        transform: translate3d(calc(-100% + var(--coupon-handle-visible) + 12px), -50%, 0);
    }
}

@keyframes coupon-tab-nudge-right {
    0%,
    86.9565%,
    93.4783%,
    100% {
        transform: translate3d(calc(100% - var(--coupon-handle-visible)), -50%, 0);
    }

    90.2174%,
    96.7391% {
        transform: translate3d(calc(100% - var(--coupon-handle-visible) - 12px), -50%, 0);
    }
}
