/* STFM Form Section (V2)
   Tokens come from STFMPageV2.css (:root) -- --stfm-primary, --stfm-secondary,
   --stfm-tertiary, --stfm-heading-font, --stfm-body-font.
   Every selector is namespaced .stfm-form* so nothing here can reach the V1
   STFM_Form.cshtml markup, which still renders under Bootstrap 4. */

.stfm-form-section {
    background-color: #ffffff;
    padding: 3rem 0;
}

/* --- Submitting state --------------------------------------------------- */

.stfm-form-submitting {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--stfm-primary);
    font-family: var(--stfm-heading-font);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
}

    .stfm-form-submitting i {
        color: var(--stfm-tertiary);
        font-size: 1.35rem;
    }

    .stfm-form-submitting[hidden] {
        display: none;
    }

.stfm-form.is-submitting {
    opacity: 0.4;
    pointer-events: none;
}

/* --- Heading ------------------------------------------------------------ */

.stfm-form-title {
    font-family: var(--stfm-heading-font);
    font-weight: 800;
    font-size: 1.75rem;
    color: var(--stfm-primary);
    margin-bottom: 0.75rem;
}

.stfm-form-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #444;
    margin-bottom: 1.5rem;
    max-width: 70ch;
}

/* --- Card --------------------------------------------------------------- */

.stfm-form-card {
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    padding: 2rem;
    max-width: 820px;
}

.stfm-form-honeypot {
    position: absolute;
    left: -9999px;
}

/* --- Error summary ------------------------------------------------------ */

.stfm-form-errors {
    background-color: #fdf2f3;
    border: 1px solid #f2c2c7;
    border-left: 4px solid #b02a37;
    border-radius: 8px;
    padding: 1.15rem 1.35rem;
    margin-bottom: 1.75rem;
}

.stfm-form-errors-title {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-family: var(--stfm-heading-font);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.45;
    color: #b02a37;
    margin: 0;
}

.stfm-form-errors-list {
    margin: 0.75rem 0 0;
    padding-left: 1.5rem;
    color: #842029;
    font-size: 0.92rem;
    line-height: 1.6;
}

/* --- Fields ------------------------------------------------------------- */

.stfm-form-fields {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

.stfm-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.stfm-form-fieldset {
    border: none;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.stfm-form-label {
    font-family: var(--stfm-body-font);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--stfm-primary);
    padding: 0;
    margin: 0;
}

.stfm-form-required {
    color: #b02a37;
    margin-left: 0.15rem;
}

.stfm-form-help {
    font-size: 0.85rem;
    font-style: italic;
    color: #6c757d;
    line-height: 1.45;
}

.stfm-form-control {
    width: 100%;
    font-family: var(--stfm-body-font);
    font-size: 1rem;
    color: var(--stfm-text);
    background-color: #ffffff;
    border: 1px solid var(--stfm-border-gray);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

    .stfm-form-control::placeholder {
        color: #8a949e;
    }

    .stfm-form-control:focus {
        outline: none;
        border-color: var(--stfm-tertiary);
        box-shadow: 0 0 0 3px rgba(0, 150, 210, 0.15);
    }

.stfm-form-textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.5;
}

.stfm-form-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%231d417b' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 14px;
    padding-right: 2.5rem;
}

/* --- Checkboxes and radios ---------------------------------------------- */

.stfm-form-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.35rem;
}

.stfm-form-options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem 1.25rem;
}

.stfm-form-option {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--stfm-text);
    cursor: pointer;
    margin: 0;
}

.stfm-form-option-single {
    margin-top: 0.2rem;
}

.stfm-form-check {
    flex-shrink: 0;
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.12rem;
    accent-color: var(--stfm-tertiary);
    cursor: pointer;
}

    .stfm-form-check:focus-visible {
        outline: 3px solid rgba(0, 150, 210, 0.4);
        outline-offset: 2px;
    }

.stfm-form-option-label {
    flex: 1;
}

/* --- Grouping separator ------------------------------------------------- */

.stfm-form-grouping {
    padding-top: 0.75rem;
    border-top: 2px solid rgba(0, 150, 210, 0.12);
}

    .stfm-form-grouping:first-child {
        padding-top: 0;
        border-top: none;
    }

.stfm-form-grouping-title {
    font-family: var(--stfm-heading-font);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--stfm-primary);
    margin: 0 0 0.4rem;
}

.stfm-form-grouping-help {
    font-size: 0.92rem;
    line-height: 1.6;
    color: #444;
}

    .stfm-form-grouping-help p:last-child {
        margin-bottom: 0;
    }

/* --- Actions ------------------------------------------------------------ */

.stfm-form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.stfm-form-submit {
    font-family: var(--stfm-heading-font);
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ffffff;
    background-color: var(--stfm-secondary);
    border: none;
    border-radius: 8px;
    padding: 0.85rem 3rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

    .stfm-form-submit:hover:not(:disabled) {
        background-color: #d97b1c;
        transform: translateY(-2px);
        box-shadow: 0 6px 18px rgba(239, 141, 43, 0.35);
    }

    .stfm-form-submit:focus-visible {
        outline: 3px solid rgba(239, 141, 43, 0.4);
        outline-offset: 2px;
    }

    .stfm-form-submit:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 767.98px) {
    .stfm-form-section {
        padding: 2rem 0;
    }

    .stfm-form-card {
        padding: 1.25rem;
    }

    .stfm-form-title {
        font-size: 1.4rem;
    }

    /* The multi-select grid is two-up at desktop; one column keeps long option
       labels readable on a phone. */
    .stfm-form-options-grid {
        grid-template-columns: 1fr;
    }

    .stfm-form-submit {
        width: 100%;
        padding: 0.85rem 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .stfm-form-submit:hover:not(:disabled) {
        transform: none;
    }
}
