/* ===========================================================================
   Demo booking form
   Shared by the full page (/book-a-demo) and the floating widget on the
   marketing site (/book-a-demo/embed inside an iframe).

   Mobile first: every rule here is written for a narrow viewport, and the
   wider layouts are layered on with min-width media queries.
   =========================================================================== */

.embed-layout {
    padding: 16px;
    background: #ffffff;
    min-height: 100%;
    box-sizing: border-box;
}

.demo-form {
    max-width: 100%;
}

.demo-form-intro {
    margin: 0 0 16px;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
}

.demo-form-step {
    font-size: 1rem;
    font-weight: 700;
    margin: 20px 0 12px;
}

.demo-form .demo-form-step:first-of-type {
    margin-top: 0;
}

.demo-form-message {
    text-align: center;
    padding: 8px 0 16px;
}

.demo-form-message h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 8px 0;
}

.demo-form-emoji {
    font-size: 40px;
    line-height: 1;
}

/* --- week navigation ---------------------------------------------------- */

.demo-week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.demo-week-label {
    font-weight: 700;
    font-size: 0.95rem;
    text-align: center;
    flex: 1 1 auto;
    min-width: 0;
}

/* --- slots -------------------------------------------------------------- */

.demo-day {
    margin-bottom: 16px;
}

.demo-day-label {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

/* A grid rather than wrapped inline buttons, so slots line up neatly and
   every tap target keeps a comfortable size on a phone. */
.demo-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    gap: 8px;
}

.demo-slot {
    /* 44px keeps the tap target at the accessible minimum on touch screens. */
    min-height: 44px;
    padding: 8px 4px;
    border: 1px solid #0d6efd;
    border-radius: 8px;
    background: #fff;
    color: #0d6efd;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease;
}

.demo-slot:hover {
    background: #e7f1ff;
}

/* --- the chosen slot ----------------------------------------------------
   Picking a time collapses the whole calendar down to this one row, so the
   visitor's eye goes straight to the details form below it. -------------- */

.demo-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;

    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid #0d6efd;
    border-radius: 8px;
    background: #e7f1ff;
}

.demo-selected-detail {
    min-width: 0;
}

.demo-selected-day {
    font-weight: 700;
    font-size: 0.95rem;
}

.demo-selected-time {
    font-size: 0.875rem;
    color: #333;
}

.demo-change-slot {
    /* Keeps the accessible tap target even though it is a small button. */
    min-height: 44px;
    flex: 0 0 auto;
}

.demo-slot:focus-visible {
    outline: 3px solid #99c2ff;
    outline-offset: 2px;
}

/* --- fields ------------------------------------------------------------- */

.demo-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.demo-field-full {
    grid-column: 1 / -1;
}

/* 16px prevents iOS Safari from zooming the page when a field is focused. */
.demo-form .form-control {
    font-size: 16px;
    min-height: 44px;
}

.demo-form textarea.form-control {
    min-height: 66px;
}

.demo-submit {
    min-height: 48px;
    font-size: 1rem;
}

/* --- wider screens ------------------------------------------------------ */

@media (min-width: 576px) {
    .demo-fields {
        grid-template-columns: 1fr 1fr;
    }

    .demo-slots {
        grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    }
}

/* The compact variant stays single-column even on wide screens, because it
   lives in a narrow widget panel regardless of the device. */
.demo-form-compact .demo-fields {
    grid-template-columns: 1fr;
}

.demo-form-compact .demo-slots {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}

.demo-form-compact .demo-form-step {
    font-size: 0.95rem;
}


/* ===========================================================================
   Floating "book a demo" widget
   Injected into the static marketing site by wwwroot/js/demo-widget.js.
   =========================================================================== */

.qd-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2147483000;

    display: inline-flex;
    align-items: center;
    gap: 10px;

    /* 56px is the standard floating-action-button size and clears the 44px
       minimum tap target comfortably. */
    min-height: 56px;
    padding: 0 22px;

    border: 0;
    border-radius: 28px;
    background: #5128f5;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .28);
    transition: transform .15s ease, box-shadow .15s ease;
}

.qd-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .34);
}

.qd-launcher:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.qd-launcher-icon {
    font-size: 18px;
    line-height: 1;
}

.qd-panel {
    position: fixed;
    right: 20px;
    bottom: 88px;
    z-index: 2147483001;

    width: 400px;
    /* Never taller than the viewport, allowing for the launcher and margins. */
    height: min(640px, calc(100vh - 120px));

    flex-direction: column;
    overflow: hidden;

    background: #fff;
    border-radius: 16px;
    box-shadow: 0 18px 56px rgba(0, 0, 0, .32);

    /* Hidden by default. Visibility is driven by display rather than a
       transition: a transition that never completes (throttled background tab,
       reduced motion, an older browser) would otherwise leave the panel
       permanently invisible even though it is "open". The slide-in below is a
       pure decoration with no fill mode, so if it never runs the panel simply
       appears at its normal, visible style. */
    display: none;
}

.qd-panel.is-open {
    display: flex;
    animation: qd-panel-in .18s ease;
}

@keyframes qd-panel-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

.qd-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: #101010;
    color: #fff;
    flex: 0 0 auto;
}

.qd-panel-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
}

.qd-panel-subtitle {
    font-size: 12px;
    opacity: .75;
    margin: 2px 0 0;
}

.qd-panel-close {
    /* 44px tap target even though the glyph is small. */
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.qd-panel-close:hover {
    background: rgba(255, 255, 255, .14);
}

.qd-panel-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.qd-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
}

.qd-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.qd-frame-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 14px;
    background: #fff;
    pointer-events: none;
}

.qd-panel.is-loaded .qd-frame-loading {
    display: none;
}

/* --- phones: full screen, which is what chat widgets do and what a booking
       form needs to be usable at 375px ---------------------------------- */

@media (max-width: 575.98px) {
    .qd-launcher {
        right: 16px;
        bottom: 16px;
        padding: 0 18px;
    }

    .qd-panel {
        right: 0;
        bottom: 0;
        left: 0;
        top: 0;

        width: 100%;
        /* dvh accounts for mobile browser chrome that appears and disappears
           while scrolling; vh is the fallback for older browsers. */
        height: 100vh;
        height: 100dvh;

        border-radius: 0;
    }

    /* Slides up from the bottom edge on phones. */
    .qd-panel.is-open {
        animation: qd-panel-in-mobile .2s ease;
    }

    @keyframes qd-panel-in-mobile {
        from {
            transform: translateY(100%);
        }
    }

    /* The launcher would sit on top of the full-screen panel. */
    .qd-panel.is-open ~ .qd-launcher,
    body.qd-open .qd-launcher {
        display: none;
    }
}

/* Stop the page behind a full-screen panel from scrolling. */
body.qd-locked {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .qd-launcher {
        transition: none;
    }

    .qd-panel.is-open {
        animation: none;
    }
}
