/*
 * Wimakeit_FreeGift — plain CSS so it works on any Luma-based or Breeze theme.
 * A theme restyles it through the custom properties below; the defaults sit in
 * :where() so any theme rule wins, e.g.  :root { --wm-free-gift-accent: #0f766e; }
 */
:where(:root) {
    --wm-free-gift-accent: #1f2937;
    --wm-free-gift-accent-soft: #f3f4f6;
    --wm-free-gift-text: #111827;
    --wm-free-gift-muted: #6b7280;
    --wm-free-gift-border: #e5e7eb;
    --wm-free-gift-radius: 4px;
    --wm-free-gift-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='8' width='18' height='4' rx='1'/%3E%3Cpath d='M12 8v13M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7'/%3E%3Cpath d='M7.5 8a2.5 2.5 0 0 1 0-5C10 3 12 8 12 8s2-5 4.5-5a2.5 2.5 0 0 1 0 5'/%3E%3C/svg%3E");
    --wm-free-gift-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
}

/* Gift icon, drawn in the current text colour. */
.wm-free-gift-badge::before,
.wm-free-gift-cta__icon::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background-color: currentColor;
    -webkit-mask: var(--wm-free-gift-icon) center / contain no-repeat;
    mask: var(--wm-free-gift-icon) center / contain no-repeat;
}

/* ── "Your gift", a small label above the gift line ─────────────────── */
.wm-free-gift-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    color: var(--wm-free-gift-accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .05em;
    line-height: 1.4;
    text-transform: uppercase;
}

.wm-free-gift-badge::before {
    width: 14px;
    height: 14px;
}

/* ── "Choose my gift" above the cart ───────────────────────────────── */
.wm-free-gift-cta {
    display: grid;
    gap: 8px;
    margin: 0 0 24px;
}

.wm-free-gift-cta__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 12px 12px 14px;
    border: 1px solid var(--wm-free-gift-border);
    border-radius: var(--wm-free-gift-radius);
    background: #fff;
}

.wm-free-gift-cta__icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    padding: 10px;
    box-sizing: border-box;
    border-radius: 50%;
    background: var(--wm-free-gift-accent-soft);
    color: var(--wm-free-gift-accent);
}

.wm-free-gift-cta__text {
    flex: 1;
    min-width: 0;
    color: var(--wm-free-gift-text);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}

.wm-free-gift-cta__hint {
    display: block;
    color: var(--wm-free-gift-muted);
    font-size: 13px;
    font-weight: 400;
}

.wm-free-gift-cta__button.action.primary {
    flex: none;
    margin: 0;
    padding: 9px 18px;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
}

/* ── Popup ─────────────────────────────────────────────────────────── */
.wm-free-gift-dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    padding: 0;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 24px 64px rgba(17, 24, 39, .24);
    color: var(--wm-free-gift-text);
    overflow: auto;
}

.wm-free-gift-dialog::backdrop {
    background: rgba(17, 24, 39, .55);
}

.wm-free-gift-dialog[open] {
    animation: wm-free-gift-in .18s ease-out;
}

@keyframes wm-free-gift-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.wm-free-gift-dialog__header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px 24px 8px;
}

.wm-free-gift-dialog__title {
    flex: 1;
    margin: 0;
    color: var(--wm-free-gift-text);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
}

.wm-free-gift-dialog__close {
    flex: none;
    width: 32px;
    height: 32px;
    margin: -4px -6px 0 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    color: var(--wm-free-gift-muted);
    cursor: pointer;
}

.wm-free-gift-dialog__close::before {
    content: '';
    display: block;
    width: 18px;
    height: 18px;
    margin: auto;
    background-color: currentColor;
    -webkit-mask: var(--wm-free-gift-close) center / contain no-repeat;
    mask: var(--wm-free-gift-close) center / contain no-repeat;
}

.wm-free-gift-dialog__close:hover,
.wm-free-gift-dialog__close:focus-visible {
    background: var(--wm-free-gift-accent-soft);
    color: var(--wm-free-gift-text);
}

.wm-free-gift-dialog.is-required .wm-free-gift-dialog__close {
    display: none;
}

.wm-free-gift-dialog__body {
    padding: 8px 24px 24px;
}

.wm-free-gift-dialog__gifts {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.wm-free-gift-dialog__gift {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--wm-free-gift-border);
    border-radius: var(--wm-free-gift-radius);
    transition: border-color .15s ease;
}

.wm-free-gift-dialog__gift:hover {
    border-color: var(--wm-free-gift-accent);
}

.wm-free-gift-dialog__image {
    flex: none;
    width: 64px;
    height: 84px;
    object-fit: contain;
}

.wm-free-gift-dialog__info {
    flex: 1;
    min-width: 0;
}

.wm-free-gift-dialog__name {
    margin-bottom: 4px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.35;
}

.wm-free-gift-dialog__prices {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 14px;
}

.wm-free-gift-dialog__old-price {
    color: var(--wm-free-gift-muted);
    text-decoration: line-through;
}

.wm-free-gift-dialog__price {
    color: var(--wm-free-gift-accent);
    font-weight: 600;
}

.wm-free-gift-dialog__select.action.primary {
    flex: none;
    margin: 0;
    padding: 9px 18px;
    font-size: 14px;
    line-height: 1.2;
}

.wm-free-gift-dialog__select.is-loading {
    opacity: .6;
    cursor: progress;
}

.wm-free-gift-dialog__decline {
    display: block;
    margin: 18px auto 0;
    padding: 4px 8px;
    border: 0;
    background: none;
    box-shadow: none;
    color: var(--wm-free-gift-muted);
    font-size: 14px;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.wm-free-gift-dialog__decline:hover {
    background: none;
    color: var(--wm-free-gift-text);
}

.wm-free-gift-dialog__error {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: var(--wm-free-gift-radius);
    background: #fef2f2;
    color: #b91c1c;
    font-size: 14px;
}

@media (max-width: 639px) {
    .wm-free-gift-cta__item {
        flex-wrap: wrap;
    }

    .wm-free-gift-cta__button.action.primary {
        width: 100%;
    }

    .wm-free-gift-dialog__gift {
        flex-wrap: wrap;
    }

    .wm-free-gift-dialog__select.action.primary {
        width: 100%;
    }
}
