.ai-chatbot {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1050;
    font-family: "Be Vietnam Pro", "Segoe UI", sans-serif;
}

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

.ai-chatbot__toggle {
    position: relative;
    overflow: hidden;
    width: 66px;
    height: 66px;
    border: 0;
    border-radius: 22px;
    color: #fff;
    cursor: pointer;
    background:
        radial-gradient(circle at 24% 26%, rgba(255, 255, 255, 0.34), transparent 32%),
        radial-gradient(circle at 74% 32%, rgba(255, 161, 161, 0.38), transparent 30%),
        radial-gradient(circle at 62% 78%, rgba(127, 29, 29, 0.52), transparent 38%),
        linear-gradient(145deg, rgba(239, 68, 68, 0.92), rgba(127, 29, 29, 0.9));
    box-shadow:
        0 20px 48px rgba(127, 29, 29, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.26),
        inset 0 -10px 20px rgba(127, 29, 29, 0.25);
    backdrop-filter: blur(22px) saturate(130%);
    -webkit-backdrop-filter: blur(22px) saturate(130%);
    transition: transform 0.24s ease, box-shadow 0.24s ease;
    isolation: isolate;
}

.ai-chatbot__toggle::before,
.ai-chatbot__toggle::after {
    content: "";
    position: absolute;
    inset: auto;
    border-radius: 45% 55% 60% 40% / 42% 44% 56% 58%;
    pointer-events: none;
}

.ai-chatbot__toggle::before {
    width: 54px;
    height: 54px;
    top: -8px;
    left: -6px;
    background:
        radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.08) 42%, transparent 70%),
        radial-gradient(circle at 60% 70%, rgba(255, 190, 190, 0.34), transparent 62%);
    filter: blur(3px);
    opacity: 0.95;
    animation: aiChatbotOilFloat 6.4s ease-in-out infinite alternate;
}

.ai-chatbot__toggle::after {
    width: 44px;
    height: 44px;
    right: -8px;
    bottom: -6px;
    background:
        radial-gradient(circle at 50% 50%, rgba(127, 29, 29, 0.12), rgba(153, 27, 27, 0.46) 56%, transparent 72%),
        radial-gradient(circle at 30% 30%, rgba(255, 210, 210, 0.18), transparent 55%);
    filter: blur(4px);
    opacity: 0.9;
    animation: aiChatbotOilFloat 5.8s ease-in-out infinite reverse;
}

.ai-chatbot__toggle i {
    position: relative;
    z-index: 1;
    font-size: 22px;
    text-shadow: 0 6px 16px rgba(127, 29, 29, 0.4);
}

.ai-chatbot__toggle:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 28px 56px rgba(127, 29, 29, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.32),
        inset 0 -12px 24px rgba(127, 29, 29, 0.3);
}

.ai-chatbot__toggle:focus-visible {
    outline: 2px solid rgba(254, 202, 202, 0.9);
    outline-offset: 4px;
}

.ai-chatbot__panel {
    position: absolute;
    right: 78px;
    bottom: 0;
    width: min(350px, calc(100vw - 108px));
    border-radius: 28px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(15, 23, 42, 0.86));
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 32px 70px rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    color: #e2e8f0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.98);
    transform-origin: right bottom;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.ai-chatbot.is-open .ai-chatbot__panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.ai-chatbot__header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 16px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.72), rgba(30, 64, 175, 0.18));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-chatbot__title strong {
    display: block;
    font-size: 17px;
    line-height: 1.2;
    color: #fff;
}

.ai-chatbot__title span {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: rgba(226, 232, 240, 0.78);
}

.ai-chatbot__actions {
    display: flex;
    gap: 8px;
}

.ai-chatbot__icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    cursor: pointer;
}

.ai-chatbot__body {
    max-height: 52vh;
    overflow-y: auto;
    padding: 18px 16px 10px;
    scroll-behavior: smooth;
}

.ai-chatbot__message {
    margin-bottom: 14px;
    display: flex;
    opacity: 0;
    transform: translateY(6px);
    animation: aiChatbotMessageIn 0.18s ease forwards;
}

.ai-chatbot__message.is-user {
    justify-content: flex-end;
}

.ai-chatbot__bubble {
    max-width: 88%;
    padding: 13px 15px;
    border-radius: 18px;
    line-height: 1.62;
    font-size: 13px;
    white-space: pre-line;
}

.ai-chatbot__message.is-assistant .ai-chatbot__bubble {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.ai-chatbot__message.is-user .ai-chatbot__bubble {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.92), rgba(37, 99, 235, 0.92));
    color: #fff;
}

.ai-chatbot__links {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.ai-chatbot__links li + li {
    margin-top: 8px;
}

.ai-chatbot__links a {
    color: #bfdbfe;
    text-decoration: none;
}

.ai-chatbot__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 12px;
}

.ai-chatbot__chip {
    flex: 0 1 calc(50% - 3px);
    max-width: calc(50% - 3px);
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    white-space: normal;
    line-height: 1.35;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.07);
    color: #e2e8f0;
    padding: 8px 10px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 11px;
}

.ai-chatbot__footer {
    padding: 14px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.24);
}

.ai-chatbot__composer {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.ai-chatbot__input {
    width: 100%;
    min-height: 52px;
    max-height: 120px;
    padding: 13px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    resize: none;
    outline: none;
}

.ai-chatbot__submit {
    border: 0;
    border-radius: 16px;
    min-width: 84px;
    height: 52px;
    cursor: pointer;
    color: #fff;
    background: radial-gradient(circle at 24% 26%, rgba(255, 255, 255, 0.34), transparent 32%), radial-gradient(circle at 74% 32%, rgba(255, 161, 161, 0.38), transparent 30%), radial-gradient(circle at 62% 78%, rgba(127, 29, 29, 0.52), transparent 38%), linear-gradient(145deg, rgba(239, 68, 68, 0.92), rgba(127, 29, 29, 0.9));
}

.ai-chatbot__submit:disabled,
.ai-chatbot__input:disabled {
    opacity: 0.72;
    cursor: not-allowed;
}

.ai-chatbot__hint {
    margin-top: 10px;
    font-size: 11px;
    color: rgba(226, 232, 240, 0.68);
}

@media (max-width: 575px) {
    .ai-chatbot__chip {
        flex-basis: 100%;
        max-width: 100%;
    }
}

.ai-chatbot__typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ai-chatbot__typing span {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    animation: aiChatbotPulse 1s infinite ease-in-out;
}

.ai-chatbot__typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.ai-chatbot__typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes aiChatbotPulse {
    0%, 80%, 100% {
        opacity: 0.35;
        transform: scale(0.92);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes aiChatbotMessageIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes aiChatbotOilFloat {
    0% {
        transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
        border-radius: 45% 55% 60% 40% / 42% 44% 56% 58%;
    }
    50% {
        transform: translate3d(3px, 4px, 0) scale(1.08) rotate(7deg);
        border-radius: 58% 42% 48% 52% / 44% 61% 39% 56%;
    }
    100% {
        transform: translate3d(-2px, 6px, 0) scale(0.96) rotate(-6deg);
        border-radius: 40% 60% 44% 56% / 59% 41% 63% 37%;
    }
}

@media (max-width: 767px) {
    .ai-chatbot {
        right: 12px;
        bottom: 12px;
    }

    .ai-chatbot__panel {
        width: calc(100vw - 24px);
        right: 0;
        bottom: 78px;
    }

    .ai-chatbot__body {
        max-height: 46vh;
    }
}
