﻿/* ==========================================================================
   THEME: Multi-Step
   File:        /_themes/_v2/split_panel_right_form/theme.css (to be changed)
   Load order:  AFTER webforms.core.css, BEFORE page.css
   Purpose:     Visual styling for the donation form: step indicator, inputs,
                selectable "card" buttons, primary/secondary buttons.
   Depends on:  webforms.core.css (base layout rules this file builds on)
   Variables (defined inline on :root by CharityEngine):
       --app-theme-font
       --app-theme-button-color
       --app-theme-button-font-color   

   CONTENTS
     1. Base
     2. Step indicator
     3. App container
     4. Form structure (sections, legends, rows)
     5. Text inputs, selects, textareas
     6. Selectable cards (shared look / hide native input / active + hover)
     7. Gift amount section
     8. Frequency toggle
     9. Payment type & tribute toggles
    10. Checkbox toggles & Back button
    11. Primary buttons
    12. Address entry
    13. Misc (DAF Pay, gift images, social sharing)
    14. States (errors)
   ========================================================================== */


/* ==========================================================================
   1. BASE
   ========================================================================== */

body {
    font-family: var(--app-theme-font);
}

a {
    font-size: 16px;
    font-weight: 400;
}

input[type="button"],
button {
    padding: 10px;
}


/* ==========================================================================
   2. STEP INDICATOR
   Built by theme.js (buildStepHeader) from the form's actual steps:
     - up to MAX_TRACKER_STEPS: numbered circles joined by lines
     - more than that: compact "Step X of N" text + progress bar (.compact)
   ========================================================================== */

#stepHeader {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2em;
    padding-inline: 16px;
}

    #stepHeader[hidden] {
        display: none;
    }

.step {
    flex: none;
    width: 30px;
    height: 30px;
    border: 1px solid var(--app-theme-button-color);
    border-radius: 100%;
    font-size: 16px;
    font-weight: 700;
    line-height: 30px;
    text-align: center;
}

    /* Completed step */
    .step.done {
        background-color: color-mix(in srgb, var(--app-theme-button-color) 40%, transparent);
    }

    /* Completed steps can be clicked to go back */
    .step.done {
        cursor: pointer;
    }

        .step.done:hover,
        .step.done:focus-visible {
            background-color: var(--app-theme-button-color);
            color: var(--app-theme-button-font-color);
        }

        .step.done:focus-visible {
            outline: 2px solid var(--app-theme-button-color);
            outline-offset: 2px;
        }

    /* Current step */
    .step.active {
        background-color: var(--app-theme-button-color);
        color: var(--app-theme-button-font-color);
        font-weight: bold;
    }

/* Connector line: shares leftover space, up to 60px */
.stepSpacer {
    flex: 1 1 0;
    min-width: 8px;
    max-width: 60px;
    height: 0;
    border-top: 1px solid var(--app-theme-button-color);
}

    .stepSpacer.done {
        border-top-width: 2px;
    }

/* Compact tracker (more than MAX_TRACKER_STEPS steps) */
#stepHeader.compact {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.stepProgressText {
    font-weight: 600;
    text-align: center;
}

.stepProgressBar {
    height: 6px;
    border-radius: 3px;
    background-color: color-mix(in srgb, var(--app-theme-button-color) 25%, transparent);
    overflow: hidden;
}

.stepProgressFill {
    width: 0;
    height: 100%;
    background-color: var(--app-theme-button-color);
    transition: width .25s ease;
}


/* ==========================================================================
   3. APP CONTAINER
   ========================================================================== */

#appContainer {
    margin-top: 40px;
    margin-inline: auto;
}


/* ==========================================================================
   4. FORM STRUCTURE
   Row/container/wrapper flex rules come from webforms.core.css; only the
   differences are set here.
   ========================================================================== */

.ce-forms fieldset:first-of-type {
    margin-top: 20px;
}

