/* ============================================================================
   CAS Forms — form card styles. Self-contained; no ancestor required.
   Tokens (--rl-blue, --rl-green) inherit from .rl-page when present;
   fallbacks are inlined at each var() call so raw-HTML landings work too.
   The `.rl-form input.rl-form__input` selector matches specificity (0,2,1)
   of the theme's `.new_page input[type=text]` rule and wins via cascade
   order (plugin CSS enqueues after theme CSS).
   ============================================================================ */

.rl-form-card {
    background-color: #ffffff;
    border-radius: 24px;
    box-sizing: border-box;
    /* Force light UA defaults for inner form controls. Without this, hosts that
       declare a dark color-scheme (or whose body uses dark bg/light text — e.g.
       cas_landing rendered with the caards theme's main.css) make the browser
       paint password inputs dark, which leaks through our `background: transparent`
       on .rl-form__pw-wrap input. */
    color-scheme: light;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-left: auto;
    margin-right: auto;
    max-width: 750px;
    padding: 48px;
    position: relative;
    width: 100%;
    z-index: 3;
}

.rl-form-card__shadow {
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px #00000033;
    height: 100%;
    left: 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: 100%;
}

/* Form layout */
.rl-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.rl-form__heading {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 4px;
}

.rl-form__title {
    color: #131313;
    font-family: "Montserrat", sans-serif;
    font-size: clamp(1rem, 1.04vw, 1.5rem);
    font-weight: 700;
    line-height: 1;
    margin: 0;
}

.rl-form__sub {
    color: #767676;
    font-family: "Raleway", sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1;
    margin: 0;
}

.rl-form__row {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr 1fr;
}

.rl-form__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Inputs — shared base.
   .rl-form input.rl-form__input (specificity 0,2,1) ties with the theme's
   .new_page input[type="text"] { border-radius: 0 } and wins via cascade
   order (plugin CSS enqueues after theme CSS). */
.rl-form input.rl-form__input {
    appearance: none;
    -webkit-appearance: none;
    background-color: #f9fafb80;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-sizing: border-box;
    color: #131313;
    font-family: "Raleway", sans-serif;
    font-size: 1rem;
    font-weight: 500;
    height: 50px;
    outline: none;
    padding: 0 24px;
    transition: border-color 0.15s;
    width: 100%;
}

.rl-form input.rl-form__input::placeholder {
    color: #a4a4a4;
}

