.aichat-widget {
    --aichat-main: var(--main-color, #0fb583);
    --aichat-main2: var(--main2-color, #b6e9da);
    --aichat-text-dark: var(--text-dark, #4d4d4d);
    --aichat-radius: var(--border-radius, 8px);
    --aichat-shadow: var(--box-shadow-hover, 0 .5rem 1.5rem rgba(0, 0, 0, .18));
    direction: rtl;
    font-family: "yekanBakh", Tahoma, sans-serif;
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 99990;
}

.aichat-widget * {
    box-sizing: border-box;
}

.aichat-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--aichat-main);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--aichat-shadow);
    transition: transform .2s ease;
    padding: 0;
}

.aichat-bubble:hover {
    transform: scale(1.06);
}

.aichat-bubble svg {
    width: 28px;
    height: 28px;
}

.aichat-bubble .aichat-bubble-close-icon {
    display: none;
}

.aichat-widget.is-open .aichat-bubble .aichat-bubble-chat-icon {
    display: none;
}

.aichat-widget.is-open .aichat-bubble .aichat-bubble-close-icon {
    display: block;
}

.aichat-panel {
    position: absolute;
    bottom: 76px;
    left: 0;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: calc(var(--aichat-radius) * 2);
    box-shadow: var(--aichat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(.98);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

.aichat-widget.is-open .aichat-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.aichat-header {
    background: var(--aichat-main);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

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

.aichat-header-icon svg {
    width: 18px;
    height: 18px;
}

.aichat-header-title {
    font-weight: 700;
    font-size: 15px;
}

.aichat-header-subtitle {
    font-size: 12px;
    opacity: .85;
}

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

.aichat-msg {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.9;
    white-space: pre-wrap;
    word-break: break-word;
}

.aichat-msg-user {
    align-self: flex-end;
    background: var(--aichat-main);
    color: #fff;
    border-bottom-left-radius: 4px;
}

.aichat-msg-assistant {
    align-self: flex-start;
    background: #fff;
    color: var(--aichat-text-dark);
    border: 1px solid #ececec;
    border-bottom-right-radius: 4px;
}

.aichat-msg a {
    color: inherit;
    text-decoration: underline;
}

.aichat-msg-user a {
    color: #fff;
}

.aichat-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 14px;
}

.aichat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #bbb;
    animation: aichat-blink 1.2s infinite ease-in-out;
}

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

@keyframes aichat-blink {
    0%, 80%, 100% { opacity: .3; transform: scale(.8); }
    40% { opacity: 1; transform: scale(1); }
}

.aichat-rate {
    align-self: center;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 14px;
    padding: 10px 14px;
    text-align: center;
    font-size: 12.5px;
    color: var(--aichat-text-dark);
}

.aichat-rate-stars {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 6px;
}

.aichat-rate-stars button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #dcdcdc;
    padding: 2px;
}

.aichat-rate-stars button.is-active {
    color: #f5b400;
}

.aichat-rate-selected {
    min-height: 16px;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #f5b400;
}

.aichat-rate-submit {
    margin-top: 8px;
    border: none;
    border-radius: 14px;
    padding: 7px 18px;
    background: var(--aichat-main);
    color: #fff;
    font-family: inherit;
    font-size: 12.5px;
    cursor: pointer;
}

.aichat-rate-submit:disabled {
    background: #dcdcdc;
    cursor: default;
}

.aichat-rate-done {
    color: var(--aichat-main);
    font-weight: 700;
}

.aichat-input-row {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #eee;
    background: #fff;
}

.aichat-input {
    flex: 1 1 auto;
    resize: none;
    border: 1px solid #e2e2e2;
    border-radius: 18px;
    padding: 9px 14px;
    font-family: inherit;
    font-size: 13.5px;
    max-height: 90px;
    outline: none;
}

.aichat-input:focus {
    border-color: var(--aichat-main);
}

.aichat-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--aichat-main);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}

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

.aichat-send svg {
    width: 17px;
    height: 17px;
    transform: scaleX(-1);
}

@media (max-width: 480px) {
    .aichat-widget {
        left: 12px;
        /* the site's own fixed bottom mobile nav bar (#navigation) is
           ~74px tall - sit above it instead of overlapping it. */
        bottom: 86px;
    }

    .aichat-bubble {
        width: 54px;
        height: 54px;
    }

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