.ce-formSections,
#formLoginModal .ce-formLoginContainer {
    border: 0;
}

    /* Section titles */
    .ce-formSections legend {
        margin-top: .5em;
        margin-bottom: 8px;
        padding: 0;
        font-size: 2rem;
        font-weight: 600;
        text-align: center;
    }

    .ce-formSections:has(.ce-recurringFrequency) .ce-formSectionLegends {
        line-height: 1.2;
    }

/* Rows */
.ce-formRows {
    gap: 12px;
    margin-bottom: 12px;
}

/* Fields fill the available width. Content sits at the bottom, so when one
   label wraps onto extra lines the inputs in the same row still line up */
.ce-formFieldContainers,
.ce-formLoginRow {
    justify-content: flex-end;
    width: 100%;
}

/* Footer button group */
.ceFormFooterButtonContainers {
    text-align: center;
}


/* ==========================================================================
   5. TEXT INPUTS, SELECTS, TEXTAREAS
   ========================================================================== */

#formContainer input[type="text"],
#formContainer textarea,
#formContainer select,
#formLoginModal input[type="text"],
.ce-googleMapsAutocomplete {
    box-sizing: border-box;
    width: 100%;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
}

#formContainer select,
.ce-googleMapsAutocomplete {
    height: 40px;
}


/* ==========================================================================
   6. SELECTABLE CARDS
   Shared by: amount buttons, custom amount box, frequency toggle,
   payment-type toggle, tribute-announcement toggle.
   Order matters in this section: base look -> component variants -> states.
   ========================================================================== */

/* 6.1 Base look */
#tributeRecipientToggleRow .ce-radioButtonLists label,
#amountAskStringsContainer .ce-radioButtonLists label,
.ce-radioButtonLists.isPaymentType_id label,
.ce-radioButtonLists.ce-recurringFrequency label,
.ce-customAmountAskStringContainers {
    display: block;
    padding: 14px 16px;
    border: none;
    border-radius: 10px;
    background: white;
    box-shadow: 0 0 5px rgba(51, 63, 69, .25);
    font-size: 28px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
}

/* 6.2 Hide the native radio inputs (the label is the visible button) */
#tributeRecipientToggleRow .ce-radioButtonLists input,
#amountAskStringsContainer .ce-radioButtonLists input:not(.ce-customAmountAskStringInput),
.ce-radioButtonLists.isPaymentType_id input,
.ce-radioButtonLists.ce-recurringFrequency input {
    display: none;
}

    /* 6.3 Selected / hover state */
    #tributeRecipientToggleRow .ce-radioButtonLists input[type="radio"]:checked + label,
    #tributeRecipientToggleRow .ce-radioButtonLists input[type="radio"]:hover + label,
    #amountAskStringsContainer .ce-radioButtonLists input[type="radio"]:checked + label,
    #amountAskStringsContainer .ce-radioButtonLists input[type="radio"]:hover + label,
    .ce-radioButtonLists.isPaymentType_id input[type="radio"]:checked + label,
    .ce-radioButtonLists.isPaymentType_id input[type="radio"]:hover + label,
    .ce-radioButtonLists.ce-recurringFrequency input[type="radio"]:checked + label,
    .ce-radioButtonLists.ce-recurringFrequency input[type="radio"]:hover + label,
    .ce-forms input[type="text"].ce-amounts:hover,
    .ce-customAmountAskStringContainers:hover,
    .ce-customAmountAskStringContainers.selected,
    .ce-customAmountAskStringContainers:hover .ce-customAmountAskStringInput,
    .ce-customAmountAskStringContainers.selected .ce-customAmountAskStringInput {
        background-color: var(--app-theme-button-color);
        color: var(--app-theme-button-font-color);
    }


/* ==========================================================================
   7. GIFT AMOUNT SECTION
   ========================================================================== */

/* 7.1 Preset amount grid (3 per row) */
/* Size container: lets the amount buttons scale to the width of the form
   itself (cqi units), which differs between stacked and split-panel layouts */
.ce-amountAskStringButtonContainers {
    width: 100%;
    container-type: inline-size;
}

#amountAskStringsContainer .ce-radioButtonLists {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

    #amountAskStringsContainer .ce-radioButtonLists > span,
    .ce-customAmountAskStringContainers {
        flex: 0 0 calc(33.333% - 16px);
        min-width: 0;
    }

