.azure-ai {
    --ai-blue: #2f8fff;
    --ai-blue-bright: #77c4ff;
    --ai-ink: #05070a;
    --ai-panel: rgba(8, 12, 18, 0.97);
    --ai-line: rgba(151, 190, 231, 0.16);
    --ai-text: #f6f9fc;
    --ai-muted: #8e9baa;
    position: fixed;
    right: clamp(16px, 2.4vw, 34px);
    bottom: calc(clamp(16px, 2.4vw, 34px) + env(safe-area-inset-bottom, 0px));
    z-index: 1800;
    color: var(--ai-text);
    font-family: "Manrope", "Segoe UI", sans-serif;
}

.azure-ai *,
.azure-ai *::before,
.azure-ai *::after {
    box-sizing: border-box;
}

.azure-ai button,
.azure-ai textarea {
    font: inherit;
}

.azure-ai__launcher {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 174px;
    min-height: 62px;
    padding: 8px 16px 8px 9px;
    border: 1px solid rgba(119, 196, 255, 0.38);
    border-radius: 999px;
    overflow: hidden;
    background: linear-gradient(130deg, rgba(18, 28, 42, 0.98), rgba(7, 11, 17, 0.98));
    box-shadow: 0 22px 65px rgba(0, 0, 0, 0.45), 0 0 32px rgba(47, 143, 255, 0.12);
    color: var(--ai-text);
    cursor: pointer;
    isolation: isolate;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.azure-ai__launcher:hover {
    border-color: rgba(119, 196, 255, 0.7);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.52), 0 0 40px rgba(47, 143, 255, 0.22);
    transform: translateY(-2px);
}

.azure-ai__launcher-glow {
    position: absolute;
    inset: -50% auto -50% -20%;
    z-index: -1;
    width: 80px;
    background: radial-gradient(circle, rgba(47, 143, 255, 0.33), transparent 66%);
    pointer-events: none;
}

.azure-ai__launcher-mark,
.azure-ai__avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(119, 196, 255, 0.35);
    background: linear-gradient(145deg, rgba(47, 143, 255, 0.24), rgba(47, 143, 255, 0.06));
}

.azure-ai__launcher-mark {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.azure-ai__launcher-mark img,
.azure-ai__avatar img {
    width: 64%;
    height: 64%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.azure-ai__launcher-copy {
    display: grid;
    margin-left: 11px;
    text-align: left;
}

.azure-ai__launcher-copy strong {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    line-height: 1.2;
}

.azure-ai__launcher-copy small {
    margin-top: 3px;
    color: var(--ai-muted);
    font-size: 0.66rem;
    white-space: nowrap;
}

.azure-ai__launcher-close {
    display: none;
    width: 22px;
    height: 22px;
    margin-inline: auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.7;
}

.azure-ai.is-open .azure-ai__launcher {
    min-width: 58px;
    width: 58px;
    min-height: 58px;
    padding: 0;
    justify-content: center;
}

.azure-ai.is-open .azure-ai__launcher-mark,
.azure-ai.is-open .azure-ai__launcher-copy {
    display: none;
}

.azure-ai.is-open .azure-ai__launcher-close {
    display: block;
}

.azure-ai__panel {
    position: absolute;
    right: 0;
    bottom: 78px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(390px, calc(100vw - 32px));
    height: min(610px, calc(100vh - 130px));
    min-height: 470px;
    overflow: hidden;
    border: 1px solid rgba(151, 190, 231, 0.18);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(47, 143, 255, 0.06), transparent 20%),
        var(--ai-panel);
    box-shadow: 0 34px 100px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    opacity: 0;
    transform: translateY(18px) scale(0.97);
    transform-origin: right bottom;
    backdrop-filter: blur(24px);
    transition: opacity 220ms ease, transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.azure-ai__panel.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.azure-ai__panel[hidden] {
    display: none;
}

.azure-ai__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 86px;
    padding: 16px 16px 15px 18px;
    border-bottom: 1px solid var(--ai-line);
    background: rgba(255, 255, 255, 0.015);
}

.azure-ai__identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.azure-ai__avatar {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 15px;
}

.azure-ai__avatar i {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 12px;
    height: 12px;
    border: 3px solid #0a0e14;
    border-radius: 50%;
    background: #42dc94;
    box-shadow: 0 0 12px rgba(66, 220, 148, 0.65);
}

.azure-ai__eyebrow {
    display: block;
    color: var(--ai-blue-bright);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    line-height: 1.2;
    text-transform: uppercase;
}

.azure-ai__identity h2 {
    margin: 3px 0 0;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.azure-ai__identity p {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 4px 0 0;
    color: var(--ai-muted);
    font-size: 0.68rem;
    line-height: 1.2;
}

.azure-ai__identity p span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #42dc94;
}

.azure-ai__close {
    display: grid;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--ai-muted);
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.azure-ai__close:hover {
    border-color: var(--ai-line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ai-text);
}

.azure-ai__close svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.7;
}

