#ai-search-wrap {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000000000000000;
    width: 100%;
    height: 100%;
    background-color: var(--ais-bg, #020612);
    transition: clip-path 0.5s ease;
}

#ai-search-wrap.is-open {
    display: block;
}

#ai-search-close {
    position: absolute;
    top: 15px;
    right: 20px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    background: none;
    border: none;
}

.ai-search-icon {
    display: inline-block;
    cursor: pointer;
}

.ai-search-icon-wrap {
    display: inline-block;
    position: relative;
    width: 20px;
    height: 20px;
}

.ai-search-icon-wrap .search-circle {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.ai-search-icon-wrap .search-line {
    position: absolute;
    width: 8px;
    height: 2px;
    background: currentColor;
    top: 13.5px;
    left: 14.5px;
    transform: rotate(45deg);
    transform-origin: left top;
}

#ai-search-close .ai-close-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: #fff;
    transform-origin: center;
}

#ai-search-close .ai-close-line:first-child {
    transform: translateY(-50%) rotate(45deg);
}

#ai-search-close .ai-close-line:last-child {
    transform: translateY(-50%) rotate(-45deg);
}


#ai-search-wrap.is-open {
    display: block;
}

#ai-search-close {
    position: absolute;
    top: 15px;
    right: 20px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    background: none;
    border: none;
}

#ai-search-close .ai-close-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: #fff;
    transform-origin: center;
}

#ai-search-close .ai-close-line:first-child {
    transform: translateY(-50%) rotate(45deg);
}

#ai-search-close .ai-close-line:last-child {
    transform: translateY(-50%) rotate(-45deg);
}