.ce-customAmountAskStringContainers {
    box-sizing: border-box;
}

/* Each preset label fills its grid cell, so buttons in the same row stay
   equal height even if a neighbor (e.g. the custom amount) is taller */
#amountAskStringsContainer .ce-radioButtonLists > span {
    display: flex;
}

    #amountAskStringsContainer .ce-radioButtonLists > span > label {
        flex: 1;
    }

/* 7.2 Amount button look (overrides the card base) */
#amountAskStringsContainer .ce-radioButtonLists label,
.ce-customAmountAskStringContainers {
    padding-top: .5em;
    padding-bottom: .5em;
    padding-inline: clamp(4px, 2.5cqi, 16px);
    background-color: color-mix(in srgb, var(--app-theme-button-color) 40%, transparent);
    line-height: 1.5;
    font-size: 2.25rem; /* fallback */
    /* --ask-fit (set by theme.js, 0.5 - 1) shrinks the amounts when a long one
       (e.g. $25.25) would not fit its card; unset = 1 = no change */
    font-size: calc(clamp(1.375rem, 7.5cqi, 2.25rem) * var(--ask-fit, 1));
}

.ce-askStringSubText {
    display: block;
    font-size: 14px; /* fallback */
    font-size: clamp(11px, 3.5cqi, 14px);
    font-weight: normal;
    opacity: .5;
}

/* 7.3 Custom amount input (inside the custom amount card) */
.ce-customAmountAskStringInput {
    display: block;
    height: 1.5em !important; /* follows the text; core sets a fixed 40px */
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background-color: unset !important;
    font-family: inherit !important; /* the card's font (inputs don't inherit it by default), so the number matches the symbol */
    font-size: 2.25rem !important; /* fallback */
    font-size: calc(clamp(1.375rem, 7.5cqi, 2.25rem) * var(--ask-fit, 1)) !important;
    font-weight: bold !important;
    line-height: 1.5 !important;
    text-align: center !important;
}

    .ce-customAmountAskStringInput:focus-visible {
        outline: none !important;
        border-radius: unset !important;
    }

    .ce-customAmountAskStringInput::placeholder,
    .ce-forms input[type="text"].ce-amounts::placeholder {
        font-weight: normal;
        opacity: .5;
    }

    .ce-customAmountAskStringInput:focus::placeholder,
    .ce-forms input[type="text"].ce-amounts:focus::placeholder {
        color: white;
    }

/* 7.3b Currency symbol inside the custom amount card.
   The card draws the symbol itself (::before, from the data-currency-symbol
   attribute set by theme.js), so it always sits next to the value and is never
   part of what the donor types. Empty card: the symbol is dimmed like the
   placeholder; once there is a value it turns solid.
   Layout (grid): symbol + input on one line that never wraps (a long value is
   clipped inside the input), the "One Time" / "Monthly" text on a line below.
   The two flexible outer columns center the pair; the text spans all columns,
   so it can never stretch the symbol/input columns apart. */
.ce-customAmountAskStringContainers {
    display: grid;
    grid-template-columns: auto 1fr; /* fallback, see below */
    align-items: baseline;
    cursor: text;
}

    .ce-customAmountAskStringContainers::before {
        content: attr(data-currency-symbol);
        grid-area: 1 / 1;
        font-weight: bold;
    }

    .ce-customAmountAskStringContainers:has(.ce-customAmountAskStringInput:placeholder-shown)::before {
        font-weight: normal;
        opacity: .5;
    }

    .ce-customAmountAskStringContainers .ce-customAmountAskStringInput {
        grid-area: 1 / 2;
        min-width: 0;
        text-align: left !important;
    }

    .ce-customAmountAskStringContainers > .ce-askStringSubText {
        grid-area: 2 / 1 / 3 / -1;
    }

/* Centered layout: the input shrinks to fit its value (or its placeholder when
   empty), so the symbol stays right next to the value and the pair is centered.
   (Browsers without field-sizing use the left-aligned fallback above.) */
