:root {
    --primary-color: #e53935;
    --secondary-color: #ffebee;
    --text-color: #333;
    --light-gray: #f5f5f5;
    --border-color: #ddd;
    --success-color: #4CAF50;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: #f0f2f5;
}

/* انیمیشن‌های اصلی */
@keyframes floating {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 4px 12px rgba(229, 57, 53, 0.2); }
    50% { transform: scale(1.05); box-shadow: 0 6px 16px rgba(229, 57, 53, 0.4); }
    100% { transform: scale(1); box-shadow: 0 4px 12px rgba(229, 57, 53, 0.2); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* استایل‌های اصلی */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.chat-toggle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: white;
    border: 2px solid var(--primary-color);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 20px;
    right: 20px;
    animation: pulse 2s infinite ease-in-out;
}

.toggle-logo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.chat-toggle:hover .toggle-logo {
    transform: scale(0.95);
}

.chat-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 600px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    display: none;
    animation: slideInRight 0.5s ease-out forwards;
}

.chat-header {
    padding: 12px 20px;
    background: linear-gradient(135deg, #d32f2f, #ff1744);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background-color: white;
    padding: 2px;
    border: 2px solid white;
    animation: floating 3s infinite ease-in-out;
}

.header-text h3 {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 2px;
}

.status {
    font-size: 12px;
    color: var(--withe-color);
}

.chat-header-actions {
    display: flex;
    gap: 10px;
}

.clear-history-btn,
.minimize-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s ease;
}

.clear-history-btn:hover,
.minimize-btn:hover {
    transform: scale(1.1);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out forwards;
}

.message-content {
    padding: 12px 16px;
    border-radius: 15px;
    position: relative;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
}

.user-message {
    margin-left: auto;
}

.user-message .message-content {
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 5px;
}

.bot-message {
    margin-right: auto;
}

.bot-message .message-content {
    background-color: white;
    color: var(--text-color);
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.timestamp {
    font-size: 10px;
    color: #999;
    margin-top: 5px;
    margin-inline: 5px;
}

.chat-input-area {
    padding: 15px;
    background-color: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background-color: var(--light-gray);
    border-radius: 25px;
    padding: 8px 15px;
}

#message-input {
    flex: 1;
    border: none;
    background: none;
    padding: 8px;
    outline: none;
    font-size: 14px;
}

.input-actions {
    display: flex;
    gap: 10px;
}

.input-actions button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s ease;
}

.input-actions button:hover {
    transform: scale(1.1);
}

.send-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: none;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.1);
    background-color: #d32f2f;
}

.typing-indicator {
    padding: 20px;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #90949c;
    border-radius: 50%;
    margin-right: 5px;
    animation: typing 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--success-color);
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    animation: slideInRight 0.5s ease-out forwards;
    z-index: 1001;
}

/* موبایل رسپانسیو */
@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chat-container.minimized {
        transform: translateY(100%);
    }

    .chat-toggle {
        width: 60px;
        height: 60px;
        bottom: 15px;
        right: 15px;
    }

    .chat-header {
        padding: 10px 15px;
    }

    .bot-avatar {
        width: 35px;
        height: 35px;
    }

    .header-text h3 {
        font-size: 14px;
    }

    .message-content {
        max-width: 90%;
        font-size: 14px;
    }

    .chat-input-area {
        padding: 10px;
    }
}
