#form_container{
    min-height: 180px !important;
    position: relative;
}

/* Prevent first-paint flicker of raw form before step container is ready */
#form_container > *{
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Reveal form content only after JS has switched to #joinform_step */
#form_container:has(#joinform_step) > *{
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Hide initial form while JS prepares/replaces the id */
#joinfrom,
#joinform{
    display: none !important;
}

/* Show the updated form id once JS switches to it */
#joinform_step{
    display: block !important;
}

/* Loading state shown by default while form id is still #joinfrom/#joinform */
#form_container::before{
    content: "";
    position: absolute;
    inset: 0;
    background-color: transparent;
    background-image: url("/images/loading.gif");
    background-repeat: no-repeat;
    background-position: center calc(50% - 14px);
    background-size: 52px 52px;
    z-index: 2;
}

#form_container::after{
    content: "Loading...";
    position: absolute;
    left: 50%;
    top: calc(50% + 34px);
    transform: translateX(-50%);
    color: #424242;
    font-size: 16px;
    font-weight: 600;
    z-index: 3;
}

/* When JS renames/replaces with #joinform_step, remove loading overlay */
#form_container:has(#joinform_step)::before{
    content: none;
}
#form_container:has(#joinform_step)::after{
    content: none;
}
.tf-form {
    position: relative;
}

.tf-question {
    margin-bottom: 30px;
    margin-top: 30px;
}

.tf-hidden {
    display: none !important;
}

.tf-question--active {
    display: block;
    
}

