/*
 * Twilio SMS consent layout — namespaced classes (sms-consent-*).
 * Logo appears only alongside SMS alerts consent (.sms-alerts-opt-in), not 2FA or generic steps.
 */

/*
 * Optional-phone SGT surfaces: keep SMS opt-in hidden until JS adds .sms-opt-in-shown
 * when the phone field has digits (prevents visible→hidden flash before document.ready).
 */
.sms-alerts-opt-in.sms-alerts-opt-in--phone-gated {
    display: none;
}

.sms-alerts-opt-in.sms-alerts-opt-in--phone-gated.sms-opt-in-shown {
    /* Bootstrap .hide uses !important; shown state must win after .hide is removed */
    display: block !important;
}

/*
 * Checkbox beside multi-line consent / terms copy — flex row, top-aligned with first line.
 * Replaces Bootstrap absolute positioning on .checkbox input (misaligns wrapped text).
 */
.sms-alerts-opt-in .checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding-left: 0;
}

.sms-alerts-opt-in .checkbox input[type="checkbox"] {
    position: static;
    margin: 0;
    margin-top: 0.25em;
    flex: 0 0 auto;
}

.sms-alerts-opt-in .sms-consent-text {
    flex: 1;
    min-width: 0;
}

.checkbox:has(input.account_terms_policy) {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding-left: 0;
}

.checkbox:has(input.account_terms_policy) input[type="checkbox"] {
    position: static;
    margin: 0;
    margin-top: 0.25em;
    flex-shrink: 0;
}

/*
 * Concierge SGT registration: SMS consent + account terms checkboxes share
 * the same flex row alignment (checkbox top-aligned with first line of copy).
 */
#chatbot_self_registration_form .sms-alerts-opt-in,
#chatbot_self_registration_form .concierge-sgt-terms-opt-in {
    float: none;
    width: 100%;
    clear: both;
    margin-bottom: 0;
}

#chatbot_self_registration_form .sms-alerts-opt-in .checkbox,
#chatbot_self_registration_form .concierge-sgt-terms-opt-in .checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding-left: 0;
    margin-top: 0;
    margin-bottom: 10px;
}

#chatbot_self_registration_form .sms-alerts-opt-in .checkbox input[type="checkbox"],
#chatbot_self_registration_form .concierge-sgt-terms-opt-in .checkbox input[type="checkbox"] {
    position: static;
    margin: 0.25em 0 0 0;
    flex: 0 0 auto;
}

#chatbot_self_registration_form .sms-alerts-opt-in .sms-consent-text,
#chatbot_self_registration_form .concierge-sgt-terms-opt-in .sms-consent-text {
    flex: 1;
    min-width: 0;
}

/* Warning shown when SGT consent checkboxes are not confirmed */
.sgt_sms_consent_warning_mt {
    margin-top: 15px;
}

.sgt-consent-warning {
    margin-top: 10px;
    margin-bottom: 0;
}

/* Default: hide logo unless a show-rule below matches */
.sms-consent-logo {
    display: none !important;
}

/* Dedicated consent footers (contact_info, lead capture, modals, etc.) */
.sms-consent-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    clear: both;
    float: none;
    padding: 10px 25px;
    box-sizing: border-box;
}

/* Bootstrap .clearfix pseudo-rows must not become flex items */
.sms-consent-action-bar.clearfix:before,
.sms-consent-action-bar.clearfix:after {
    content: none !important;
    display: none !important;
}

.sms-consent-action-bar .sms-consent-actions {
    flex: 0 0 auto;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    float: none;
}

/*
 * Legacy .w25 / .chatbot_registration_submit use percentage or 100% width.
 * Inside the flex action bar those collapse once the consent logo is shown.
 * Scheduler Next buttons (.self_a_tour_page_next / .self_schedule_page_next) are
 * handled separately below (loading-label width fix).
 */
.sms-consent-action-bar .sms-consent-actions .btn:not(.self_a_tour_page_next):not(.self_schedule_page_next),
.sms-consent-action-bar .sms-consent-actions .btnui,
.sms-consent-action-bar .sms-consent-actions button:not(.self_a_tour_page_next):not(.self_schedule_page_next) {
    width: auto;
    min-width: 100px;
    flex-shrink: 0;
}

