/**
 * @author andy
 * @email andyworkbase@gmail.com
 * @team MageCloud
 * @package MageCloud_MarketingOptOut
 */

/*
 * Brand colours can be set per theme by overriding these two custom properties, for example in the
 * swellreptiles theme CSS: .marketing-opt-out { --marketing-opt-out-tint: #eef6ee; }
 */
.marketing-opt-out,
.marketing-opt-out-express {
    --marketing-opt-out-tint: #f1f5f9;
    /* Matches the theme's primary action button (checkout "Next") */
    --marketing-opt-out-accent: #00b368;
}
body[class*="swellreptiles"] .marketing-opt-out,
body[class*="swellreptiles"] .marketing-opt-out-express {
    /* Matches the theme's primary action button (checkout "Next") */
    --marketing-opt-out-accent: #986bd2;
}

/* Checkout: notice and opt-out box under the email field */
.marketing-opt-out {
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
    max-width: 100%;
    margin: 10px 0 20px;
    padding: 16px;
    border-radius: 8px;
    background: var(--marketing-opt-out-tint);
    color: #1f2933;
}

.marketing-opt-out__notice {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.marketing-opt-out__choice {
    display: flex;
    gap: 12px;
    align-items: center;
}

.marketing-opt-out .marketing-opt-out__checkbox {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 0;
    position: static;
    opacity: 1;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    border: 2px solid #9aa5b1;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

/* Ticked: same background as the theme's primary action button, with a white tick */
.marketing-opt-out .marketing-opt-out__checkbox:checked {
    border-color: var(--marketing-opt-out-accent);
    background: var(--marketing-opt-out-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.marketing-opt-out .marketing-opt-out__checkbox:focus-visible {
    outline: 2px solid var(--marketing-opt-out-accent);
    outline-offset: 2px;
}

.marketing-opt-out .marketing-opt-out__label {
    margin: 0;
    padding: 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
}

/* Express checkout buttons (basket page, minicart, product page) */
.marketing-opt-out-express {
    clear: both;
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: #4b5563;
    text-align: center;
}

/* Product page: the theme's .box-tocart .actions is a flex column with buttons at order 2-3; keep the notice last */
.box-tocart .actions .marketing-opt-out-express {
    order: 4;
    text-align: left;
}

.marketing-opt-out-express a {
    white-space: nowrap;
}

/* Product page and minicart: make the opt-out link look clickable */
.box-tocart .marketing-opt-out-express a,
.block-minicart .marketing-opt-out-express a {
    text-decoration: underline;
    cursor: pointer;
}

/* /marketing/optout page */
.marketing-opt-out-page {
    max-width: 560px;
}

.marketing-opt-out-page .actions-toolbar {
    margin-top: 16px;
}