/* ─── Search History ─── */
#aiqa {
    overflow-y: auto;
    height: 100%;
    max-height: calc(100vh - 80.13px);
    max-height: calc(100dvh - 80.13px);
    overflow-x: hidden;
}
#search-history {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 100%;
    padding: 30px 30px 0;
}
#aiqa .ai-qa-entry {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
}
#aiqa .ai-qa-entry > h4,
#aiqa .ai-qa-entry > p,
#aiqa .ai-qa-entry > ul,
#aiqa .ai-qa-entry > ol {
    color: var(--ais-text, #fff);
    margin-bottom: 15px;
}
#aiqa .ai-qa-entry > p:first-of-type strong {
    /* border: 1.5px solid #ffffff73;
    padding: 8px 16px;
    display: inline-block;
    border-radius: 50px; */
    font-size: 1.2rem;
}
#aiqa .ai-qa-entry hr {
    margin: 30px auto;
    max-width: 900px;
    background-color: var(--ais-hr, #fff);
    width: 100%;
    height: 1px;
}
#aiqa .references {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 15px;
    padding-left: 0;
    list-style: none;
}
#aiqa .references li {
    position: relative;
    padding: 0;
}
#aiqa .references li > a {
    display: inline-block;
    color: var(--ais-ref-color, #fff) !important;
    border: 1.5px solid var(--ais-ref-border, #fff);
    border-radius: 50px;
    padding: 8px 18px;
    text-decoration: none;
    background: var(--ais-ref-bg, #ffffff3d);
    background: -webkit-linear-gradient(to right, var(--ais-ref-bg, #ffffff3d), var(--ais-ref-bg, #ffffff3d));
    background: linear-gradient(to right, var(--ais-ref-bg, #ffffff3d), var(--ais-ref-bg, #ffffff3d));
    line-height: 1;
    transition: 0.5s all ease;
}
#aiqa .references li > a:hover {
    background: var(--ais-ref-hover-start, #ffffff3d);
    background: -webkit-linear-gradient(to right, var(--ais-ref-hover-start, #ffffff3d), var(--ais-ref-hover-end, #ffffff80));
    background: linear-gradient(to right, var(--ais-ref-hover-start, #ffffff3d), var(--ais-ref-hover-end, #ffffff80));
}
#aiqa .references li > p {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    left: 3%;
    bottom: 84%;
    width: 450px;
    background-color: #ffffffeb;
    color: #0e1c4a;
    margin-bottom: 0;
    padding: 7px 15px;
    border-radius: 9px;
    transition: 0.5s all ease;
}
#aiqa .references li > a:hover + p {
    opacity: 1;
}


/* ─── Loader ─── */
.loader-box {
    width: 100%;
    margin-bottom: 30px;
}
.loader {
    height: 30px;
    width: 80px;
    aspect-ratio: 2;
    border-bottom: 3px solid #0000;
    background: linear-gradient(90deg, var(--ais-loader-color, #ffffff91) 50%, #0000 0) -25% 100% / 50% 3px repeat-x border-box;
    position: relative;
    animation: l3-0 .75s linear infinite;
}
.loader:before {
    content: "";
    position: absolute;
    inset: auto 43.5% 0;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #CF4647;
    animation: l3-1 .75s cubic-bezier(0,900,1,900) infinite;
}
@keyframes l3-0 {
    to {background-position: -125% 100%}
}
@keyframes l3-1 {
    0%,2% {bottom: 0%}
    98%,to {bottom:.1%}
}

.ai-qa-entry-icon {
    display: none;
    position: relative;
    height: 20px;
    width: 20px;
    transform: translateY(3px);
    margin-right: 5px;
}
.ai-qa-entry-icon .ai-q-icon-line {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 3px;
    border-radius: 3px;
    background-color: var(--ais-q-line-color, #ffffff91);
}
.ai-qa-entry-icon .ai-q-icon-circle {
    position: absolute;
    bottom: 3px;
    height: 10px;
    width: 10px;
    border-radius: 100%;
    background-color: #CF4647;
}
.answrd .ai-qa-entry-icon {
    display: inline-block;
}

/* ─── Search Form ─── */
#ai-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    position: absolute;
    width: 100%;
    bottom: calc(50% - 30px);
    left: 50%;
    -webkit-transform: translate(-50%, 50%);
        transform: translate(-50%, 50%);
    max-width: 800px !important;
    margin: 0 auto !important;
    padding: 0 30px 30px !important;
    background-color: #ffffff00 !important;
    -webkit-box-shadow: none;
        box-shadow: none;
}
#ai-search-form.submitted {
    bottom: 0;
    -webkit-transform: translate(-50%, 0);
        transform: translate(-50%, 0);
}
#ai-search-form input {
    width: 50% !important;
    flex-grow: 1;
    padding: 10px 20px;
    font-size: 1.2em;
    background-color: #fff !important;
    border-radius: 50px !important;
}
#ai-search-form button {
    color: var(--ais-btn-color, #fff);
    border: 1.5px solid var(--ais-btn-border, #fff);
    text-transform: uppercase;
    font-size: 15px;
    padding: 12px 20px;
    line-height: 14px;
    border-radius: 50px;
    transition: 0.5s all ease;
    background: var(--ais-btn-bg-start, #ffffff00);
    background: -webkit-linear-gradient(to right, var(--ais-btn-bg-start, #ffffff00), var(--ais-btn-bg-end, #ffffff00));
    background: linear-gradient(to right, var(--ais-btn-bg-start, #ffffff00), var(--ais-btn-bg-end, #ffffff00));
}
#ai-search-form button:hover {
    background: var(--ais-btn-hover-start, #ffffff54);
    background: -webkit-linear-gradient(to right, var(--ais-btn-hover-start, #ffffff54), var(--ais-btn-hover-end, #ffffff80));
    background: linear-gradient(to right, var(--ais-btn-hover-start, #ffffff54), var(--ais-btn-hover-end, #ffffff80));
}

#ai-query-header {
    width: 100%;
}
form.submitted #ai-query-header {
    display: none;
}
#ai-query-header h3,
#ai-query-header h5 {
    text-align: center;
    color: var(--ais-text, #fff);
}
#ai-query-header h3 {
    margin-top: 0;
    margin-bottom: 10px;
}
#ai-query-header h5 {
    opacity: 0.6;
    margin-top: 0;
    margin-bottom: 7px;
}


#ai-clear-context {
    display: none;
    padding: 10px 20px;
    border-radius: 50px;
}
form.submitted #ai-clear-context {
    display: block;
}

/* ─── Debug ─── */
#ai-search-wrap pre { 
    background-color: var(--ais-pre-bg, #fff);
}


/* ─── Mobile ─── */
@media (max-width: 728px) {

    #aiqa {
        max-height: calc(100vh - 141.24px);
        max-height: calc(100dvh - 141.24px);
    }
    #search-history {
        padding-bottom: 0;
    }
    form.submitted #ai-search-form {
        justify-content: center;
    }
    form.submitted #ai-search-form input {
        width: 100%;
    }

}
@media (max-width: 540px) {
    #ai-search-form {
        justify-content: center;
    }
    #ai-search-form input {
        width: 100%;
    }
}
