.ai-chat-button {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9998;
    display: none;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 999px;
    padding: 13px 18px;
    color: #fff;
    font-weight: 900;
    background: linear-gradient(135deg, #2563eb, #14b8a6);
    box-shadow: 0 18px 45px rgba(37,99,235,.28);
    cursor: pointer;
    transition: transform .22s ease, box-shadow .22s ease;
}

.ai-chat-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 60px rgba(37,99,235,.34);
}

.ai-chat-button span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
}

.ai-chat-window {
    position: fixed;
    right: 22px;
    bottom: 86px;
    z-index: 9999;
    width: min(390px, calc(100vw - 28px));
    height: 560px;
    max-height: calc(100vh - 120px);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border-radius: 28px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 30px 90px rgba(15,23,42,.22);
    animation: aiChatIn .22s ease both;
}

.ai-chat-window.open,
.ai-chat-button.ready {
    display: flex;
}

.ai-chat-header {
    padding: 18px;
    color: #fff;
    background:
        radial-gradient(circle at 12% 18%, rgba(255,255,255,.22), transparent 28%),
        linear-gradient(135deg, #0f172a, #1e3a8a);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ai-chat-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-avatar {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #2563eb, #14b8a6);
    font-weight: 950;
}

.ai-chat-profile strong {
    display: block;
    line-height: 1.1;
}

.ai-chat-profile small {
    color: #cbd5e1;
}

.ai-chat-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: rgba(255,255,255,.12);
    cursor: pointer;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background:
        radial-gradient(circle at 10% 10%, rgba(37,99,235,.05), transparent 28%),
        #f8fafc;
}

.ai-msg {
    max-width: 88%;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.55;
    white-space: pre-line;
}

.ai-msg.assistant {
    color: #0f172a;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 6px;
}

.ai-msg.user {
    margin-left: auto;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-bottom-right-radius: 6px;
}

.ai-chat-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 18px 14px;
    background: #f8fafc;
}

.ai-chat-quick button {
    border: 1px solid #dbeafe;
    border-radius: 999px;
    padding: 8px 11px;
    color: #2563eb;
    background: #fff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    max-width: 100%;
    white-space: nowrap;
    transition: transform .2s ease, background .2s ease, border-color .2s ease, color .2s ease;
}

.ai-chat-quick button:hover {
    transform: translateY(-2px);
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #2563eb, #14b8a6);
}

.ai-chat-quick {
    max-height: 116px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.ai-chat-form {
    display: flex;
    gap: 8px;
    padding: 14px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.ai-chat-form input {
    flex: 1;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 12px 14px;
    outline: none;
}

.ai-chat-form input:focus {
    border-color: rgba(37,99,235,.45);
    box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}

.ai-chat-form button {
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #14b8a6);
    cursor: pointer;
}

.ai-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.ai-typing i {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #94a3b8;
    animation: aiTyping 1s infinite ease-in-out;
}

.ai-typing i:nth-child(2) {
    animation-delay: .12s;
}

.ai-typing i:nth-child(3) {
    animation-delay: .24s;
}

@keyframes aiTyping {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: .5;
    }

    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@keyframes aiChatIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 575px) {
    .ai-chat-button {
        right: 14px;
        bottom: 14px;
        padding: 12px 14px;
    }

    .ai-chat-button strong {
        display: none;
    }

    .ai-chat-window {
        right: 10px;
        left: 10px;
        bottom: 74px;
        width: auto;
        height: min(580px, calc(100vh - 92px));
        border-radius: 24px;
    }
}
.ai-chat-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    margin: 8px 6px 2px 0;
    padding: 9px 13px;
    border-radius: 999px;
    color: #fff !important;
    background: linear-gradient(135deg, #2563eb, #14b8a6);
    font-size: 13px;
    font-weight: 900;
    text-decoration: none !important;
    box-shadow: 0 10px 24px rgba(37,99,235,.20);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.ai-chat-link-btn:hover {
    transform: translateY(-2px);
    color: #fff !important;
    filter: brightness(.98);
    box-shadow: 0 14px 32px rgba(37,99,235,.28);
}

.ai-msg.user .ai-chat-link-btn {
    background: rgba(255,255,255,.18);
    box-shadow: none;
}
.ai-chat-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    margin: 8px 6px 2px 0;
    padding: 9px 13px;
    border-radius: 999px;
    color: #fff !important;
    background: linear-gradient(135deg, #2563eb, #14b8a6);
    font-size: 13px;
    font-weight: 900;
    text-decoration: none !important;
    box-shadow: 0 10px 24px rgba(37,99,235,.20);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.ai-chat-link-btn:hover {
    transform: translateY(-2px);
    color: #fff !important;
    filter: brightness(.98);
    box-shadow: 0 14px 32px rgba(37,99,235,.28);
}
.ai-chat-button span i {
    font-size: 16px;
    line-height: 1;
}