.demo-request-modal {
    --demo-request-primary: var(--ct-primary, #7e57c2);
    --demo-request-primary-rgb: var(--ct-primary-rgb, 126, 87, 194);
}

/* Keep the dialog within the viewport so the footer ("Book my demo") stays reachable. */
.demo-request-modal .modal-dialog {
    max-height: calc(100dvh - 1rem);
    margin: 0.5rem auto;
}

.demo-request-modal .modal-content {
    max-height: calc(100dvh - 1rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Form/success wrappers are not Bootstrap's direct header/body/footer children;
   make them flex containers so .modal-body can shrink and scroll. */
.demo-request-modal #demoRequestFormView:not(.d-none),
.demo-request-modal #demoRequestSuccessView:not(.d-none) {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
    flex: 1 1 auto;
    overflow: hidden;
}

.demo-request-modal #demoRequestFormView .modal-header,
.demo-request-modal #demoRequestFormView .modal-footer,
.demo-request-modal #demoRequestSuccessView .modal-header {
    flex-shrink: 0;
}

.demo-request-modal #demoRequestFormView .modal-body,
.demo-request-modal #demoRequestSuccessView .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.demo-request-modal .modal-header {
    background: linear-gradient(180deg, rgba(var(--demo-request-primary-rgb), 0.07) 0%, transparent 100%);
}

.demo-request-modal .modal-title {
    font-size: clamp(1.125rem, 2.5vw, 1.35rem);
    line-height: 1.3;
}

.demo-request-section {
    border: 0;
    margin: 0 0 1.25rem;
    padding: 0;
    min-width: 0;
}

.demo-request-section:last-of-type {
    margin-bottom: 0;
}

.demo-request-section-title {
    float: none;
    width: 100%;
    margin: 0 0 0.75rem;
    padding: 0;
    border: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1.4;
    text-transform: uppercase;
    color: var(--bs-secondary-color, #6c757d);
}

.demo-request-section-card {
    background-color: rgba(var(--bs-light-rgb, 248, 249, 250), 0.85);
    border: 1px solid rgba(var(--bs-border-color-rgb, 222, 226, 230), 0.85);
    border-radius: 1rem;
    padding: 1rem;
}

.demo-request-modal .form-label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.demo-request-modal .form-control,
.demo-request-modal .form-select {
    border-radius: 0.625rem;
    min-height: 2.75rem;
    padding: 0.625rem 0.875rem;
}

.demo-request-modal textarea.form-control {
    min-height: auto;
}

.demo-request-modal .form-control:focus,
.demo-request-modal .form-select:focus {
    border-color: rgba(var(--demo-request-primary-rgb), 0.45);
    box-shadow: 0 0 0 0.2rem rgba(var(--demo-request-primary-rgb), 0.12);
}

.demo-request-modal #demoRequestAlert {
    border-radius: 0.75rem;
}

.demo-request-modal .demo-request-submit {
    border-radius: 0.875rem;
    min-height: 3rem;
    box-shadow: 0 0.35rem 1rem rgba(var(--demo-request-primary-rgb), 0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.demo-request-modal .demo-request-submit:hover:not(:disabled),
.demo-request-modal .demo-request-submit:focus-visible:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 0.5rem 1.25rem rgba(var(--demo-request-primary-rgb), 0.28);
}

.demo-request-modal .demo-request-submit:disabled {
    opacity: 0.85;
}

.demo-request-modal .demo-request-required-note {
    font-size: 0.8125rem;
}

.demo-request-modal #demoRequestSuccessView .modal-header {
    background: none;
}

.demo-request-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.75rem;
    height: 4.75rem;
    border: 3px solid var(--demo-request-primary);
    border-radius: 50%;
    background-color: rgba(var(--demo-request-primary-rgb), 0.1);
    color: var(--demo-request-primary);
    font-size: 2.5rem;
    line-height: 1;
}

.demo-request-success-title {
    font-size: clamp(1.625rem, 4.5vw, 2rem);
    font-weight: 700;
    line-height: 1.25;
    color: var(--bs-body-color, #212529);
}

.demo-request-success-body {
    font-size: clamp(1.0625rem, 2.75vw, 1.3125rem);
    font-weight: 500;
    line-height: 1.55;
    color: var(--bs-secondary-color, #6c757d);
    max-width: 32rem;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 575.98px) {
    /* Avoid vertical centering pushing the footer off-screen on short viewports. */
    .demo-request-modal .modal-dialog-centered {
        min-height: calc(100% - 1rem);
        align-items: flex-start;
    }

    .demo-request-modal .modal-dialog {
        margin: 0.5rem;
        max-height: calc(100dvh - 1rem);
    }

    .demo-request-modal .modal-content {
        max-height: calc(100dvh - 1rem);
    }

    .demo-request-section-card {
        padding: 0.875rem;
    }

    .demo-request-modal .modal-footer {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        padding-bottom: 1rem !important;
    }
}

@media (min-width: 768px) {
    .demo-request-section-card {
        padding: 1.125rem 1.25rem;
    }
}
