#aica-chat-widget .aica-chat-icon{
    background-color: var(--aica-accent, #2e7df6);
    color:#fff;
}

#aica-chat-widget .aica-send{
    background-color: var(--aica-accent, #2e7df6);
    color:#fff;
}
/* پالس نرم و آروم با دو تپش کوتاه */
#aica-chat-widget .aica-chat-icon.pulse {
    animation: aica-pulse var(--aica-pulse-interval, 8s) infinite cubic-bezier(.25,.8,.25,1);
    will-change: transform, box-shadow;
}

@keyframes aica-pulse {
    /* حالت عادی */
    0%, 70%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px var(--aica-shadow-color, rgba(0,0,0,.18));
    }

    /* تپش اول (خیلی ملایم) */
    3% {
        transform: scale(1.028);
        box-shadow: 0 8px 18px var(--aica-shadow-color, rgba(0,0,0,.20));
    }
    6% {
        transform: scale(1.000);
        box-shadow: 0 4px 12px var(--aica-shadow-color, rgba(0,0,0,.18));
    }

    /* تپش دوم (از اول هم ملایم‌تر) */
    11% {
        transform: scale(1.02);
        box-shadow: 0 7px 16px var(--aica-shadow-color, rgba(0,0,0,.19));
    }
    14% {
        transform: scale(1.000);
        box-shadow: 0 4px 12px var(--aica-shadow-color, rgba(0,0,0,.18));
    }
}

/* احترام به تنظیمات دسترسی کاربر: اگر کاربر حرکت کمتر می‌خواد، پالس خاموش */
@media (prefers-reduced-motion: reduce) {
    #aica-chat-widget .aica-chat-icon.pulse { animation: none; }
}

/* نشان «هوش مصنوعی» بالای دکمه */
#aica-chat-widget .aica-chat-icon{ position: relative; }

#aica-chat-widget .aica-chat-icon.has-ai-badge::after{
    content: attr(data-ai-badge);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translate(-50%, -8px);
    background: var(--aica-badge-bg, #0ea5e9);
    color: var(--aica-badge-color, #fff);
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 6px 16px rgba(0,0,0,.12);
    pointer-events: none;
}

#aica-chat-widget .aica-chat-icon.has-ai-badge::before{
    content: "";
    position: absolute;
    bottom: calc(100% - 3px);
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px; height: 8px;
    background: var(--aica-badge-bg, #0ea5e9);
    box-shadow: 0 6px 16px rgba(0,0,0,.12);
    pointer-events: none;
}

#aica-chat-widget{
    position: fixed;
    bottom: var(--aica-offset-bottom, 20px); /* ← این */
    z-index: 999999;
    direction: rtl;
}

#aica-chat-widget * {
    font-family: var(--aica-font-family, 'yekan'), sans-serif !important;
}

#aica-chat-widget.right,
#aica-chat-widget.pos-right { right: var(--aica-offset-right, 20px); }

#aica-chat-widget.left,
#aica-chat-widget.pos-left  { left:  var(--aica-offset-left, 20px); }
[type=button]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled) {
    cursor: pointer;
    
    width: 40px;
    height: 40px;
    border-radius: 15px;
}
.aica-chat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--aica-icon-color, #0066ff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--aica-shadow-color, rgba(0, 102, 255, 0.3)); /* ← این خط */
    transition: all 0.3s ease;
    padding: 0;
    margin: 0;
}

.aica-chat-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 102, 255, 0.4);
}

.aica-chat-icon svg {
    width: 32px;
    height: 32px;
    fill: white;
    display: block;
}

.aica-chat-container {
    position: fixed;
    bottom: 90px;
    width: 350px;
    height: 600px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
    /* display: none; */
    flex-direction: column;
    overflow: hidden;
}
#aica-chat-widget.right .aica-chat-container {
    right: 20px;
}

#aica-chat-widget.left .aica-chat-container {
    left: 20px;
}

.aica-chat-header {
    height: 55px; /* Fixed height for header */
    padding: 15px 20px;
    background: #fff;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto;
}

.aica-chat-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.aica-chat-header h3::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    background: url('https://hinotif.ir/finger.svg') center/contain no-repeat;
}

.aica-close {
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: #999;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.aica-close:hover {
    opacity: 1;
}

.aica-chat-messages {
    flex: 1;
    overflow-y: scroll;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f8f9fa;
    min-height: 0;
    height: calc(100% - 130px); /* Header (55px) + Input (75px) */
}

.aica-message {
    max-width: 85%;
    position: relative;
    line-height: 1.5;
    font-size: 13px;
}

.aica-message p {
    margin: 0;
    padding: 12px 16px;
    border-radius: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.aica-message.user {
    align-self: flex-end;
}

.aica-message.user p {
    background: #eef2ff;
    color: #333;
    border-bottom-right-radius: 5px;
}

.aica-message.bot {
    align-self: flex-start;
}

.aica-message.bot p {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.aica-message.error {
    align-self: center;
    max-width: 90%;
}

.aica-message.error p {
    background: #fff0f0;
    color: #ff4444;
    border-radius: 8px;
}

.aica-chat-input-wrapper {

    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #eee;
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
}

.aica-chat-input {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 8px 12px;
}

.aica-chat-input textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    padding: 0;
    min-height: 24px;
    max-height: 100px;
    line-height: 1.5;
    font-size: 13px;
    outline: none;
    color: #333;
}

.aica-chat-input textarea::placeholder {
    color: #999;
}

.aica-attach {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
    color: #999;
}

.aica-send {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
    color: #0066ff;
}

.aica-attach:hover,
.aica-send:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.aica-attach:active,
.aica-send:active {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Default send icon */
.aica-send:not(:has(svg))::before {
    content: '';
    width: 20px;
    height: 20px;
    background: url('https://hinotif.ir/12.svg') center / contain no-repeat;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Default attachment icon */
.aica-attach:not(:has(svg))::before {
    content: '';
    width: 20px;
    height: 20px;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999999"><path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.aica-message .time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    display: block;
    text-align: right;
    padding: 0 2px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 3px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 15px;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin: 0;
}

.typing-indicator span {
    width: 5px;
    height: 5px;
    background: #999;
    border-radius: 50%;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Scrollbar Styling */
.aica-chat-messages::-webkit-scrollbar {
    width: 15px;
}

.aica-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.aica-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.aica-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
} 