.rl-form input.rl-form__input:focus {
    border-color: var(--rl-blue, #0172fd);
}

.rl-form input.rl-form__input.is-invalid {
    border-color: #c93227;
    background-color: #fff0f0;
}

.rl-form input.rl-form__input.is-valid {
    border-color: var(--rl-blue, #0172fd);
    background-color: #e8f0fe;
}

/* Password wrap */
.rl-form__pw-wrap {
    align-items: center;
    background-color: #f9fafb80;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-sizing: border-box;
    display: flex;
    gap: 8px;
    height: 50px;
    padding: 0 16px;
    position: relative;
    transition: border-color 0.15s;
}

.rl-form__pw-wrap:focus-within {
    border-color: var(--rl-blue, #0172fd);
}

.rl-form__pw-wrap.is-valid {
    border-color: var(--rl-blue, #0172fd);
    background-color: #e8f0fe;
}

.rl-form__pw-wrap.is-invalid {
    border-color: #c93227;
    background-color: #fff0f0;
}

/* Specificity 0,2,1 to outweigh the theme's generic
   input[type="password"] rule (0,1,1) which sets a dark bg via CSS vars
   on the caards theme. Without this, the input paints over the wrap and
   shows as a black box on cas_landing pages. */
.rl-form__pw-wrap input.rl-form__pw-input {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    color: #131313;
    flex: 1;
    font-family: "Raleway", sans-serif;
    font-size: 1rem;
    font-weight: 500;
    height: 100%;
    outline: none;
    padding: 0;
    width: 100%;
}

.rl-form__pw-wrap input::placeholder {
    color: #a4a4a4;
}

.rl-form__pw-wrap input:-webkit-autofill,
.rl-form__pw-wrap input:-webkit-autofill:hover,
.rl-form__pw-wrap input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #f9fafb inset;
    -webkit-text-fill-color: #131313;
}

/* Password visibility toggle (rf-eye-open/closed icons toggled by form.js) */
.rl-form__pw-toggle {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.5;
    padding: 4px;
    transition: opacity 0.15s;
}

.rl-form__pw-toggle:hover {
    opacity: 1;
}

.rl-form__pw-toggle .rf-eye-open {
    display: none;
}

.rl-form__pw-toggle[aria-pressed="true"] .rf-eye-closed {
    display: none;
}

.rl-form__pw-toggle[aria-pressed="true"] .rf-eye-open {
    display: block;
}

/* Messenger picker — rf-* classes wired up by form.js */
.rl-form__messenger-wrap {
    position: relative;
    width: 100%;
}

/* Override rf-* sizing for this form */
.rl-form__messenger-wrap .rf-messenger-picker {
    align-items: stretch;
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
}

.rl-form__messenger-wrap .rf-messenger-trigger {
    background-color: #f9fafb80;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    color: #131313;
    font-size: 1rem;
    height: 50px;
    width: 140px;
    gap: 0.5rem;
}

.rl-form__messenger-wrap .rf-messenger-trigger:hover,
.rl-form__messenger-wrap .rf-messenger-select.is-open .rf-messenger-trigger {
    border-color: var(--rl-blue, #0172fd);
    z-index: 1;
}

.rl-form__messenger-wrap .rf-contact-inputs {
    flex: 1;
}

.rl-form__messenger-wrap .rf-contact-inputs .rf-input,
.rl-form__messenger-wrap .rf-contact-inputs .rf-contact-text,
.rl-form__messenger-wrap .rf-contact-inputs .rf-contact-phone {
    appearance: none;
    -webkit-appearance: none;
    background-color: #f9fafb80;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-sizing: border-box;
    color: #131313;
    font-family: "Raleway", sans-serif;
    font-size: 1rem;
    font-weight: 500;
    height: 50px;
    outline: none;
    padding: 0 24px;
    transition: border-color 0.15s;
    width: 100%;
}

.rl-form__messenger-wrap .rf-contact-inputs .rf-contact-text,
.rl-form__messenger-wrap .rf-contact-inputs .rf-contact-phone {
    display: none;
}

.rl-form__messenger-wrap .rf-contact-inputs .rf-contact-text.active {
    display: block;
}

.rl-form__messenger-wrap .rf-contact-inputs .rf-contact-phone.active {
    display: block;
}

/* intlTelInput wraps rf-contact-phone in .iti — constrain it */
.rl-form__messenger-wrap .rf-contact-inputs .iti {
    display: none;
    min-width: 0;
    width: 100%;
}

.rl-form__messenger-wrap .rf-contact-inputs .iti.active {
    display: block;
}

.rl-form__messenger-wrap .rf-contact-inputs .iti input,
.rl-form__messenger-wrap .rf-contact-inputs .iti .iti__phone-input {
    border-radius: 12px;
    box-sizing: border-box;
    height: 50px;
    padding-left: 58px; /* 48px flag button + 10px gap */
    width: 100%;
}

.rl-form__messenger-wrap .rf-contact-inputs .rf-input:focus,
.rl-form__messenger-wrap .rf-contact-inputs .rf-contact-text:focus,
.rl-form__messenger-wrap .rf-contact-inputs .rf-contact-phone:focus {
    border-color: var(--rl-blue, #0172fd);
}

.rl-form__messenger-wrap .rf-contact-inputs .rf-input::placeholder,
.rl-form__messenger-wrap .rf-contact-inputs .rf-contact-text::placeholder,
.rl-form__messenger-wrap .rf-contact-inputs .rf-contact-phone::placeholder {
    color: #a4a4a4;
}

.rl-form__messenger-wrap .rf-messenger-dropdown {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px #00000018;
    display: none;
    left: 0;
    list-style: none;
    margin: 0;
    min-width: 160px;
    padding: 6px;
    position: absolute;
    top: calc(100% + 4px);
    z-index: 200;
}

.rl-form__messenger-wrap .rf-messenger-select.is-open .rf-messenger-dropdown {
    display: block;
}

.rl-form__messenger-wrap .rf-messenger-option {
    align-items: center;
    border-radius: 8px;
    color: #131313;
    cursor: pointer;
    display: flex;
    font-family: "Raleway", sans-serif;
    font-size: 1rem;
    gap: 8px;
    padding: 8px 10px;
    transition: background-color 0.12s;
}

.rl-form__messenger-wrap .rf-messenger-option:hover {
    background: #f3f4f6;
}

.rl-form__messenger-wrap .rf-messenger-option.is-selected {
    color: var(--rl-blue, #0172fd);
}

/* Hint + error */
.rl-form__hint {
    color: #9ca3af;
    font-family: "Raleway", sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    margin: 0;
    padding: 0 2px;
}

.rl-form__hint.is-invalid {
    color: #c93227;
}

.rl-form__error {
    color: #c93227;
    font-family: "Raleway", sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0;
    padding: 0 10px;
}

.rl-form__error[hidden] {
    display: none;
}

/* Interest checkboxes (multi-select). Mirrors privacy checkbox styling but
   in a horizontal group with its own label above. */
.rl-form__interest-label {
    color: #131313;
    font-family: "Raleway", sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    margin: 0 0 4px;
}

.rl-form__interest-options {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.rl-form__interest-option {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 8px;
}

.rl-form__interest-option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    border: 1px solid #767676;
    border-radius: 2.5px;
    cursor: pointer;
    flex-shrink: 0;
    height: 16px;
    position: relative;
    transition: background-color 0.15s, border-color 0.15s;
    width: 16px;
}

.rl-form__interest-option input[type="checkbox"]:checked {
    background-color: var(--rl-blue, #0172fd);
    border-color: var(--rl-blue, #0172fd);
}

.rl-form__interest-option input[type="checkbox"]:checked::after {
    border: 2px solid #fff;
    border-left: none;
    border-top: none;
    content: '';
    height: 9px;
    left: 4px;
    position: absolute;
    top: 1px;
    transform: rotate(45deg);
    width: 5px;
}

.rl-form__interest-option span {
    color: #4b5563;
    font-family: "Raleway", sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
}

/* Privacy */
.rl-form__privacy {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 8px;
}

.rl-form__privacy input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    border: 1px solid #767676;
    border-radius: 2.5px;
    cursor: pointer;
    flex-shrink: 0;
    height: 16px;
    position: relative;
    transition: background-color 0.15s, border-color 0.15s;
    width: 16px;
}

.rl-form__privacy input[type="checkbox"]:checked {
    background-color: var(--rl-blue, #0172fd);
    border-color: var(--rl-blue, #0172fd);
}

.rl-form__privacy input[type="checkbox"]:checked::after {
    border: 2px solid #fff;
    border-left: none;
    border-top: none;
    content: '';
    height: 9px;
    left: 4px;
    position: absolute;
    top: 1px;
    transform: rotate(45deg);
    width: 5px;
}

.rl-form__privacy input[type="checkbox"].is-invalid {
    border-color: #c93227;
    background-color: #fff0f0;
}

.rl-form__privacy-text {
    color: #767676;
    font-family: "Raleway", sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.5;
}

.rl-form__privacy-link {
    color: var(--rl-blue, #0172fd);
    font-size: 0.8rem;
    text-decoration: underline;
}

/* Submit button */
.rl-form__submit {
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--rl-blue, #0172fd);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    height: 46px;
    justify-content: center;
    position: relative;
    transition: opacity 0.15s, background-color 0.2s;
    width: 100%;
}

.rl-form__submit:hover {
    opacity: 0.9;
}

.rl-form__submit:active {
    opacity: 0.8;
}

.rl-form__submit:disabled {
    background-color: #969ea9;
    cursor: not-allowed;
    pointer-events: none;
}

/* Spinner + text (reuse rf-btn-* for JS compatibility) */
.rl-form__submit .rf-btn-text {
    color: #ffffff;
    font-family: "Raleway", sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.1;
    position: relative;
    transition: opacity 0.18s, transform 0.18s;
    white-space: nowrap;
}

.rl-form__submit .rf-btn-spinner {
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    height: 20px;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transition: opacity 0.18s;
    width: 20px;
}

.rl-form__submit.is-loading .rf-btn-text {
    opacity: 0;
    transform: scale(0.8);
}

.rl-form__submit.is-loading .rf-btn-spinner {
    animation: rl-spin 0.72s linear infinite;
    opacity: 1;
}

@keyframes rl-spin {
    to {
        transform: rotate(360deg);
    }
}

.rl-form__submit.is-loading:disabled {
    background-color: var(--rl-blue, #0172fd);
    cursor: default;
    pointer-events: none;
}

/* Messages */
.rl-form__success {
    color: var(--rl-blue, #0172fd);
    font-family: "Raleway", sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    text-align: center;
}

.rl-form__success[hidden] {
    display: none;
}

.rl-form__ajax-error {
    color: #c93227;
    font-family: "Raleway", sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0;
    text-align: center;
}

.rl-form__ajax-error[hidden] {
    display: none;
}

/* reCAPTCHA v3 — hide Google's floating badge; we render an in-form
   disclaimer (.rl-form__recaptcha-disclaimer) per Google ToS instead. */
.grecaptcha-badge {
    visibility: hidden;
}

.rl-form__recaptcha-disclaimer {
    color: #767676;
    font-family: "Raleway", sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    margin: -4px 0 0;
    text-align: center;
}

.rl-form__recaptcha-disclaimer a {
    color: var(--rl-blue, #0172fd);
    text-decoration: underline;
}

/* Responsive — form-specific overrides relocated from referral-landing.css */
@media (max-width: 900px) {
    .rl-form__row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .rl-form__row {
        grid-template-columns: 1fr;
    }

    .rl-form-card {
        padding: 24px 20px;
    }
}
