/* Explain: Styling for the AI chat interface. */
/* AI service chat */
.ai-chat {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 22px 50px rgba(11, 42, 91, .1);
}

.ai-chat__head {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
}

.ai-chat__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, .15);
    font-size: 1.15rem;
}

.ai-chat__identity strong {
    display: block;
    font-size: .98rem;
}

.ai-chat__identity span {
    font-size: .78rem;
    color: rgba(255, 255, 255, .75);
}

.ai-chat__badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .7rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, .14);
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}

.ai-chat__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
}

.ai-chat__log {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    height: 360px;
    max-height: 55vh;
    overflow-y: auto;
    padding: 1.25rem;
    background: var(--surface-color);
    scroll-behavior: smooth;
}

.ai-msg {
    display: flex;
}

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

.ai-msg__bubble {
    max-width: 85%;
    padding: .75rem 1rem;
    border-radius: 16px;
    font-size: .92rem;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ai-msg--bot .ai-msg__bubble {
    background: #fff;
    border: 1px solid var(--border-color);
    border-top-left-radius: 4px;
    color: var(--text-color);
}

.ai-msg--user .ai-msg__bubble {
    background: var(--primary-color);
    color: #fff;
    border-top-right-radius: 4px;
}

.ai-msg__bubble--typing {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-height: 40px;
}

.ai-msg__bubble--typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: aiDot 1.1s infinite ease-in-out;
}

.ai-msg__bubble--typing span:nth-child(2) {
    animation-delay: .18s;
}

.ai-msg__bubble--typing span:nth-child(3) {
    animation-delay: .36s;
}

@keyframes aiDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: .45;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.ai-chat__quick {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .9rem 1.25rem 0;
    background: #fff;
}

.ai-chip {
    padding: .5rem .85rem;
    min-height: 40px;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease, background .2s ease;
}

.ai-chip:hover {
    border-color: var(--secondary-color);
    color: var(--primary-color);
    background: rgba(30, 90, 168, .08);
}

.ai-chat__form {
    padding: 1rem 1.25rem 1.25rem;
    background: #fff;
}

.ai-chat__label {
    display: block;
    margin-bottom: .45rem;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ai-chat__row {
    display: flex;
    align-items: stretch;
    gap: .5rem;
}

.ai-chat__input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 48px;
    padding: .7rem 1rem;
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    background: #fff;
    color: var(--text-color);
    font-size: .95rem;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.ai-chat__input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(30, 90, 168, .15);
}

.ai-chat__input::placeholder {
    color: var(--text-muted);
    opacity: .8;
}

.ai-chat__send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    min-height: 48px;
    flex-shrink: 0;
    border-radius: 12px;
    border: none;
    background: var(--accent-color);
    color: #fff;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background .2s ease;
}

.ai-chat__send:hover {
    background: var(--accent-hover);
}

.ai-chat__send:disabled,
.ai-chat__input:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.ai-chat__disclaimer {
    padding: 0 1.25rem 1.25rem;
    font-size: .78rem;
    line-height: 1.6;
    color: var(--text-muted);
    background: #fff;
}

.ai-chat__wa {
    font-weight: 700;
    color: var(--primary-color);
}

@media (max-width: 420px) {
    .ai-chat__badge {
        display: none;
    }

    .ai-chat__log {
        height: 320px;
    }
}