.adata-aichat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    font-family: inherit;
}

/* ---------- Toggle button ---------- */

.adata-aichat-toggle {
    height: 56px;
    min-width: 56px;
    border-radius: 28px;
    background: linear-gradient(135deg, #2079e0, #1858ab);
    color: #fff;
    border: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    transition: padding 0.35s ease, transform 0.15s ease;
}

.adata-aichat-toggle:hover {
    background: linear-gradient(135deg, #1c6dd0, #14488a);
}

.adata-aichat-toggle:active {
    transform: scale(0.96);
}

.adata-aichat-toggle-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex: 0 0 auto;
}

.adata-aichat-toggle-label {
    display: flex;
    align-items: center;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.35s ease, opacity 0.25s ease, padding-right 0.35s ease;
}

.adata-aichat-toggle.is-expanded {
    padding-right: 4px;
}

.adata-aichat-toggle.is-expanded .adata-aichat-toggle-label {
    max-width: 220px;
    opacity: 1;
    padding-right: 14px;
    transition: max-width 0.35s ease, opacity 0.35s ease 0.1s, padding-right 0.35s ease;
}

.adata-aichat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3fd67a;
    margin-right: 6px;
    flex: 0 0 auto;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.adata-aichat-notify-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff4d4f;
    border: 2px solid #fff;
}

/* Periodic attention pulse, only used before the visitor has opened the chat */
@keyframes adata-aichat-pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(32, 121, 224, 0.55); }
    70% { box-shadow: 0 0 0 14px rgba(32, 121, 224, 0); }
    100% { box-shadow: 0 0 0 0 rgba(32, 121, 224, 0); }
}

.adata-aichat-toggle.is-pulsing {
    animation: adata-aichat-pulse-ring 1.4s ease-out;
}

/* ---------- Panel ---------- */

.adata-aichat-panel {
    width: 340px;
    max-width: calc(100vw - 32px);
    height: 480px;
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: adata-aichat-panel-in 0.22s ease;
}

@keyframes adata-aichat-panel-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.adata-aichat-header {
    background: linear-gradient(135deg, #2079e0, #1858ab);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.adata-aichat-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.adata-aichat-header-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.adata-aichat-header-text span {
    font-size: 12px;
    opacity: 0.9;
}

.adata-aichat-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
}

.adata-aichat-close:focus-visible,
.adata-aichat-toggle:focus-visible,
.adata-aichat-send:focus-visible,
.adata-aichat-chip:focus-visible,
.adata-aichat-scroll-latest:focus-visible,
.adata-aichat-form input:focus-visible {
    outline: 2px solid #ffb703;
    outline-offset: 2px;
}

/* ---------- Messages ---------- */

.adata-aichat-messages-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
}

.adata-aichat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #f5f7fa;
}

.adata-aichat-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.adata-aichat-scroll-latest {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #d7dbe0;
    color: #1c6dd0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.adata-aichat-bubble {
    max-width: 85%;
    padding: 10px 12px;
    margin: 6px 0;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    animation: adata-aichat-bubble-in 0.22s ease;
}

@keyframes adata-aichat-bubble-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.adata-aichat-bubble--assistant {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e2e6ea;
    color: #222;
    border-bottom-left-radius: 4px;
}

.adata-aichat-bubble--user {
    align-self: flex-end;
    background: #1c6dd0;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Tighten spacing + squarer inner corner for consecutive bubbles from the same sender */
.adata-aichat-bubble--grouped.adata-aichat-bubble--assistant {
    border-top-left-radius: 4px;
    margin-top: -2px;
}

.adata-aichat-bubble--grouped.adata-aichat-bubble--user {
    border-top-right-radius: 4px;
    margin-top: -2px;
}

.adata-aichat-typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 3px;
    border-radius: 50%;
    background: #999;
    animation: adata-aichat-blink 1.2s infinite ease-in-out;
}

.adata-aichat-typing span:nth-child(2) { animation-delay: 0.2s; }
.adata-aichat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes adata-aichat-blink {
    0%, 80%, 100% { opacity: 0.2; }
    40% { opacity: 1; }
}

/* ---------- Suggestions ---------- */

.adata-aichat-suggestions {
    padding: 0 14px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #f5f7fa;
    opacity: 1;
    max-height: 100px;
    transition: opacity 0.25s ease, max-height 0.3s ease, padding 0.3s ease;
}

.adata-aichat-suggestions.is-hiding {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

.adata-aichat-chip {
    background: #eaf1fb;
    color: #1c6dd0;
    border: 1px solid #cfe0f7;
    border-radius: 14px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.adata-aichat-chip:hover {
    background: #dcebfa;
}

.adata-aichat-chip:active {
    transform: scale(0.97);
}

/* ---------- Input form ---------- */

.adata-aichat-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #e2e6ea;
}

.adata-aichat-form input {
    flex: 1;
    border: 1px solid #d7dbe0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
}

.adata-aichat-send {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #1c6dd0;
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.adata-aichat-send:hover {
    background: #1558ab;
}

.adata-aichat-send:disabled {
    opacity: 0.5;
    cursor: default;
}

.adata-aichat-powered {
    text-align: center;
    font-size: 11px;
    color: #9aa2ab;
    padding: 6px 0 10px;
}

/* ---------- Mobile ---------- */

@media (max-width: 480px) {
    .adata-aichat {
        right: 12px;
        bottom: 12px;
    }

    .adata-aichat-panel {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        top: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
}
