/*
 * The contact form, on the front end.
 *
 * Loaded only on a page that actually shows the shortcode, and on the plugin
 * page for the preview beside the editor.
 *
 * Until 1.0.1 the form was written in Bootstrap classes — `row`, `col-6`,
 * `form-control`, `mb-3` — and the plugin never loaded Bootstrap on the front
 * end. It looked right on a theme that happened to load it, and came out as a
 * bare stack of unstyled inputs everywhere else.
 *
 * Everything here is scoped under `.syrus-ai-cf`, so nothing reaches the rest
 * of the page. The rules are deliberately quiet: the type is inherited from
 * the theme, the colours come from custom properties that a theme or a child
 * stylesheet can redefine on `.syrus-ai-cf`, and there is not one `!important`
 * in the file. The form should look like it belongs to the site, not like it
 * belongs to us.
 */

.syrus-ai-cf {
    --syrus-ai-cf-gap: 18px;
    --syrus-ai-cf-radius: 8px;
    --syrus-ai-cf-border: #c8ccd1;
    --syrus-ai-cf-border-focus: #0f6eb4;
    --syrus-ai-cf-accent: #0f6eb4;
    --syrus-ai-cf-accent-ink: #fff;
    --syrus-ai-cf-required: #b32d2e;
    --syrus-ai-cf-muted: #6b7177;

    margin: 0;
}

.syrus-ai-cf *,
.syrus-ai-cf *::before,
.syrus-ai-cf *::after {
    box-sizing: border-box;
}

/*
 * Two columns only where two fields can share a line: first and last name.
 * Everything else spans the grid, so the form reads as one column on a phone
 * without a media query.
 */
.syrus-ai-cf__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--syrus-ai-cf-gap);
}

.syrus-ai-cf__field--full {
    grid-column: 1 / -1;
}

@media (max-width: 480px) {
    .syrus-ai-cf__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.syrus-ai-cf__label {
    display: block;
    margin: 0 0 6px;
    font-size: inherit;
    font-weight: 600;
    line-height: 1.4;
}

.syrus-ai-cf__required {
    margin-left: 4px;
    color: var(--syrus-ai-cf-required);
}

.syrus-ai-cf__input,
.syrus-ai-cf__textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--syrus-ai-cf-border);
    border-radius: var(--syrus-ai-cf-radius);
    background-color: #fff;
    color: inherit;
    /* Inherited rather than set, so the form matches the body of the page. */
    font: inherit;
    line-height: 1.5;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.syrus-ai-cf__input:focus,
.syrus-ai-cf__textarea:focus {
    border-color: var(--syrus-ai-cf-border-focus);
    box-shadow: 0 0 0 1px var(--syrus-ai-cf-border-focus);
    outline: none;
}

.syrus-ai-cf__textarea {
    min-height: 120px;
    resize: vertical;
}

/* The consent line: the box beside the sentence, both on the same baseline. */
.syrus-ai-cf__consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.syrus-ai-cf__consent input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 3px 0 0;
}

.syrus-ai-cf__consent .syrus-ai-cf__label {
    margin: 0;
    font-weight: 400;
}

.syrus-ai-cf__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.syrus-ai-cf__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 22px;
    border: 1px solid transparent;
    border-radius: var(--syrus-ai-cf-radius);
    background-color: var(--syrus-ai-cf-accent);
    color: var(--syrus-ai-cf-accent-ink);
    font: inherit;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: opacity .15s ease;
}

.syrus-ai-cf__submit:hover,
.syrus-ai-cf__submit:focus {
    opacity: .88;
    color: var(--syrus-ai-cf-accent-ink);
}

/*
 * Disabled until the captcha answers. Without this the button looked exactly
 * like a working one and the first click did nothing.
 */
.syrus-ai-cf__submit[disabled] {
    opacity: .5;
    cursor: not-allowed;
}

.syrus-ai-cf__captcha {
    min-height: 65px;
}


/* -------------------------------------------------------------------------
 * The receipt on the thank-you page
 * ---------------------------------------------------------------------- */

/*
 * Printed by cpt-frontend.js with what was just submitted. It used to carry
 * Bootstrap classes too, one of them misspelled, and an id that began with a
 * `#`.
 */
.syrus-ai-cf-receipt {
    margin: 24px 0;
    padding: 18px 20px;
    border: 1px solid var(--syrus-ai-cf-border, #c8ccd1);
    border-radius: 8px;
    background-color: rgba(0, 0, 0, .02);
}

.syrus-ai-cf-receipt__title {
    margin: 0 0 10px;
    font-size: 1.05em;
    font-weight: 600;
    line-height: 1.3;
}

.syrus-ai-cf-receipt__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.syrus-ai-cf-receipt__list li {
    margin: 0 0 4px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.syrus-ai-cf-receipt__list li:last-child {
    margin-bottom: 0;
}

.syrus-ai-cf-receipt__label {
    font-weight: 600;
}


/* -------------------------------------------------------------------------
 * In the preview, beside the editor
 * ---------------------------------------------------------------------- */

/*
 * The preview renders the same template inside the plugin page, where the
 * white panel already provides the surround. Nothing to restyle, only the
 * accent, so the preview matches the screen it sits in.
 */
.syrus-ai-card__body .syrus-ai-cf {
    --syrus-ai-cf-accent: #0f6eb4;
}
