@property --ai-launcher-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

.ask-ai-searchbar-btn {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 96px;
    height: 36px;
    padding: 0 14px;
    box-sizing: border-box;
    border: 0;
    border-radius: 999px;
    background: #ffffff;
    color: #1f5a43;
    box-shadow: 0 6px 16px rgba(23, 71, 52, 0.24);
    font: inherit;
    cursor: pointer;
    transition:
        background-color 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease,
        color 160ms ease,
        transform 120ms ease;
}

.ask-ai-searchbar-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    padding: 2px;
    border-radius: inherit;
    background: conic-gradient(
        from var(--ai-launcher-angle),
        #1f5a43 0deg 140deg,
        #cda74d 180deg,
        #f2d27d 210deg,
        #cda74d 240deg,
        #1f5a43 280deg 360deg
    );
    pointer-events: none;
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: ask-ai-launcher-ring-rotate 3s linear infinite;
}

.ask-ai-searchbar-btn::after {
    content: "";
    position: absolute;
    inset: -2px;
    z-index: -1;
    border-radius: inherit;
    background: conic-gradient(
        from var(--ai-launcher-angle),
        rgba(31, 90, 67, 0.2) 0deg 190deg,
        rgba(184, 138, 45, 0.5) 235deg,
        rgba(224, 189, 101, 0.62) 255deg,
        rgba(31, 90, 67, 0.2) 320deg 360deg
    );
    pointer-events: none;
    filter: blur(6px);
    opacity: 0.3;
    animation: ask-ai-launcher-ring-rotate 3s linear infinite;
}

.ask-ai-searchbar-btn:hover {
    background: #f8faf8;
    color: #174734;
    box-shadow: 0 9px 22px rgba(23, 71, 52, 0.3);
}

.ask-ai-searchbar-btn:hover::before {
    filter: brightness(1.08) saturate(1.08);
}

.ask-ai-searchbar-btn:hover::after {
    opacity: 0.48;
}

.ask-ai-searchbar-btn:active {
    transform: translateY(0) scale(0.98);
}

.ask-ai-searchbar-btn:focus-visible {
    outline: 3px solid rgba(184, 138, 45, 0.3);
    outline-offset: 3px;
}

.ask-ai-searchbar-btn[aria-disabled="true"] {
    cursor: wait;
}

.ask-ai-launcher-icon {
    position: relative;
    z-index: 1;
    width: 20px;
    height: 20px;
    color: #b88a2d;
    display: inline-block;
    vertical-align: middle;
}

.ask-ai-searchbar-btn:hover .ask-ai-launcher-icon {
    color: #9a6b16;
    animation: none;
}

.ask-ai-searchbar-btn[aria-disabled="true"] .ask-ai-launcher-icon {
    animation: ask-ai-launcher-working 700ms ease-in-out infinite alternate;
}

.ask-ai-launcher-label {
    position: relative;
    z-index: 1;
    color: #000000;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

@keyframes ask-ai-launcher-working {
    from {
        opacity: 0.65;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1.05);
    }
}

@keyframes ask-ai-launcher-ring-rotate {
    from {
        --ai-launcher-angle: 0deg;
    }

    to {
        --ai-launcher-angle: 360deg;
    }
}

@keyframes ask-ai-launcher-sparkle {
    0%, 72%, 100% {
        transform: rotate(0) scale(1);
    }

    82% {
        transform: rotate(-8deg) scale(1.08);
    }
}

.ai-workspace-open .ask-ai-searchbar-btn,
.ai-workspace-open .ask-ai-searchbar-btn::before,
.ai-workspace-open .ask-ai-searchbar-btn::after,
.ai-workspace-open .ask-ai-launcher-icon {
    animation-play-state: paused;
}

@media (max-width: 767px) {
    .ask-ai-searchbar-btn {
        width: 36px;
        min-width: 36px;
        padding: 0;
        gap: 0;
    }

    .ask-ai-launcher-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    #ask-ai-btn-mobile {
        position: fixed !important;
        bottom: 86px !important;
        right: 20px !important;
        width: 54px !important;
        min-width: 54px !important;
        height: 54px !important;
        border-radius: 50% !important;
        z-index: 9999 !important;
        box-shadow: 0 8px 24px rgba(23, 71, 52, 0.4) !important;
        padding: 0 !important;
        display: inline-flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0 !important;
    }

    #ask-ai-btn-mobile .ask-ai-launcher-icon {
        width: 26px !important;
        height: 26px !important;
        margin: 0 !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ask-ai-searchbar-btn,
    .ask-ai-launcher-icon {
        animation: none;
        transition: none;
    }

    .ask-ai-searchbar-btn {
        border: 1px solid #cda74d;
        background: #ffffff;
    }

    .ask-ai-searchbar-btn::after {
        animation: none;
        opacity: 0;
    }

    .ask-ai-searchbar-btn::before {
        animation: none;
        opacity: 0;
    }

    .ask-ai-searchbar-btn[aria-disabled="true"] .ask-ai-launcher-icon {
        animation: none;
    }
}