.azure-ai__messages {
    min-height: 0;
    padding: 20px 17px 18px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(119, 196, 255, 0.35) transparent;
    scrollbar-width: thin;
}

.azure-ai__message {
    width: fit-content;
    max-width: 88%;
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    animation: azure-ai-message-in 260ms ease both;
}

.azure-ai__message p {
    margin: 0;
    color: #dce4ed;
    font-size: 0.84rem;
    line-height: 1.62;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.azure-ai__message-label {
    display: block;
    margin-bottom: 5px;
    color: var(--ai-blue-bright);
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.azure-ai__message--assistant {
    border: 1px solid rgba(151, 190, 231, 0.13);
    border-bottom-left-radius: 5px;
    background: rgba(255, 255, 255, 0.045);
}

.azure-ai__message--user {
    margin-left: auto;
    border: 1px solid rgba(119, 196, 255, 0.25);
    border-bottom-right-radius: 5px;
    background: linear-gradient(135deg, rgba(47, 143, 255, 0.29), rgba(47, 143, 255, 0.14));
}

.azure-ai__message--error {
    border-color: rgba(255, 130, 130, 0.22);
    background: rgba(255, 100, 100, 0.07);
}

.azure-ai__message--error .azure-ai__message-label {
    color: #ffaaa7;
}

.azure-ai__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 2px 0 15px;
}

.azure-ai__suggestions button {
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid rgba(119, 196, 255, 0.2);
    border-radius: 999px;
    background: rgba(47, 143, 255, 0.055);
    color: #b9d8f5;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.azure-ai__suggestions button:hover {
    border-color: rgba(119, 196, 255, 0.48);
    background: rgba(47, 143, 255, 0.13);
    color: #fff;
}

.azure-ai__typing {
    display: flex;
    align-items: center;
    width: fit-content;
    min-height: 40px;
    gap: 5px;
    padding: 0 15px;
    border: 1px solid var(--ai-line);
    border-radius: 15px 15px 15px 5px;
    background: rgba(255, 255, 255, 0.04);
}

.azure-ai__typing[hidden] {
    display: none;
}

.azure-ai__typing span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ai-blue-bright);
    animation: azure-ai-typing 1.1s infinite ease-in-out;
}

.azure-ai__typing span:nth-child(2) { animation-delay: 140ms; }
.azure-ai__typing span:nth-child(3) { animation-delay: 280ms; }

.azure-ai__composer {
    padding: 13px 14px 12px;
    border-top: 1px solid var(--ai-line);
    background: rgba(4, 7, 11, 0.86);
}

.azure-ai__composer form {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    min-height: 50px;
    padding: 7px 7px 7px 14px;
    border: 1px solid rgba(151, 190, 231, 0.17);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.035);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.azure-ai__composer form:focus-within {
    border-color: rgba(119, 196, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(47, 143, 255, 0.08);
}

.azure-ai__composer textarea {
    flex: 1;
    max-height: 104px;
    min-height: 34px;
    padding: 7px 0 5px;
    overflow-y: auto;
    resize: none;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ai-text);
    font-size: 0.8rem;
    line-height: 1.45;
}

.azure-ai__composer textarea::placeholder {
    color: #707c89;
}

.azure-ai__composer button[type="submit"] {
    display: grid;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(119, 196, 255, 0.4);
    border-radius: 12px;
    background: linear-gradient(145deg, #2585e7, #1464bd);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(16, 98, 188, 0.24);
    transition: filter 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.azure-ai__composer button[type="submit"]:hover:not(:disabled) {
    filter: brightness(1.13);
    transform: translateY(-1px);
}

.azure-ai__composer button[type="submit"]:disabled,
.azure-ai__composer textarea:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.azure-ai__composer button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.azure-ai__composer > p {
    margin: 8px 3px 0;
    color: #687482;
    font-size: 0.59rem;
    letter-spacing: 0.02em;
    text-align: center;
}

.azure-ai__composer > p span {
    margin-inline: 3px;
    color: var(--ai-blue);
}

@keyframes azure-ai-message-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes azure-ai-typing {
    0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 600px) {
    .azure-ai {
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .azure-ai__launcher {
        min-width: 58px;
        width: 58px;
        min-height: 58px;
        padding: 7px;
    }

    .azure-ai__launcher-copy {
        display: none;
    }

    .azure-ai__launcher-mark {
        width: 42px;
        height: 42px;
    }

    .azure-ai__panel {
        right: 0;
        bottom: 72px;
        width: calc(100vw - 24px);
        height: min(650px, calc(100dvh - 98px - env(safe-area-inset-bottom, 0px)));
        min-height: 430px;
        border-radius: 21px;
    }

    .azure-ai__message {
        max-width: 92%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .azure-ai__launcher,
    .azure-ai__panel,
    .azure-ai__message,
    .azure-ai__typing span {
        animation: none !important;
        transition: none !important;
    }
}
