/* Typing indicator hidden until JS shows it */
.aht-chat-typing[hidden] { display: none !important; }

/* ── Inline embed ─────────────────────────────────────────────────────────── */
.aht-ai-chat--inline {
    max-width: 700px;
    margin: 0 auto;
}

/* ── Floating widget ──────────────────────────────────────────────────────── */
.aht-ai-chat--float {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9990;
}

/* ── Toggle button ────────────────────────────────────────────────────────── */
.aht-chat-toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px 22px;
    border: none;
    border-radius: 999px;
    background: #0b5ed7;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer !important;
    pointer-events: auto !important;
    position: relative;
    z-index: 9991;
    box-shadow: 0 8px 28px rgba(11, 94, 215, .38);
    transition: background .15s, transform .12s, box-shadow .15s;
}
.aht-chat-toggle:hover {
    background: #0a4fc0;
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(11, 94, 215, .45);
}
.aht-chat-toggle:active { transform: translateY(0); }

/* ── Chat window ──────────────────────────────────────────────────────────── */
.aht-chat-window {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px;
    border: 1px solid #d8e0ea;
    box-shadow: 0 16px 48px rgba(6, 24, 44, .16);
    overflow: hidden;
}
.aht-ai-chat--inline .aht-chat-window {
    height: 540px;
}
.aht-ai-chat--float .aht-chat-window {
    position: absolute;
    bottom: 62px;
    right: 0;
    width: 360px;
    height: 500px;
}

/* ── Header (float only) ──────────────────────────────────────────────────── */
.aht-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    background: #0b5ed7;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}
.aht-chat-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, .85);
    cursor: pointer !important;
    font-size: 15px;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: background .12s;
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
}
.aht-chat-close:hover { background: rgba(255, 255, 255, .18); color: #fff; }

/* ── Messages ─────────────────────────────────────────────────────────────── */
.aht-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.aht-chat-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.aht-chat-msg--ai   { justify-content: flex-start; }
.aht-chat-msg--user { justify-content: flex-end; }

.aht-chat-bubble {
    max-width: 78%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.55;
    border-radius: 18px;
    word-break: break-word;
}
.aht-chat-msg--ai   .aht-chat-bubble {
    background: #edf3ff;
    color: #1a2a44;
    border-bottom-left-radius: 4px;
}
.aht-chat-msg--user .aht-chat-bubble {
    background: #0b5ed7;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* ── Typing indicator ─────────────────────────────────────────────────────── */
.aht-chat-typing {
    display: flex;
    gap: 5px;
    padding: 6px 18px 10px;
    align-items: center;
    flex-shrink: 0;
}
.aht-chat-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9db4d0;
    animation: aht-bounce 1.3s infinite ease-in-out;
}
.aht-chat-typing span:nth-child(2) { animation-delay: .22s; }
.aht-chat-typing span:nth-child(3) { animation-delay: .44s; }
@keyframes aht-bounce {
    0%, 80%, 100% { transform: scale(0.65); opacity: .55; }
    40%            { transform: scale(1);    opacity: 1;   }
}

/* ── Ended notice ─────────────────────────────────────────────────────────── */
.aht-chat-ended {
    text-align: center;
    padding: 8px 16px 10px;
    font-size: 13px;
    color: #526172;
    border-top: 1px solid #edf1f7;
    flex-shrink: 0;
}
.aht-chat-ended p { margin: 0; }

/* ── Input form ───────────────────────────────────────────────────────────── */
.aht-chat-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #edf1f7;
    flex-shrink: 0;
    align-items: center;
}
.aht-chat-input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid #c8d4e4;
    border-radius: 999px;
    font-size: 14px;
    color: #1a2a44;
    outline: none;
    background: #f7fafc;
    min-width: 0;
}
.aht-chat-input:focus {
    border-color: #0b5ed7;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(11, 94, 215, .14);
}
.aht-chat-send {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: #0b5ed7;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .14s;
}
.aht-chat-send:hover   { background: #0a4fc0; }
.aht-chat-send:disabled { opacity: .45; cursor: default; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .aht-ai-chat--float { bottom: 16px; right: 16px; }
    .aht-ai-chat--float .aht-chat-window { width: calc(100vw - 32px); right: 0; }
}
