/**
 * استایل چت بات شناور
 */

/* دکمه شناور */
.chatbot-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    transition: all 0.3s ease;
    color: white;
    font-size: 24px;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.chatbot-button-active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* پنل چت */
.chatbot-panel {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    direction: rtl;
}

.chatbot-panel-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

/* هدر چت */
.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chatbot-header-text h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chatbot-status {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* پیام‌ها */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.chatbot-message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message-user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.chatbot-message-bot .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.chatbot-message-user .message-avatar {
    background: #e9ecef;
    color: #495057;
}

.message-content {
    flex: 1;
    max-width: 75%;
}

.message-content p {
    margin: 0;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message-bot .message-content p {
    background: white;
    color: #333;
    border-bottom-right-radius: 4px;
}

.chatbot-message-user .message-content p {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-left-radius: 4px;
}

.message-content a {
    color: #667eea;
    text-decoration: underline;
}

.message-content .emoji {
    font-size: 1.2em;
}

/* Typing indicator */
.chatbot-typing .message-content {
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ورودی */
.chatbot-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 20px 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    direction: rtl;
}

.chatbot-input:focus {
    border-color: #667eea;
}

.chatbot-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chatbot-send:hover {
    transform: scale(1.1);
}

.chatbot-send:active {
    transform: scale(0.95);
}

/* Responsive */
@media (max-width: 768px) {
    .chatbot-panel {
        width: calc(100vw - 20px);
        left: 10px;
        bottom: 80px;
        height: calc(100vh - 100px);
    }
    
    .chatbot-button {
        left: 15px;
        bottom: 15px;
        width: 55px;
        height: 55px;
    }
}

@media (max-width: 480px) {
    .chatbot-panel {
        left: 0;
        bottom: 70px;
        width: 100vw;
        height: calc(100vh - 70px);
        border-radius: 20px 20px 0 0;
    }
    
    .message-content {
        max-width: 85%;
    }
}
