/* استایل چت‌بات */
.acs-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Vazir', Arial, sans-serif;
    direction: rtl;
}

.acs-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.acs-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.acs-chat-button svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.acs-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.acs-chat-window.active {
    display: flex;
}

.acs-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.acs-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.acs-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.acs-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.acs-message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}

.acs-message.user {
    justify-content: flex-end;
}

.acs-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
}

.acs-message.user .acs-message-content {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.acs-message.bot .acs-message-content {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.acs-chat-input {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: white;
}

.acs-input-group {
    display: flex;
    gap: 10px;
}

.acs-input-group input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.acs-input-group input:focus {
    border-color: #007bff;
}

.acs-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #007bff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.acs-send-button:hover {
    background: #0056b3;
}

.acs-send-button svg {
    width: 16px;
    height: 16px;
    fill: white;
}

.acs-typing {
    display: none;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80%;
}

.acs-typing-dots {
    display: flex;
    gap: 4px;
}

.acs-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite ease-in-out;
}

.acs-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.acs-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ریسپانسیو */
@media (max-width: 480px) {
    .acs-chat-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .acs-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
    }
}

/* استایل‌های تماس صوتی */
.acs-widget-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.acs-voice-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.acs-voice-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.acs-voice-button svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.acs-voice-window {
    position: absolute;
    bottom: 150px;
    right: 0;
    width: 280px;
    height: 320px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.acs-voice-window.active {
    display: flex;
}

.acs-voice-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.acs-voice-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.acs-voice-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.acs-voice-content {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.acs-voice-status {
    text-align: center;
}

.acs-voice-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.acs-voice-avatar svg {
    width: 24px;
    height: 24px;
    fill: #6c757d;
}

.acs-voice-message {
    color: #666;
    font-size: 12px;
    margin: 0;
    line-height: 1.3;
}

.acs-voice-controls {
    text-align: center;
}

.acs-mic-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin: 0 auto 8px;
}

.acs-mic-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.acs-mic-button.listening {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    animation: pulse 1.5s infinite;
}

.acs-mic-button svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.acs-mic-status {
    color: #666;
    font-size: 11px;
    font-weight: 500;
}

.acs-voice-transcript,
.acs-voice-response {
    display: none; /* مخفی کردن برای صرفه‌جویی در فضا */
}

/* نمایش ساده وضعیت */
.acs-simple-status {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 8px;
    font-size: 11px;
    color: #666;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
}

.acs-simple-status.listening {
    background: #e8f5e8;
    border-color: #28a745;
    color: #155724;
}

.acs-simple-status.speaking {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #0d47a1;
}

/* انیمیشن pulse برای دکمه میکروفون */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* انیمیشن صوت */
.acs-voice-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin: 10px 0;
}

.acs-voice-wave span {
    width: 3px;
    height: 20px;
    background: #28a745;
    border-radius: 2px;
    animation: wave 1.2s infinite ease-in-out;
}

.acs-voice-wave span:nth-child(1) { animation-delay: -1.1s; }
.acs-voice-wave span:nth-child(2) { animation-delay: -1.0s; }
.acs-voice-wave span:nth-child(3) { animation-delay: -0.9s; }
.acs-voice-wave span:nth-child(4) { animation-delay: -0.8s; }
.acs-voice-wave span:nth-child(5) { animation-delay: -0.7s; }

@keyframes wave {
    0%, 40%, 100% {
        transform: scaleY(0.4);
    }
    20% {
        transform: scaleY(1.0);
    }
}

/* ریسپانسیو برای تماس صوتی */
@media (max-width: 480px) {
    .acs-voice-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 80px;
        right: 10px;
        left: 10px;
    }
    
    .acs-widget-buttons {
        flex-direction: column;
        gap: 15px;
        position: fixed;
        bottom: 20px;
        right: 20px;
    }
    
    .acs-chat-button,
    .acs-voice-button {
        width: 70px;
        height: 70px;
    }
    
    .acs-chat-button svg,
    .acs-voice-button svg {
        width: 28px;
        height: 28px;
    }
    
    .acs-voice-content {
        padding: 15px;
        gap: 15px;
    }
    
    .acs-voice-avatar {
        width: 80px;
        height: 80px;
    }
    
    .acs-mic-button {
        width: 90px;
        height: 90px;
    }
    
    .acs-mic-button svg {
        width: 36px;
        height: 36px;
    }
    
    .acs-transcript-area,
    .acs-response-area {
        min-height: 70px;
        max-height: 100px;
        font-size: 16px;
        padding: 12px;
    }
    
    .acs-voice-header h3 {
        font-size: 18px;
    }
    
    .acs-voice-message {
        font-size: 16px;
    }
    
    .acs-mic-status {
        font-size: 14px;
    }
}