/**
 * Threecommerce Newsletter
 *
 * Layout for the extended subscribe form: first name + last name on one row,
 * then email, opt-in, GDPR consent (Amasty injects it before </form>, i.e.
 * after the button in the DOM) and finally the submit button.
 *
 * Scoped to the form id so it wins over the theme's class-based rules without
 * recompiling the theme LESS.
 */
#newsletter-validate-detail {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem 3%;
    width: 100%;
    max-width: 55rem;
    margin: 0 auto;
}

#newsletter-validate-detail .field {
    margin: 0;
    width: 100%;
    max-width: none;
    flex: 1 1 100%;
    text-align: left;
}

/* Name fields side by side */
#newsletter-validate-detail .field.firstname,
#newsletter-validate-detail .field.lastname {
    flex: 1 1 48%;
    max-width: 48%;
}

/* Vertical order (forces the button to the bottom, below the injected consent) */
#newsletter-validate-detail .field.firstname    { order: 1; }
#newsletter-validate-detail .field.lastname     { order: 2; }
#newsletter-validate-detail .field.email        { order: 3; }
#newsletter-validate-detail .field.opt-in       { order: 4; }
#newsletter-validate-detail .field.gdpr-consent { order: 5; }
#newsletter-validate-detail .field.amgdpr-checkbox { order: 6; flex: 1 1 100%; width: 100%; margin: .5rem 0 0; }
#newsletter-validate-detail .actions            { order: 7; flex: 1 1 100%; width: 100%; max-width: none; display: flex; justify-content: center; margin-top: .5rem; }

#newsletter-validate-detail .field .control {
    width: 100%;
    text-align: left;
    flex-grow: 1;
}

#newsletter-validate-detail .field .control > label {
    display: block;
    width: 100%;
}

#newsletter-validate-detail input[type="text"],
#newsletter-validate-detail input[type="email"] {
    width: 100%;
}

/* Checkbox rows: box and label on the same line, left aligned, error below */
#newsletter-validate-detail .field.choice .control,
#newsletter-validate-detail .field.amgdpr-checkbox {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: .4rem .8rem;
    text-align: left;
}

/*
 * The theme restyles every checkbox globally (extend/_forms_extend.less) with
 * an SVG icon plus a solid white background-color, and an inherited left
 * padding widens it into a white block. We keep the theme's SVG but drop the
 * white background and force a fixed size so it does not show as a white box
 * (and so the Amasty checkbox, which otherwise collapses to width:0, is shown).
 */
#newsletter-validate-detail .field.choice input[type="checkbox"],
#newsletter-validate-detail .amgdpr-checkbox input[type="checkbox"] {
    flex: 0 0 1.8rem;
    width: 1.8rem;
    min-width: 1.8rem;
    height: 1.8rem;
    padding: 0;
    margin: .2rem 0 0;
    background-color: transparent;
    box-sizing: border-box;
    order: 0;
}

#newsletter-validate-detail .field.choice label,
#newsletter-validate-detail .amgdpr-checkbox label {
    flex: 1 1 0;
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.4;
    text-align: left;
    text-transform: none;
}

/* Validation message always full width, below the checkbox/label row */
#newsletter-validate-detail .mage-error {
    flex: 1 1 100%;
    width: 100%;
    order: 10;
    margin: .3rem 0 0;
    text-align: left;
}

/*
 * Title / description spacing. Scoped by id so it wins over the active theme's
 * class-based rules regardless of which theme is rendered (theme-agnostic),
 * the same approach used above for the form fields.
 * Less space between the title and the description, more before the form.
 */
#newsletter-block-title {
    margin-bottom: 1rem;
}

#newsletter-block-description {
    display: block;
    max-width: 55rem;
    margin: 0 auto 4rem;
    text-align: center;
}