/*
 * Scheduler Next/Pay only: inline width:35% + float:right breaks when JS sets
 * "Signing up ..." / "Processing...". Scoped to footers that contain those buttons.
 */
.sms-consent-action-bar:has(.self_a_tour_page_next) .sms-consent-actions,
.sms-consent-action-bar:has(.self_schedule_page_next) .sms-consent-actions {
    flex-wrap: nowrap;
}

.sms-consent-action-bar:has(.self_a_tour_page_next) .sms-consent-actions > div,
.sms-consent-action-bar:has(.self_schedule_page_next) .sms-consent-actions > div {
    float: none !important;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    max-width: 100%;
}

.sms-consent-action-bar:has(.self_a_tour_page_next) .sms-consent-actions > div > div,
.sms-consent-action-bar:has(.self_schedule_page_next) .sms-consent-actions > div > div {
    float: none !important;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    max-width: 100%;
}

.sms-consent-action-bar:has(.self_a_tour_page_next) .sms-consent-actions .pull-left,
.sms-consent-action-bar:has(.self_schedule_page_next) .sms-consent-actions .pull-left {
    float: none !important;
}

.sms-consent-action-bar:has(.self_a_tour_page_next) .sms-consent-actions #DigiCertClickID_1_qRt58j,
.sms-consent-action-bar:has(.self_schedule_page_next) .sms-consent-actions #DigiCertClickID_1_qRt58j {
    flex: 0 0 auto;
}

.sms-consent-action-bar .sms-consent-actions .self_a_tour_page_next,
.sms-consent-action-bar .sms-consent-actions .self_schedule_page_next {
    width: auto !important;
    min-width: 100px;
    max-width: 100%;
    flex-shrink: 0;
    float: none !important;
    margin-right: 0 !important;
    white-space: nowrap;
    box-sizing: border-box;
}

/*
 * Show logo: consent block and action bar are direct companions
 */
.sms-alerts-opt-in ~ .sms-consent-action-bar .sms-consent-logo,
.lead-capture-sms-consent ~ .sms-consent-action-bar .sms-consent-logo,
form:has(.sms-alerts-opt-in) .sms-consent-action-bar .sms-consent-logo,
.resheduleTourContainer:has(.sms-alerts-opt-in) > .sms-consent-action-bar .sms-consent-logo,
#contact_info:has(.sms-alerts-opt-in) .sms-consent-action-bar .sms-consent-logo {
    display: block !important;
    height: 36px;
    width: auto;
    flex: 0 0 auto;
    float: none;
}

/*
 * Wizard modal footers: logo only on the registration step that contains consent
 */
