/**
 * DigiJabe AI - Chat Widget Styling
 * Path: assets/css/chat-widget.css
 */

/* دکمه شناور چت */
#djai-chat-trigger {
    position: fixed;
    bottom: 50px;
    right: 25px;
    width: 60px;
    height: 60px;
    background-color: #ff5722;
    color: #ffffff;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(255, 87, 34, 0.4);
    cursor: pointer;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#djai-chat-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(255, 87, 34, 0.6);
}

#djai-chat-trigger svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
}

/* پنجره اصلی چت */
#djai-chat-container {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 370px;
    height: 520px;
    max-width: calc(100vw - 50px);
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 999999;
    overflow: hidden;
    font-family: iranyekan, tahoma, sans-serif;
    border: 1px solid #f0f0f0;
}

#djai-chat-container.active {
    display: flex;
    animation: djai-fade-in 0.3s ease;
}

@keyframes djai-fade-in {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* هدر چت */
.djai-chat-header {
    background: linear-gradient(135deg, #ff5722, #e64a19);
    color: #ffffff;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.djai-chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

.djai-chat-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* بخش پیام‌ها */
.djai-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* حباب‌های چت */
.djai-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.6;
    word-wrap: break-word;
}

.djai-message.user {
    align-self: flex-end;
    background-color: #ff5722;
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.djai-message.ai {
    align-self: flex-start;
    background-color: #ffffff;
    color: #333333;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0f0f0;
}

/* آیتم‌های محصول پیشنهادی */
.djai-products-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.djai-product-card {
    display: flex;
    background: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px;
    gap: 8px;
    align-items: center;
    transition: background 0.2s;
}

.djai-product-card:hover {
    background: #f5f5f5;
}

.djai-product-info {
    flex: 1;
}

.djai-product-title {
    font-size: 13px;
    font-weight: bold;
    color: #333333;
    margin-bottom: 4px;
}

/* بخش نمایش ابعاد محصول جهت افزایش خوانایی */
.djai-product-dim {
    display: block;
    font-size: 15px !important;
    font-weight: 750;
    line-height: 1.9;
    color: #2e7d32; /* تغییر رنگ به سبز تیره ملایم برای خوانایی بالاتر */
    margin-top: 6px;
    margin-bottom: 4px;
    background: #f1f8e9; /* پس‌زمینه کم‌رنگ هماهنگ با رنگ متن */
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #dcedc8;
    text-align: center;
}

/*
 * قیمت در PHP خالی ارسال می‌شود.
 * این استایل فقط برای جلوگیری از به‌هم‌ریختگی احتمالی در صورت وجود قیمت است.
 */
.djai-product-price {
    font-size: 11px;
    color: #666666;
}

.djai-product-btn {
    font-size: 11px;
    background: #ff5722;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    text-align: center;
    display: inline-block;
    transition: background 0.2s;
}

.djai-product-btn:hover {
    background: #e64a19;
    color: #ffffff;
}

/* لودینگ در حال تایپ */
.djai-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #ffffff;
    border-radius: 12px;
    align-self: flex-start;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.djai-typing-indicator span {
    width: 6px;
    height: 6px;
    background: #888888;
    border-radius: 50%;
    animation: djai-bounce 1.4s infinite ease-in-out both;
}

.djai-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.djai-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes djai-bounce {
    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* بخش ورودی متن */
.djai-chat-input-area {
    display: flex;
    padding: 10px;
    background: #ffffff;
    border-top: 1px solid #eeeeee;
    gap: 8px;
}

.djai-chat-input-area textarea {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    resize: none;
    height: 38px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    line-height: 1.5;
}

.djai-chat-input-area textarea:focus {
    border-color: #ff5722;
}

.djai-chat-send-btn {
    background: #ff5722;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0 15px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: background 0.2s;
}

.djai-chat-send-btn:hover {
    background: #e64a19;
}