@supports (field-sizing: content) {
    .ce-customAmountAskStringContainers {
        grid-template-columns: 1fr auto minmax(0, auto) 1fr;
    }

        .ce-customAmountAskStringContainers::before {
            grid-area: 1 / 2;
        }

        .ce-customAmountAskStringContainers .ce-customAmountAskStringInput {
            grid-area: 1 / 3;
            field-sizing: content;
            width: auto !important;
            min-width: 1ch;
            text-align: center !important;
        }
}

/* 7.4 Amount text field + currency selector */
.ce-forms input[type="text"].ce-amounts {
    margin: 0 8px;
    padding: 14px 16px;
    border-radius: 10px;
    background-color: color-mix(in srgb, var(--app-theme-button-color) 40%, transparent);
    font-size: 28px;
    font-weight: 600;
    text-align: center;
}

    .ce-forms input[type="text"].ce-amounts:focus-visible {
        outline: none !important;
    }

.ce-formFieldCurrencyPrefixes {
    display: none;
}

.ce-dropDownLists.ce-currencies {
    margin: 12px 8px 0;
}

/* 7.5 "Cover processing fee" row */
.ce-formSections:has(.ce-amounts):has(> #coverFeesDisplayRow) {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    column-gap: 12px;
}

    .ce-formSections:has(.ce-amounts):has(> #coverFeesDisplayRow) > .ce-formRows {
        flex: 1 1 100%;
    }

        .ce-formSections:has(.ce-amounts):has(> #coverFeesDisplayRow) > .ce-formRows:has(.ce-amounts) {
            display: contents;
        }

            .ce-formSections:has(.ce-amounts):has(> #coverFeesDisplayRow) > .ce-formRows:has(.ce-amounts) > .ce-formFieldContainers {
                margin-bottom: 12px;
            }

    .ce-formSections:has(.ce-amounts):has(> #coverFeesDisplayRow) > #coverFeesDisplayRow {
        flex: 0 1 auto;
        margin-bottom: 24px;
    }

/* replaces the script that added .amountRow */
.ce-formRows:has(> .ce-currencySelectorFormFieldContainers) {
    justify-content: center;
}


/* ==========================================================================
   8. FREQUENCY TOGGLE: always one row, joined segmented control
   Works for any number of options (2, 3, 4, ...). Never wraps, so the first
   and last options are always the rounded ends. Options shrink to share the
   row, and long labels wrap inside their own button on very narrow screens.
   ========================================================================== */

.ce-formRows:has(.ce-recurringFrequency) {
    margin-bottom: 30px;
}

.ce-radioButtonLists.ce-recurringFrequency {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0;
    width: 100%;
}

    /* Each option shares the row; min-width: 0 lets it shrink below its text width */
    .ce-radioButtonLists.ce-recurringFrequency > div {
        display: flex;
        flex: 1 1 auto;
        min-width: 0;
    }

    .ce-radioButtonLists.ce-recurringFrequency label {
        display: flex;
        flex: 1;
        align-items: center;
        justify-content: center;
        padding: 12px clamp(8px, 3vw, 20px);
        border-radius: 0;
        font-size: clamp(13px, 3.8vw, 16px);
        font-weight: bold;
        line-height: 1.3;
    }

    /* Round only the outer ends of the control */
    .ce-radioButtonLists.ce-recurringFrequency div:first-child input[type="radio"] + label {
        border-top-left-radius: 8px;
        border-bottom-left-radius: 8px;
    }

    .ce-radioButtonLists.ce-recurringFrequency div:last-child input[type="radio"] + label {
        border-top-right-radius: 8px;
        border-bottom-right-radius: 8px;
    }


/* ==========================================================================
   9. PAYMENT TYPE & TRIBUTE ANNOUNCEMENT TOGGLES
   ========================================================================== */

