/* AIO-only Ava voice activator in the former header logo position. */
.ava-voice-pill {
    min-width: 0;
    min-height: 34px;
    padding: 8px 24px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    background: linear-gradient(180deg, #f6f7f8 0%, #eff0f2 100%);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.04),
        0 1px 0 rgba(255, 255, 255, 0.8);
    color: #5f6368;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1;
    transition:
        border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.18s ease,
        transform 0.18s ease;
    overflow: hidden;
    position: relative;
    white-space: nowrap;
}

.ava-voice-pill[hidden] {
    display: none;
}

.ava-voice-pill:hover {
    color: var(--color-text, #111827);
}

.ava-voice-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #8b8f98;
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    flex: 0 0 auto;
    opacity: 0;
    transform: scale(0.82);
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.ava-voice-pill::after {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: inherit;
    border: 1px solid transparent;
    pointer-events: none;
}

.ava-voice-pill:focus-visible,
.ava-voice-pill.is-active {
    border-color: rgba(79, 70, 229, 0.3);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.04),
        0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.ava-voice-pill.is-active {
    color: var(--color-text, #111827);
}

.ava-voice-pill.is-active::before {
    opacity: 1;
    transform: scale(1);
}

.ava-voice-pill[data-voice-state="connecting"]::before,
.ava-voice-pill[data-voice-state="listening"]::before {
    background: #4f46e5;
    animation: ava-pill-listening 1.2s ease-out infinite;
}

.ava-voice-pill[data-voice-state="thinking"]::before {
    background:
        conic-gradient(from 0deg, #4f46e5, #a78bfa, #e0e7ff, #4f46e5);
    animation: ava-pill-thinking 0.9s linear infinite;
}

.ava-voice-pill[data-voice-state="speaking"]::before {
    width: 14px;
    height: 12px;
    border-radius: 0;
    background:
        linear-gradient(90deg, currentcolor 0 2px, transparent 2px 4px, currentcolor 4px 6px, transparent 6px 8px, currentcolor 8px 10px, transparent 10px 12px, currentcolor 12px 14px);
    box-shadow: none;
    clip-path: polygon(0 28%, 14% 28%, 14% 72%, 0 72%, 0 28%, 29% 8%, 43% 8%, 43% 92%, 29% 92%, 29% 8%, 57% 22%, 71% 22%, 71% 78%, 57% 78%, 57% 22%, 86% 34%, 100% 34%, 100% 66%, 86% 66%);
    animation: ava-pill-speaking 0.55s ease-in-out infinite;
}

.ava-voice-pill[data-voice-state="thinking"]::after {
    border-top-color: rgba(79, 70, 229, 0.45);
    animation: ava-pill-border-spin 1s linear infinite;
}

.ava-voice-pill[data-voice-state="speaking"] .ava-voice-pill__label {
    animation: ava-pill-label-pulse 0.8s ease-in-out infinite;
}

.ava-voice-pill[data-voice-state="error"] {
    border-color: rgba(185, 28, 28, 0.3);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.04),
        0 0 0 3px rgba(185, 28, 28, 0.1);
    color: #b91c1c;
}

@keyframes ava-pill-listening {
    0% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.32);
    }

    100% {
        box-shadow: 0 0 0 8px rgba(79, 70, 229, 0);
    }
}

@keyframes ava-pill-thinking {
    to {
        transform: rotate(360deg);
    }
}

@keyframes ava-pill-border-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes ava-pill-speaking {
    0%, 100% {
        transform: scaleY(0.72);
        opacity: 0.72;
    }

    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

@keyframes ava-pill-label-pulse {
    0%, 100% {
        opacity: 0.72;
    }

    50% {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ava-voice-pill,
    .ava-voice-pill * {
        animation: none !important;
        transition: none !important;
    }
}

@media (width <= 760px) {
    .ava-voice-pill {
        min-height: 32px;
        padding: 7px 18px;
        font-size: 14px;
    }
}