.tf-nav {
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

/* If Back isn't present, keep Next/Submit pinned right */
.tf-nav .tf-btn-next,
.tf-nav .tf-btn-submit {
    margin-left: auto;
}

.tf-btn {
    cursor: pointer;
    border: none;
    border-radius: 4px;
    padding: 10px 24px;
    font-size: 16px;
    line-height: 1.2;
    font-weight: 600;
    text-align: center;
    background-color: #0b7dda;
    color: #ffffff;
    transition: background-color 0.15s ease, box-shadow 0.15s ease,
        transform 0.1s ease;
}

.tf-btn:hover {
    background-color: #0a6cc0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

.tf-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.tf-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}
.tf-btn-next, .tf-btn-back{
    padding: 8px 14px;
    font-size: 16px;
}

@media (max-width: 576px) {
    .tf-nav {
        flex-direction: column;
        align-items: stretch;
        margin-top: 30px;
    }

    /* Next button full-width on mobile, shown first */
    .tf-nav .tf-btn-next {
        width: 100%;
        text-align: center;
        order: 1;
    }

    /* Back behaves like a small text link under Next */
    .tf-nav .tf-btn-back {
        order: 2;
        width: auto;
        align-self: flex;
        background: none;
        border: none;
        padding: 4px 0;
        font-size: 14px;
        color: #0b7dda;
        box-shadow: none;
        text-decoration: underline;
    }

    .tf-nav .tf-btn-back:hover {
        background: none;
        color: #0a60c0;
        box-shadow: none;
    }
}
.tf-btn-back {
    background-color: #e0e0e0;
    color: #333333;
}

.tf-btn-back:hover {
    background-color: #d4d4d4;
}

/* Question numbering (injected by JS via <span class="tf-qnum">) */
.tf-qnum{
    display: inline-block;
    margin-right: .4em;
    color: #fff;
    font-weight: 600;
    background-color: #2e2e2e;
    padding: 1px 6px;
    border-radius: 10px 3px;
}

/* Progress bar (renders into #tf-progress or [data-tf-progress]) */
.tf-progress{
    width:100%;
    padding:5px 3px;
}
.tf-progress__row{
    display:flex;
    flex-direction:column;
    gap:6px;
}
.tf-progress__segments{
    display:flex;
    align-items:center;
    gap:5px;
    width:100%;
}
.tf-progress__done{
    height:5px;
    background:#337ab7;
    border-radius:999px;
    transition:width .25s ease;
    min-width:0;
}
.tf-progress__remain{
    flex:1;
    height:5px;
    background:rgba(0,0,0,0.12);
    border-radius:999px;
    min-width:0;
}
.tf-progress__text{
    font-size:12px;
    line-height:1.2;
    color:#555;
}

.tf-error-message {
    margin-top: 8px;
    color: #8b271d;
    font-size: 13px;
    text-align: left;
}

.tf-input-error {
    border-color: #c0392b !important;
    box-shadow: 0px 2px 0px 0px #c0392b;
}

.tf-question--error .tf-question-label {
    color: #c0392b;
}

.subtemplate-wrapper{
    max-width: 100% !important;
}

.tf-question .txt{
    color: red !important;
}

.tf-form .tf-question .subtemplate-wrapper>label{
    margin-bottom: 15px !important;
}

.tf-form .tf-question label span{
    font-size: 18px !important;
}

.tf-form input[type="text"]{
    border: none !important;
    border-bottom: 0.5px solid #adbad7 !important;
    font-size: 17px !important;
    color:  #005fb6 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-top: 10px;
    outline: none !important;
    box-shadow: none !important;
    background-color: transparent;
}
.tf-form input[type="text"]:hover{
    border: none !important;
    border-bottom: 0.5px solid #1e79cf !important;
    color: #2784db !important;
}
.tf-form input[type="text"]:focus{
    border: none !important;
    border-bottom: 2px solid #1e79cf !important;
}

.tf-form .subtemplate-wrapper select{
    background-color: transparent !important;
    border: none !important;
    border-bottom: 0.5px solid #adbad7 !important;
    font-size: 17px !important;
    color:  #005fb6 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
.tf-form .subtemplate-wrapper select:hover{
    border-bottom: 0.5px solid #1e79cf !important;
    color: #2784db !important;
}
.tf-form .subtemplate-wrapper select:focus{
    border-bottom: 2px solid #1e79cf !important;
    color: #005fb6 !important;
}
.tf-form .subtemplate-wrapper textarea{
    border: none !important;
    border-bottom: 0.5px solid #adbad7 !important;
    font-size: 17px !important;
    color:  #005fb6 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    outline: none;
    box-shadow: none;
    margin-top: 10px;
}
.tf-form .subtemplate-wrapper textarea:hover{
    border-bottom: 0.5px solid #1e79cf !important;
    color: #2784db !important;
}
.tf-form .subtemplate-wrapper textarea:focus{
    border-bottom: 2px solid #1e79cf !important;
    color: #005fb6 !important;  
}

.tf-form .subtemplate-wrapper label.fb-option:not(:has(#require_consent1)) {
    display: block;
    position: relative;
    margin-bottom: 8px;
    padding: 10px 16px;
    padding-left: 44px;
    border-radius: 8px;
    background-color: #f3f7ff;
    color: #005fb6;
    font-size: 17px !important;
    line-height: 24px;
    cursor: pointer;
    border: 1px solid #e0ebff;
    transition: background-color 150ms ease, border-color 150ms ease,
        box-shadow 150ms ease, color 150ms ease;
}

.tf-form .subtemplate-wrapper label.fb-option:not(:has(#require_consent1)) > input[type="checkbox"],
.tf-form .subtemplate-wrapper label.fb-option:not(:has(#require_consent1)) > input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tf-form .subtemplate-wrapper label.fb-option:not(:has(#require_consent1))::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #9db7ff;
    background-color: #ffffff;
    box-sizing: border-box;
}

.tf-form .subtemplate-wrapper label.fb-option:not(:has(#require_consent1)):hover {
    background-color: #e8f2ff;
    border-color: #b3ccff;
}

.tf-form .subtemplate-wrapper label.fb-option:not(:has(#require_consent1)):has(> input[type="checkbox"]:checked),
.tf-form .subtemplate-wrapper label.fb-option:not(:has(#require_consent1)):has(> input[type="radio"]:checked) {
    background-color: #e3f0ff;
    border-color: #1e79cf;
    color: #0050a3;
    box-shadow: 0 0 0 1px #1e79cf;
}

.tf-form .subtemplate-wrapper label.fb-option:not(:has(#require_consent1)):has(> input[type="checkbox"]:checked)::before,
.tf-form .subtemplate-wrapper label.fb-option:not(:has(#require_consent1)):has(> input[type="radio"]:checked)::before {
    border-color: #1e79cf;
    background-image: radial-gradient(circle at center, #1e79cf 55%, transparent 56%);
}