﻿/* Lead-form modals: cap height to viewport; scroll body; keep header/footer visible.
   Sit above the theme's sticky page-head row, which uses z-index: 999999 (see
   PageHead.ascx .sticky-row). The matching backdrop elevation is scoped to a
   body class added by themes.js when a lead-form modal opens, so we don't
   disturb the z-index of other modals on the page. */
.modal-lead-form {
    z-index: 1000050 !important;
}

body.modal-lead-form-open .modal-backdrop,
body.modal-lead-form-open .modal-backdrop.in {
    z-index: 1000040 !important;
}

/* Preserve page scroll when Bootstrap sets body.modal-open { overflow: hidden }.
   Default.css sets html/body to position:absolute + overflow:auto — lock body only.
   Do not set html height:100%; that clips the fixed body when scrolled down. */
html.modal-lead-form-scroll-lock {
    overflow: hidden !important;
}

body.modal-lead-form-scroll-lock {
    position: fixed !important;
    width: 100%;
    left: 0;
    right: 0;
    overflow: hidden !important;
    box-sizing: border-box;
}

body.modal-lead-form-scroll-lock.modal-open {
    overflow: hidden !important;
}

.modal-lead-form > .modal-dialog {
    margin: 30px auto;
    max-height: calc(100vh - 60px);
    width: auto;
    max-width: 600px;
}

/* Standard markup: .modal-dialog > .modal-content */
.modal-lead-form > .modal-dialog > .modal-content {
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Vehicle Links nested markup: .modal-dialog > form > .modal-content > .modal-dialog > .modal-content */
.modal-lead-form > .modal-dialog > form > .modal-content {
    max-height: none;
    display: block;
    overflow: visible;
    border: none;
    box-shadow: none;
}

.modal-lead-form > .modal-dialog > form > .modal-content > .modal-dialog {
    margin: 0;
    max-height: none;
    width: 100%;
}

.modal-lead-form > .modal-dialog > form > .modal-content > .modal-dialog > .modal-content {
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-lead-form .modal-header,
.modal-lead-form .modal-footer {
    flex-shrink: 0;
}

.modal-lead-form .modal-body {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    word-wrap: break-word;
}

.modal-lead-form .RequestForm,
.modal-lead-form .askRequestForm,
.modal-lead-form .scheduleRequestForm {
    overflow: visible;
}

.modal-lead-form .form-legal-consent {
    font-size: inherit;
    line-height: inherit;
}

.modal-lead-form .form-legal-consent label {
    font-weight: normal;
}

@media (max-width: 767px) {
    .modal-lead-form > .modal-dialog {
        margin: 10px auto;
        max-height: calc(100vh - 20px);
        width: calc(100% - 20px);
    }

    .modal-lead-form > .modal-dialog > .modal-content,
    .modal-lead-form > .modal-dialog > form > .modal-content > .modal-dialog > .modal-content {
        max-height: calc(100vh - 20px);
    }
}
