/*
 * ====================================================================================
 * AI Agent CSS - استایل‌های ایجنت هوش مصنوعی
 * ====================================================================================
 */

/* دکمه باز کردن ایجنت */
.ai-agent-trigger {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 50000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.ai-agent-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.ai-agent-trigger:active {
    transform: scale(0.95);
}

/* پنل شناور ایجنت */
.ai-agent-panel {
    position: fixed;
    bottom: 100px;
    left: 30px;
    width: 400px;
    max-width: calc(100vw - 60px);
    height: 600px;
    max-height: calc(100vh - 150px);
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 50001;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    display: none;
}

.ai-agent-panel.show {
    opacity: 1;
    transform: translateY(0);
}

.ai-agent-panel.minimized {
    height: 60px;
    overflow: hidden;
}

.ai-agent-panel-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

.ai-chat-header h5 {
    margin: 0;
    font-size: 16px;
}

.ai-chat-header small {
    font-size: 12px;
    opacity: 0.9;
}

.ai-chat-controls {
    display: flex;
    gap: 5px;
}

.ai-chat-controls .btn {
    padding: 5px 10px;
    font-size: 12px;
}

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

/* ناحیه پیام‌ها */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-chat-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* پیام‌ها */
.message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: messageSlideIn 0.3s ease;
}

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

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

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

.user-message .message-avatar {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

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

.message-content {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.user-message .message-content {
    align-items: flex-end;
}

.ai-message .message-content {
    align-items: flex-start;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 15px;
    word-wrap: break-word;
    line-height: 1.4;
}

.user-message .message-bubble {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border-bottom-left-radius: 5px;
}

.ai-message .message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-right-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message-time {
    font-size: 11px;
    color: #999;
    padding: 0 5px;
}

/* ناحیه ورودی */
.ai-chat-input {
    padding: 15px;
    background: white;
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 15px 15px;
    flex-shrink: 0;
}

.ai-chat-input .input-group {
    margin-bottom: 0;
}

.ai-chat-input input {
    border-radius: 20px 0 0 20px;
    border: 1px solid #dee2e6;
}

.ai-chat-input button {
    border-radius: 0 20px 20px 0;
}

.input-footer {
    margin-top: 8px;
}

/* دکمه‌های کنترلی ایجنت */
.ai-control-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    margin: 5px 3px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: inline-block;
}

.ai-control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.ai-control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* استایل‌های مخصوص دستورات */
.ai-control-btn[data-command="get_products"] {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.ai-control-btn[data-command="get_categories"] {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
}

.ai-control-btn[data-command="search_products"] {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
}

.ai-control-btn[data-command="get_product_details"] {
    background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
}

/* مودال انتخاب دسته‌بندی */
.category-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.category-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.category-card.selected {
    border-color: #667eea;
    background: #f0f4ff;
}

.category-card h6 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 14px;
}

.category-card p {
    margin: 0;
    color: #666;
    font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-agent-panel {
        width: calc(100vw - 30px);
        left: 15px;
        bottom: 90px;
        height: calc(100vh - 120px);
    }

    .ai-agent-trigger {
        bottom: 20px;
        left: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .message-content {
        max-width: 85%;
    }

    .ai-chat-header {
        padding: 12px;
    }

    .ai-chat-controls .btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* Scrollbar Styling */
.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

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

/* Modal z-index - بالاتر از همه چیز */
#categoryModal {
    z-index: 50003 !important;
}

/* backdrop برای مودال انتخاب دسته‌بندی */
.modal-backdrop {
    z-index: 50002 !important;
}

/* اطمینان از اینکه modal backdrop روی همه چیز باشد */
.modal-backdrop.show {
    z-index: 50002 !important;
}

