/* NxCorp | css/chatbot.css
   CHATBOT: icon, window, messages, price cards, submit, success
   Load order matters: files are linked in index.html in this order. */

/* ================================================================
   SECTION: CHATBOT  (START)  -> CSS
   Only edit between START and END to change the chatbot look.
   Button size / position: the 3 variables below.
   Chat window size: .cw    Messages: .m    Input bar: .ci
   ================================================================ */
:root {
    --cb-size: 56px;   /* chat icon size */
    --cb-edge: 16px;   /* gap from screen edge */
    --cb-gap: 12px;    /* gap between icon and chat window */
}

.cb {
    position: fixed;
    right: calc(var(--cb-edge) + env(safe-area-inset-right,0px));
    bottom: calc(var(--cb-edge) + env(safe-area-inset-bottom,0px));
    z-index: 8;
    width: var(--cb-size);
    height: var(--cb-size);
    border-radius: 50%;
    border: 0;
    padding: 0;
    background: var(--blue);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 8px 22px -8px rgba(79,70,229,.65);
    transition: transform .2s ease, box-shadow .2s ease;
    -webkit-tap-highlight-color: transparent;
}

.cb:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 26px -8px rgba(79,70,229,.8);
}

.cb:active {
    transform: scale(.94);
}

.cb:focus-visible {
    outline: 3px solid rgba(79,70,229,.45);
    outline-offset: 3px;
}

/* chat icon and close (X) icon swap when the chat opens */
.cb svg {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 46%;
    height: 46%;
    transition: transform .25s ease, opacity .25s ease;
}

.cb .cb-x {
    opacity: 0;
    transform: rotate(-90deg) scale(.6);
}

.cb[aria-expanded="true"] .cb-chat {
    opacity: 0;
    transform: rotate(90deg) scale(.6);
}

.cb[aria-expanded="true"] .cb-x {
    opacity: 1;
    transform: none;
}

.cb::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--blue);
    animation: ping 2.6s infinite;
    pointer-events: none;
}

.cb[aria-expanded="true"]::after {
    animation: none;
    opacity: 0;
}

@keyframes ping {
    to {
        transform: scale(1.4);
        opacity: 0;
    }
}