#tributeRecipientToggleRow .ce-radioButtonLists,
.ce-radioButtonLists.isPaymentType_id {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ce-radioButtonLists.isPaymentType_id {
    margin-inline: auto;
}

    #tributeRecipientToggleRow .ce-radioButtonLists > span,
    .ce-radioButtonLists.isPaymentType_id > div {
        display: block;
        flex: 1 1 auto;
    }

    #tributeRecipientToggleRow .ce-radioButtonLists label,
    .ce-radioButtonLists.isPaymentType_id label {
        justify-content: center;
        gap: 10px !important;
        padding: 15px 20px;
        font-size: 14px;
    }

/* 9.1 Payment step with nothing due (e.g. free tickets): keep the section title
   and the message, hide the payment fields. The classes are set by theme.js. */
.ce-formSections.ce-noPaymentDue > :not(legend):not(.ce-noPaymentDueMessages) {
    display: none !important;
}

.ce-noPaymentDueMessages {
    margin-bottom: 12px;
    text-align: center;
}


/* ==========================================================================
   10. CHECKBOX TOGGLES ("Dedicate this gift", "Add a Comment") & BACK BUTTON
   Outlined secondary-button look.
   ========================================================================== */

#dedicateGiftCheckBoxContainer,
#commentCheckBoxContainer {
    justify-content: center;
}

#dedicateGiftCheckBox input[type="checkbox"],
#commentCheckBox input[type="checkbox"] {
    display: none;
}

    #dedicateGiftCheckBox input[type="checkbox"] + label,
    #commentCheckBox input[type="checkbox"] + label,
    #formFooterBackBtn {
        appearance: button;
        padding: 6px 12px;
        border: 1px solid color-mix(in srgb, var(--app-theme-button-color) 40%, transparent);
        border-radius: 6px;
        background-color: white;
        font-size: 16px;
        font-weight: normal;
        text-align: center;
        cursor: pointer;
    }

        #dedicateGiftCheckBox input[type="checkbox"]:hover + label,
        #commentCheckBox input[type="checkbox"]:hover + label,
        #formFooterBackBtn:hover {
            background-color: color-mix(in srgb, var(--app-theme-button-color) 40%, transparent);
        }

#formFooterBackBtn {
    margin-top: 12px;
}


/* ==========================================================================
   11. PRIMARY BUTTONS (Next / Give / Start Over): pill shaped
   ========================================================================== */

.ceFormFooterButtonContainers button:not(#formFooterBackBtn),
#formFooterNextBtn,
.ce-primaryFormSubmitButtons,
#webFormStartOverButton {
    display: block;
    margin: auto;
    padding: .75em 2em;
    border: 1px solid var(--app-theme-button-color);
    border-radius: 50px;
    background-color: var(--app-theme-button-color);
    color: var(--app-theme-button-font-color);
    font-size: 1.25rem;
    font-weight: bold;
    line-height: 1.5;
    cursor: pointer;
}

    #formFooterNextBtn:hover,
    .ce-primaryFormSubmitButtons:hover,
    #webFormStartOverButton:hover {
        border-color: color-mix(in srgb, var(--app-theme-button-color) 40%, transparent);
        background-color: color-mix(in srgb, var(--app-theme-button-color) 40%, transparent);
    }


/* ==========================================================================
   12. ADDRESS ENTRY (Google Places single-line input)
   ========================================================================== */

.ce-singleLineAddressFieldWrappers {
    flex-wrap: wrap;
}

/* "add unit #" link-style button */
#contactAddressSingleLineEntryRowShowDetailsLink,
#tributeAddressSingleLineEntryRowShowDetailsLink {
    margin-top: 12px;
    padding: 0 !important;
    border: none;
    background: none !important;
    font-size: 16px;
    font-weight: 400;
    text-decoration: underline;
    text-transform: capitalize;
    cursor: pointer;
}


/* ==========================================================================
   13. MISC
   ========================================================================== */

/* Donor Advised Fund (DAFpay) button */
#dafPayButtonContainer {
    width: fit-content;
    margin: 0 auto;
}

/* Free gift item image */
.ce-freeGiftItemImagesContainers img {
    max-width: 250px;
}

/* ==========================================================================
   14. STATES
   ========================================================================== */

/* Error: overrides border/text color on any element with .error */
.error {
    border-color: #e84c3d !important;
    border-width: 2px !important;
    color: #e84c3d !important;
}