section.panel:has(#step1.active .sms-alerts-opt-in) ~ .modal-footer.sms-consent-action-bar .sms-consent-logo,
section.panel:has(.step-pane.active .sms-alerts-opt-in) ~ .sms-consent-action-bar .sms-consent-logo,
section.panel:has(.step-pane.active .sms-alerts-opt-in) ~ .modal-footer.sms-consent-action-bar .sms-consent-logo,
section:has(#step1.active .sms-alerts-opt-in) ~ .modal-footer.access_home_popup_footer .sms-consent-logo,
section.panel:has(#stepsr1.active .sms-alerts-opt-in) ~ .sms-consent-action-bar .sms-consent-logo,
section:has(#step_sh_1.active .sms-alerts-opt-in) ~ .modal-footer.share_property_popup_footer .sms-consent-logo,
.modal-content:has(#stepsr1.active .sms-alerts-opt-in) .service_request_popup_footer .sms-consent-logo,
section:has(.sms-alerts-opt-in) + .modal-footer.signup_popup_footer .sms-consent-logo,
.resheduleTour:has(.scheduleContactInfo:not(.hide) .sms-alerts-opt-in) .sms-consent-action-bar.self_tour_footer .sms-consent-logo,
.mfsheduleTour:has(.selftourwidgetTab3:not(.hide) #form-user-contact:not(.hide) .sms-alerts-opt-in) .sms-consent-action-bar.self_tour_footer .sms-consent-logo,
.resheduleTour:has(.scheduleContactInfo:not(.hide) .sms-alerts-opt-in) .sms-consent-action-bar .sms-consent-logo,
#agent_availability_section:has(.scheduleContactInfo:not(.hide) .sms-alerts-opt-in) .sms-consent-action-bar .sms-consent-logo {
    display: block !important;
    height: 36px;
    width: auto;
    flex: 0 0 auto;
    float: none;
}

/*
 * Standalone contact_info popup: consent block uses float:left in markup;
 * clear it so the action bar spans the full modal width (logo left, button right).
 */
#contact_info .scheduleContactInfo .schedule_guided_tour_registration_form::after,
.resheduleTourContainer .scheduleContactInfo .schedule_guided_tour_registration_form::after {
    content: "";
    display: block;
    clear: both;
}

#contact_info .scheduleContactInfo .schedule_guided_tour_registration_form > .custom-col-lg-12,
.resheduleTourContainer .scheduleContactInfo .schedule_guided_tour_registration_form > .custom-col-lg-12 {
    float: none !important;
    width: 100%;
    clear: both;
}

/*
 * Two-column scheduler contact forms: mirror external SGT registration alignment
 * (checkbox flush with left-column inputs; consent copy spans full form width).
 * Same left inset as .form-group.custom-col-lg-6 field rows above.
 */
.schedule_guided_tour_registration_form .form-group.custom-col-lg-6.sms-consent-column {
    float: none;
    width: 100%;
    clear: both;
    margin-bottom: 0;
}

/* Legacy full-width wrapper (pre sms-consent-column markup) */
.scheduleContactInfo .schedule_guided_tour_registration_form > .custom-col-lg-12:has(.sms-alerts-opt-in) {
    padding-left: 20px;
    box-sizing: border-box;
}

#contact_info .resheduleTourContainer > .sms-consent-action-bar,
.resheduleTour .resheduleTourContainer > .sms-consent-action-bar.self_tour_footer,
.resheduleTourContainer > .sms-consent-action-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100% !important;
    max-width: 100%;
    clear: both;
    float: none !important;
    box-sizing: border-box;
}

/*
 * contact_info.tpl (external SGT fallback / inactive SGT): footer is a sibling of
 * #parentContainer.col-lg-12, so it misses the column gutter that insets the form.
 * Match checkbox inset: col-lg-12 (15px) + scheduleContactInfo (5px) + col-md-12 (15px)
 * + custom-col-lg-6 (5px) = 40px.
 */
.resheduleTourContainer:has(.scheduleContactInfo .sms-alerts-opt-in) > .sms-consent-action-bar {
    padding-left: 40px;
}

#contact_info .resheduleTourContainer > .sms-consent-action-bar .sms-consent-actions,
.resheduleTour .resheduleTourContainer > .sms-consent-action-bar .sms-consent-actions {
    margin-left: auto;
}

/*
 * GT/VGT shared .self_tour_footer (without .sms-consent-action-bar on wrapper):
 * hide logo except on contact tab (tab 4). Scoped to tour sections only.
 */
#guided_tour_section .self_tour_footer:not(.sms-consent-action-bar) .sms-consent-logo,
#virtual_guided_tour_section .self_tour_footer:not(.sms-consent-action-bar) .sms-consent-logo {
    display: none !important;
}

#guided_tour_section #tabs:has(.scheduleTourTab4:not(.hide)) ~ .self_tour_footer:not(.sms-consent-action-bar),
#virtual_guided_tour_section #tabs:has(.scheduleTourTab4:not(.hide)) ~ .self_tour_footer:not(.sms-consent-action-bar) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    clear: both;
    padding: 10px 25px;
    box-sizing: border-box;
}

#guided_tour_section #tabs:has(.scheduleTourTab4:not(.hide)) ~ .self_tour_footer:not(.sms-consent-action-bar) .sms-consent-logo,
#virtual_guided_tour_section #tabs:has(.scheduleTourTab4:not(.hide)) ~ .self_tour_footer:not(.sms-consent-action-bar) .sms-consent-logo {
    display: block !important;
    height: 36px;
    width: auto;
    flex: 0 0 auto;
}

#guided_tour_section #tabs:has(.scheduleTourTab4:not(.hide)) ~ .self_tour_footer:not(.sms-consent-action-bar) .sms-consent-actions,
#virtual_guided_tour_section #tabs:has(.scheduleTourTab4:not(.hide)) ~ .self_tour_footer:not(.sms-consent-action-bar) .sms-consent-actions {
    flex: 0 0 auto;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

#guided_tour_section #tabs:has(.scheduleTourTab4:not(.hide)) ~ .self_tour_footer:not(.sms-consent-action-bar) .sms-consent-actions .btn,
#guided_tour_section #tabs:has(.scheduleTourTab4:not(.hide)) ~ .self_tour_footer:not(.sms-consent-action-bar) .sms-consent-actions button,
#virtual_guided_tour_section #tabs:has(.scheduleTourTab4:not(.hide)) ~ .self_tour_footer:not(.sms-consent-action-bar) .sms-consent-actions .btn,
#virtual_guided_tour_section #tabs:has(.scheduleTourTab4:not(.hide)) ~ .self_tour_footer:not(.sms-consent-action-bar) .sms-consent-actions button {
    width: auto;
    min-width: 100px;
    flex-shrink: 0;
}