.cw {
    position: fixed;
    right: calc(var(--cb-edge) + env(safe-area-inset-right,0px));
    bottom: calc(var(--cb-edge) + var(--cb-size) + var(--cb-gap) + env(safe-area-inset-bottom,0px));
    z-index: 8;
    width: min(380px,calc(100vw - (var(--cb-edge) * 2)));
    height: min(560px,calc(100vh - var(--cb-size) - (var(--cb-edge) * 2) - var(--cb-gap) - 24px));
    height: min(560px,calc(100dvh - var(--cb-size) - (var(--cb-edge) * 2) - var(--cb-gap) - 24px));
    display: flex;
    flex-direction: column;
    background: var(--card);
    color: var(--ink);
    border: 1.5px solid var(--ink);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 60px -16px rgba(0,0,0,.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(.96);
    transform-origin: bottom right;
    transition: opacity .25s,transform .25s,visibility .25s;
}

.cw.open {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.ch {
    background: var(--blue);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ch b {
    font: 800 17px 'Bricolage Grotesque',sans-serif;
    display: block;
}

.ch small {
    font-size: 12.5px;
    opacity: .9;
}

.ch .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4be37a;
    display: inline-block;
    margin-right: 5px;
}

.ch button {
    margin-left: auto;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.cl {
    flex: 1;
    overflow: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
}

.m {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 8px;
    animation: up .3s both;
}

.m.b {
    background: var(--lilac);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.m.u {
    background: var(--blue);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.m a {
    color: var(--blue);
    font-weight: 500;
}

.m a.wab {
    color: #08330f;
}

.wab {
    display: inline-block;
    margin-top: 10px;
    background: #25d366;
    padding: 9px 16px;
    border-radius: 999px;
    font-weight: 500;
    text-decoration: none;
}

.dots i {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mute);
    margin: 0 2px;
    animation: blink .9s infinite;
}

.dots i:nth-child(2) {
    animation-delay: .15s;
}

.dots i:nth-child(3) {
    animation-delay: .3s;
}

.ci {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--line);
}

.ci input {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 15px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink);
}

.ci button {
    border: 0;
    background: var(--blue);
    color: #fff;
    border-radius: 999px;
    padding: 0 18px;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.m:has(.pc) {
    max-width: 94%;
}

.pc {
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 9px 12px;
    margin-top: 8px;
}

.pc b {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.pc small {
    display: block;
    color: var(--mute);
    font-size: 13px;
    line-height: 1.4;
}

.m .nt {
    display: block;
    margin: 8px 0 4px;
    color: var(--mute);
    font-size: 12.5px;
}

.m a {
    display: inline-block;
    margin-top: 4px;
}

.w {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    padding-bottom: .1em;
}

.w>span {
    display: inline-block;
    animation: wup .9s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes wup {
    from {
        transform: translateY(110%) rotate(4deg);
    }
    to {
        transform: none;
    }
}

.h1s {
    animation: none!important;
    opacity: 1!important;
}

.spot {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(380px circle at var(--mx,70%) var(--my,30%),rgba(120,130,255,.3),transparent 65%);
}

.btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(100deg,transparent,rgba(255,255,255,.45),transparent);
    transform: skewX(-20deg);
    pointer-events: none;
}

.btn:hover::after {
    left: 140%;
    transition: left .7s;
}

@property --a {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes spin {
    to {
        --a: 360deg;
    }
}

.price.hot {
    border: 3px solid transparent;
    background: linear-gradient(var(--blue),var(--blue)) padding-box,conic-gradient(from var(--a),var(--pop),#fff,var(--blue),var(--pop)) border-box;
    animation: spin 4s linear infinite;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.menu button,
.m .opts button {
    font: inherit;
    font-size: 14.5px;
    text-align: left;
    border: 1px solid var(--blue);
    background: var(--card);
    color: var(--blue);
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    transition: background .2s,color .2s;
}

.menu button::after {
    content: "›";
    font-size: 18px;
}

.menu button:hover,
.m .opts button:hover {
    background: var(--blue);
    color: #fff;
}

.m .opts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.m .opts button {
    border-radius: 999px;
    padding: 8px 14px;
}

.ci .mb {
    background: var(--lilac);
    color: var(--blue);
    padding: 0 14px;
    font-size: 18px;
}

.m:has(.menu) {
    width: 90%;
}

/* chatbot: smaller screens */
@media (max-width: 560px) {
    :root {
        --cb-size: 52px;
        --cb-edge: 14px;
        --cb-gap: 10px;
    }

    .cw {
        border-radius: 18px;
    }

    .ci input {
        font-size: 16px; /* stops iPhone zooming in when typing */
    }
}

@media (max-width: 360px) {
    :root {
        --cb-size: 48px;
        --cb-edge: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cb::after {
        animation: none;
    }

    .cb,
    .cb svg,
    .cw {
        transition: none;
    }
}

/* chatbot: professional look + animations (edit here for polish) */
.cw {
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 30px 70px -18px rgba(20,18,60,.5), 0 2px 0 rgba(255,255,255,.04) inset;
    transform: translateY(24px) scale(.92);
    transition: opacity .28s ease, transform .42s cubic-bezier(.2,.9,.3,1.15), visibility .28s;
}

.cw.open {
    transform: none;
}

.ch {
    background: linear-gradient(135deg, var(--blue), #7a6bf4);
    padding: 14px 14px 14px 16px;
    gap: 12px;
    position: relative;
}

.ch b {
    font-size: 16px;
    letter-spacing: -.01em;
}

.ch small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    opacity: .85;
}

.av2 {
    position: relative;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    display: grid;
    place-items: center;
}

.av2 svg {
    width: 22px;
    height: 22px;
}

.av2 .st {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #3ddc84;
    border: 2px solid #6b5ef0;
    animation: cbLive 2s infinite;
}

@keyframes cbLive {
    0% { box-shadow: 0 0 0 0 rgba(61,220,132,.6); }
    100% { box-shadow: 0 0 0 7px rgba(61,220,132,0); }
}

.ch #cx {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    transition: background .2s, transform .25s;
}

.ch #cx:hover {
    background: rgba(255,255,255,.2);
    transform: rotate(90deg);
}

.cl {
    padding: 16px 14px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.cl::-webkit-scrollbar { width: 6px; }
.cl::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }

.m {
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
    animation: cbMsg .38s cubic-bezier(.2,.8,.2,1) both;
}

.m.b {
    border-bottom-left-radius: 5px;
    transform-origin: left bottom;
}

.m.u {
    background: linear-gradient(135deg, var(--blue), #7a6bf4);
    border-bottom-right-radius: 5px;
    transform-origin: right bottom;
    animation-name: cbMsgU;
}

@keyframes cbMsg {
    from { opacity: 0; transform: translateY(10px) translateX(-8px) scale(.96); }
    to { opacity: 1; transform: none; }
}

@keyframes cbMsgU {
    from { opacity: 0; transform: translateY(10px) translateX(8px) scale(.96); }
    to { opacity: 1; transform: none; }
}

/* typing dots: smooth bounce */
.dots i {
    animation: cbDot 1.1s infinite ease-in-out;
}

@keyframes cbDot {
    0%, 60%, 100% { transform: translateY(0); opacity: .45; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* quick reply buttons slide in one by one */
.menu button,
.m .opts button {
    animation: cbMsg .4s cubic-bezier(.2,.8,.2,1) both;
    transition: transform .18s, background .18s, color .18s, box-shadow .18s;
}

.menu button:nth-child(2), .m .opts button:nth-child(2) { animation-delay: .06s; }
.menu button:nth-child(3), .m .opts button:nth-child(3) { animation-delay: .12s; }
.menu button:nth-child(4), .m .opts button:nth-child(4) { animation-delay: .18s; }
.menu button:nth-child(5), .m .opts button:nth-child(5) { animation-delay: .24s; }
.menu button:nth-child(n+6), .m .opts button:nth-child(n+6) { animation-delay: .3s; }

.menu button:hover,
.m .opts button:hover {
    transform: translateX(3px);
    box-shadow: 0 6px 14px -8px rgba(79,70,229,.6);
}

.menu button:active,
.m .opts button:active {
    transform: scale(.97);
}

/* input bar */
.ci {
    padding: 12px;
    background: var(--card);
    align-items: center;
}

.ci input {
    padding: 11px 16px;
    transition: border-color .2s, box-shadow .2s;
}

.ci input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(79,70,229,.18);
}

.ci #cs {
    flex: none;
    width: 42px;
    height: 42px;
    padding: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--blue), #7a6bf4);
    transition: transform .2s, box-shadow .2s;
}

.ci #cs:hover {
    transform: translateY(-1px) rotate(-8deg);
    box-shadow: 0 8px 16px -8px rgba(79,70,229,.8);
}

.ci #cs:active {
    transform: scale(.9);
}

.ci .mb {
    flex: none;
    width: 42px;
    height: 42px;
    padding: 0;
    display: grid;
    place-items: center;
    transition: transform .2s;
}

.ci .mb:hover {
    transform: scale(1.08);
}

/* greeting bubble next to the chat icon */
.cb-tip {
    position: fixed;
    right: calc(var(--cb-edge) + env(safe-area-inset-right,0px));
    bottom: calc(var(--cb-edge) + var(--cb-size) + 10px + env(safe-area-inset-bottom,0px));
    z-index: 8;
    max-width: min(250px, calc(100vw - 32px));
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 16px 16px 4px 16px;
    padding: 11px 34px 11px 14px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 14px 30px -12px rgba(0,0,0,.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(.95);
    transform-origin: bottom right;
    transition: opacity .3s, transform .4s cubic-bezier(.2,.9,.3,1.2), visibility .3s;
}

.cb-tip.show {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.cb-tip button {
    position: absolute;
    top: 6px;
    right: 8px;
    border: 0;
    background: transparent;
    color: var(--mute);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

/* icon gently floats until opened */
.cb:not([aria-expanded="true"]) {
    animation: cbFloat 3.2s ease-in-out infinite;
}

@keyframes cbFloat {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -4px; }
}

@media (max-width: 560px) {
    .cw {
        border-radius: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cb:not([aria-expanded="true"]),
    .av2 .st,
    .dots i {
        animation: none;
    }

    .m,
    .menu button,
    .m .opts button {
        animation-duration: .01s;
    }
}

/* chatbot: price select, summary, submit, success (lead flow) */
.m .gh {
    margin: 12px 0 2px;
    font: 800 12px 'JetBrains Mono',monospace;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--blue);
}

.pc .pa {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.pc .pa .wab {
    margin-top: 0;
    padding: 7px 12px;
    font-size: 13px;
}

.pc .sel {
    margin-left: auto;
    border: 1.5px solid var(--blue);
    background: transparent;
    color: var(--blue);
    border-radius: 999px;
    padding: 7px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s, color .2s, transform .15s;
}

.pc .sel:hover {
    background: var(--blue);
    color: #fff;
}

.pc .sel:active {
    transform: scale(.96);
}

.sm {
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 3px solid var(--blue);
    border-radius: 12px;
    padding: 10px 12px;
    margin: 10px 0;
}

.sm ul {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
}

.sm li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
    font-size: 14px;
    border-bottom: 1px dashed var(--line);
    text-align: right;
    word-break: break-word;
}

.sm li:last-child {
    border: 0;
}

.sm li span {
    color: var(--mute);
    text-align: left;
    flex: none;
}

.m .sub {
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 13px 16px;
    font: inherit;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--blue), #7a6bf4);
    box-shadow: 0 10px 20px -10px rgba(79,70,229,.8);
    transition: transform .18s, box-shadow .18s, opacity .2s;
}

.m .sub:hover:not(:disabled) {
    transform: translateY(-2px);
}

.m .sub:active:not(:disabled) {
    transform: scale(.98);
}

.m .sub.busy {
    opacity: .75;
    cursor: wait;
}

.m .sub.busy::before {
    content: "";
    display: inline-block;
    width: 13px;
    height: 13px;
    margin-right: 8px;
    vertical-align: -2px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cbSpin .7s linear infinite;
}

.m .sub.done {
    background: #1f9d55;
    box-shadow: none;
    cursor: default;
}

@keyframes cbSpin {
    to { transform: rotate(360deg); }
}

.ok2 {
    text-align: center;
    padding: 6px 4px 2px;
}

.ok2 .tick {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 2px auto 10px;
    border-radius: 50%;
    background: #1f9d55;
    color: #fff;
    animation: cbPop .5s cubic-bezier(.2,.9,.3,1.4) both;
}

.ok2 .tick svg {
    width: 26px;
    height: 26px;
}

.ok2 .tick path {
    stroke-dasharray: 26;
    stroke-dashoffset: 26;
    animation: cbDraw .45s .25s ease forwards;
}

.ok2 b {
    display: block;
    font: 800 17px 'Bricolage Grotesque',sans-serif;
}

.ok2 p {
    margin: 6px 0;
}

.ok2 small {
    color: var(--mute);
}

@keyframes cbPop {
    from { transform: scale(.3); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@keyframes cbDraw {
    to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .ok2 .tick,
    .ok2 .tick path,
    .m .sub.busy::before {
        animation-duration: .01s;
    }
}

.m a.wab.alt {
    background: var(--lilac);
    color: var(--blue);
    margin-left: 6px;
}

/* ================================================================
   SECTION: CHATBOT  (END)  -> CSS
   ================================================================ */
