/**
 * HeroAI Chatbot Styles - Enhanced Version
 */

.st-ai-chatbot {
    position: fixed;
    z-index: 99999;
    font-family: inherit;
}

.st-ai-chat-bottom-right {
    bottom: 20px;
    right: 20px;
}

.st-ai-chat-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* دکمه اصلی */
.st-ai-chat-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    color: #fff;
    font-size: 26px;
    position: relative;
}

.st-ai-chat-toggle:hover {
    transform: scale(1.1);
}

/* افکت ضربان قلب */
.st-ai-chat-toggle.st-ai-effect-pulse::before,
.st-ai-chat-toggle.st-ai-effect-pulse::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--st-ai-btn-color, #1abc9c);
    opacity: 0.4;
    z-index: -1;
    animation: st-ai-pulse-heart 1.8s infinite;
}

.st-ai-chat-toggle.st-ai-effect-pulse::after {
    animation-delay: 0.9s;
}

@keyframes st-ai-pulse-heart {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* افکت درخشش */
.st-ai-chat-toggle.st-ai-effect-glow {
    animation: st-ai-glow 2s infinite alternate;
}

@keyframes st-ai-glow {
    from { box-shadow: 0 6px 20px rgba(0,0,0,0.2), 0 0 0 0 var(--st-ai-btn-color, #1abc9c); }
    to { box-shadow: 0 6px 25px rgba(0,0,0,0.3), 0 0 25px 5px rgba(26,188,156,0.4); }
}

/* افکت موج */
.st-ai-chat-toggle.st-ai-effect-wave::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid var(--st-ai-btn-color, #1abc9c);
    opacity: 0;
    animation: st-ai-wave 2s infinite;
}

@keyframes st-ai-wave {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* باکس پیش‌نمایش - مستطیل افقی */
.st-ai-preview-box {
    position: absolute;
    bottom: 16px;
    background: #fff;
    padding: 10px 18px;
    border-radius: 22px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    font-size: 13px;
    color: #333;
    width: auto;
    min-width: 180px;
    max-width: 260px;
    white-space: nowrap;
    line-height: 1.4;
    animation: st-ai-bounce 2s infinite;
    border: 1px solid rgba(0,0,0,0.05);
    text-align: center;
}

.st-ai-chat-bottom-right .st-ai-preview-box {
    right: 76px;
}

.st-ai-chat-bottom-left .st-ai-preview-box {
    left: 76px;
}

.st-ai-preview-box::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border: 8px solid transparent;
}

.st-ai-chat-bottom-right .st-ai-preview-box::after {
    right: -8px;
    border-left-color: #fff;
    border-right: 0;
}

.st-ai-chat-bottom-left .st-ai-preview-box::after {
    left: -8px;
    border-right-color: #fff;
    border-left: 0;
}

@keyframes st-ai-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* پنجره چت */
.st-ai-chat-window {
    display: none;
    position: absolute;
    bottom: 80px;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    flex-direction: column;
    animation: st-ai-slide-up 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes st-ai-slide-up {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.st-ai-chat-bottom-right .st-ai-chat-window {
    right: 0;
}

.st-ai-chat-bottom-left .st-ai-chat-window {
    left: 0;
}

/* هدر */
.st-ai-chat-header {
    padding: 16px 20px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    background: var(--st-ai-header-color, #1abc9c);
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.st-ai-chat-header span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.st-ai-chat-header span::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
    animation: st-ai-status-pulse 2s infinite;
}

@keyframes st-ai-status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.st-ai-chat-minimize {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.st-ai-chat-minimize:hover {
    background: rgba(255,255,255,0.3);
}

/* سوالات متداول - در داخل پیام‌ها */
.st-ai-message-faq {
    max-width: 90% !important;
    padding: 12px 14px !important;
}

.st-ai-faq-title {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
    font-weight: 600;
}

.st-ai-faq-items {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.st-ai-faq-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 5px 11px;
    border-radius: 14px;
    font-size: 12px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.4;
}

.st-ai-faq-item:hover {
    background: var(--st-ai-header-color, #1abc9c);
    color: #fff;
    border-color: var(--st-ai-header-color, #1abc9c);
    transform: translateY(-1px);
}

/* پیام‌ها */
.st-ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    background: #f5f7fa;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.2) transparent;
}

.st-ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.st-ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.st-ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

.st-ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.4);
}

.st-ai-message {
    margin-bottom: 12px;
    display: flex;
    animation: st-ai-message-in 0.3s ease;
}

@keyframes st-ai-message-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.st-ai-message-user {
    justify-content: flex-end;
}

.st-ai-message-bot {
    justify-content: flex-start;
}

.st-ai-message-content {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.st-ai-message-user .st-ai-message-content {
    background: var(--st-ai-header-color, #1abc9c);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.st-ai-message-bot .st-ai-message-content {
    background: #fff;
    color: #2c3e50;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* تایپ */
.st-ai-typing .st-ai-message-content {
    display: flex;
    gap: 5px;
    padding: 14px 16px;
}

.st-ai-typing-dot {
    width: 8px;
    height: 8px;
    background: #95a5a6;
    border-radius: 50%;
    animation: st-ai-typing 1.4s infinite ease-in-out both;
}

.st-ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.st-ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes st-ai-typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ناحیه ارسال - چسبیده به پایین */
.st-ai-chat-input-area {
    display: flex;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e9ecef;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
    position: relative;
}

.st-ai-chat-input-area input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #dee2e6;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
    min-width: 0;
}

.st-ai-chat-input-area input:focus {
    border-color: var(--st-ai-header-color, #1abc9c);
}

.st-ai-chat-input-area button {
    width: 42px;
    height: 42px;
    border: none;
    background: var(--st-ai-header-color, #1abc9c);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.st-ai-chat-input-area button:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(26, 188, 156, 0.4);
}

.st-ai-chat-input-area button:active {
    transform: scale(0.95);
}

/* آیکون send سفید و واضح */
.st-ai-chat-input-area button i,
.st-ai-chat-input-area button svg {
    color: #fff;
    font-size: 16px;
    line-height: 1;
    display: block;
}

/* RTL */
[dir="rtl"] .st-ai-message-user {
    justify-content: flex-start;
}

[dir="rtl"] .st-ai-message-bot {
    justify-content: flex-end;
}

[dir="rtl"] .st-ai-message-user .st-ai-message-content {
    border-bottom-right-radius: 16px;
    border-bottom-left-radius: 4px;
}

[dir="rtl"] .st-ai-message-bot .st-ai-message-content {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 4px;
}

/* موبایل */
@media (max-width: 480px) {
    .st-ai-chat-window {
        position: fixed;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100vw;
        height: calc(100vh - 70px);
        max-height: none;
        border-radius: 16px 16px 0 0;
    }

    .st-ai-chat-toggle {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    .st-ai-preview-box {
        max-width: 150px;
        font-size: 12px;
        padding: 8px 12px;
    }
}