/*
 * Self-scheduler booking page: logo only on the active registration step
 * (step-pane containing SMS consent), not on date/time, guest desires, or confirm.
 */
#self_scheduler_booking:has(.step-pane.active .sms-alerts-opt-in) ~ .sms-consent-action-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    clear: both;
    padding: 10px 25px;
    box-sizing: border-box;
}

#self_scheduler_booking:has(.step-pane.active .sms-alerts-opt-in) ~ .sms-consent-action-bar .sms-consent-logo {
    display: block !important;
    height: 36px;
    width: auto;
    flex: 0 0 auto;
    float: none;
}

#self_scheduler_booking:has(.step-pane.active .sms-alerts-opt-in) ~ .sms-consent-action-bar .sms-consent-actions {
    flex: 0 0 auto;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

#self_scheduler_booking:has(.step-pane.active .sms-alerts-opt-in) ~ .sms-consent-action-bar .sms-consent-actions .btn,
#self_scheduler_booking:has(.step-pane.active .sms-alerts-opt-in) ~ .sms-consent-action-bar .sms-consent-actions button {
    width: auto;
    min-width: 100px;
    flex-shrink: 0;
    float: none;
    margin-right: 0;
}

/*
 * SGT phone verification (Get Code): logo alongside 2FA Twilio consent checkbox only
 */
.mfsheduleTour:has(.selftourwidgetTab5:not(.hide) #getAuthCode1:not(.hide) .sms-2fa-opt-in) #getAuthCode1 .sms-consent-action-bar .sms-consent-logo,
#getAuthCode1:not(.hide):has(.sms-2fa-opt-in) .sms-consent-action-bar .sms-consent-logo {
    display: block !important;
    height: 36px;
    width: auto;
    flex: 0 0 auto;
    float: none;
}

/*
 * Sign-in on SGT registration tab: never show marketing consent logo in shared footer
 */
.mfsheduleTour:has(.selftourwidgetTab3:not(.hide) #form-signin:not(.hide)) .sms-consent-action-bar.self_tour_footer .sms-consent-logo {
    display: none !important;
}

/*
 * Concierge phone verification (question 69): checkbox + logo share grid column 1
 */
.concierge-sms-2fa-consent-stack {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 8px;
    align-items: start;
    margin-top: 15px;
    padding-left: 20px;
}

.concierge-sms-2fa-consent-stack .concierge-sms-2fa-checkbox {
    grid-column: 1;
    grid-row: 1;
    position: static !important;
    margin: 0.25em 0 0 0 !important;
}

.concierge-sms-2fa-consent-stack .concierge-sms-2fa-copy {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
}

.concierge-sms-2fa-consent-stack .concierge-sms-consent-logo-row {
    grid-column: 1;
    grid-row: 2;
    margin-top: 8px;
    padding: 0;
}

.concierge-sms-2fa-consent-stack .concierge-sms-consent-logo-row .sms-consent-logo,
.previousOptions:has(.concierge-sms-2fa-opt-in) .concierge-sms-consent-logo-row .sms-consent-logo {
    display: block !important;
    height: 36px;
    width: auto;
    margin: 0;
}
