/*
 * Lives in the full-width slot under the trigger product's row (see
 * `fullWidthSlot()` in gift-picker.js) — the same slot cart-item.js's
 * progress note uses, and replaces once the rule qualifies. Enters
 * collapsed; gift-picker.js adds `.stedox-fg-visible` and animates
 * `max-height` against the card's real height (inline style), then
 * releases the cap — so a fixed CSS cap never makes the transition run too
 * fast or snap at the end.
 */
.stedox-fg-picker {
    --stedox-fg-green: var(--gds-color-success, #2e7d32);
    --stedox-fg-green-dark: #1b5e20;
    --stedox-fg-green-light: var(--gds-color-success-light, #e8f5e8);
    --stedox-fg-ink: var(--gds-color-secondary-950, #1a2441);
    --stedox-fg-radius: 4px;

    overflow: hidden;
    max-height: 0;
    margin: 0;
    opacity: 0;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
}

.stedox-fg-picker.stedox-fg-visible {
    margin: 8px 0;
    opacity: 1;
}

.stedox-fg-picker-rule {
    padding: 12px;
    border: 1px solid #cfe8d0;
    border-radius: var(--stedox-fg-radius);
    background-color: var(--stedox-fg-green-light);
}

.stedox-fg-picker-rule.is-busy {
    cursor: progress;
}

.stedox-fg-picker-heading {
    margin: 0 0 8px;
    color: var(--stedox-fg-ink);
    font-size: 14px;
    font-weight: 700;
}

.stedox-fg-picker-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stedox-fg-picker-option {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--stedox-fg-green);
    border-radius: var(--stedox-fg-radius);
    background-color: #fff;
    color: var(--stedox-fg-ink);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    text-align: left;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.stedox-fg-picker-option:hover:not([aria-disabled="true"]) {
    border-color: var(--stedox-fg-green-dark);
    background-color: #dcefdc;
}

.stedox-fg-picker-option:focus-visible,
.stedox-fg-picker-cancel:focus-visible {
    outline: 2px solid var(--stedox-fg-ink);
    outline-offset: 2px;
}

/* Darker green on any tinted background keeps the 12px bold price above
   4.5:1. */
.stedox-fg-picker-option:hover:not([aria-disabled="true"]) .stedox-fg-picker-option-price,
.stedox-fg-picker-option:focus-visible .stedox-fg-picker-option-price,
.stedox-fg-picker-option.is-chosen .stedox-fg-picker-option-price {
    color: var(--stedox-fg-green-dark);
}

/* The current choice: an inset ring (no border-width change, so nothing
   shifts) plus a visible "Current" tag — colour alone isn't enough. */
.stedox-fg-picker-option.is-chosen {
    border-color: var(--stedox-fg-green-dark);
    box-shadow: inset 0 0 0 1px var(--stedox-fg-green-dark);
    background-color: #dcefdc;
}

.stedox-fg-picker-option-current {
    flex-shrink: 0;
    padding: 1px 6px;
    border-radius: var(--stedox-fg-radius);
    background-color: var(--stedox-fg-green-dark);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.stedox-fg-picker-option[aria-disabled="true"] {
    cursor: default;
    opacity: 0.6;
}

.stedox-fg-picker-option.is-choosing {
    opacity: 1;
}

.stedox-fg-picker-option img {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--stedox-fg-radius);
    background-color: #fff;
    object-fit: contain;
}

.stedox-fg-picker-option-name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
}

.stedox-fg-picker-option-price {
    margin-left: auto;
    color: var(--stedox-fg-green);
    font-weight: 700;
    white-space: nowrap;
}

/* "Keep current gift" — the way out of "Change your free gift" (Escape
   works too). */
.stedox-fg-picker-cancel {
    display: inline-block;
    min-height: 24px;
    margin-top: 8px;
    padding: 4px 0;
    border: none;
    background: none;
    color: var(--stedox-fg-ink);
    font: inherit;
    font-size: 12px;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.stedox-fg-picker-cancel:hover {
    color: var(--stedox-fg-green-dark);
}

.stedox-fg-picker-cancel[aria-disabled="true"] {
    cursor: default;
    opacity: 0.6;
}

.stedox-fg-picker-error {
    margin: 8px 0 0;
    color: #b32d2e;
    font-size: 12px;
}

/* Visually hidden, read by screen readers (the busy status). */
.stedox-fg-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .stedox-fg-picker,
    .stedox-fg-picker-option {
        transition: none;
    }
}
