/* css/chat-style.css */

/* دکمه شناور چت */
.chat-widget-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background-color: #000;
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s;
}

@media (hover: hover) {
    .chat-widget-btn:hover {
        transform: scale(1.08);
        background-color: #333;
    }
}

.chat-widget-btn svg {
    width: 28px;
    height: 28px;
}

/* نشانگر پیام‌های خوانده نشده */
.chat-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    background: #e10718;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Tahoma, sans-serif;
    border: 2px solid #fff;
}

/* پنجره اصلی چت */
.chat-widget-window {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 360px;
    max-width: 90vw;
    height: 520px;
    max-height: 80vh;
    background: #f8fafc;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    font-family: "Vazirmatn", Tahoma, sans-serif;
    animation: chatSlideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes chatSlideUp { 
    from { opacity: 0; transform: translateY(30px) scale(0.95); } 
    to { opacity: 1; transform: translateY(0) scale(1); } 
}

/* هدر چت */
.chat-header {
    background: #000;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    font-size: 15px;
}

.chat-online-dot {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    box-shadow: 0 0 6px #28a745;
}

.chat-close-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

@media (hover: hover) {
    .chat-close-btn:hover {
        color: #e10718;
    }
}

.chat-close-btn svg {
    width: 20px;
    height: 20px;
}

/* بدنه چت (محل نمایش پیام‌ها) */
.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

/* کانتینر دربرگیرنده پیام‌ها */
#chatMessagesArea {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

/* استایل کلی حباب پیام‌ها - حالت بادکنکی */
.chat-message {
    max-width: 82%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 13px;
    line-height: 1.6;
    word-wrap: break-word;
    position: relative;
    width: fit-content;
}

.msg-time {
    font-size: 10px;
    color: inherit;
    opacity: 0.7;
    margin-top: 5px;
    display: block;
    text-align: right;
    direction: ltr;
}

/* پیام ادمین (سمت چپ) */
.admin-msg {
    background: #ffffff;
    color: #111;
    align-self: flex-end;
    margin-right: auto;
    margin-left: 0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.04);
    border: 1px solid #e2e8f0;
}

/* پیام کاربر (سمت راست) */
.user-msg {
    background: #0ea5e9;
    color: #ffffff;
    align-self: flex-start;
    margin-left: auto;
    margin-right: 0;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.2);
    border: none;
}

/* سوالات متداول (FAQ) در داخل چت */
.chat-faq-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.chat-faq-btn {
    background: #ffffff;
    border: 1px solid #007aff;
    color: #007aff;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    text-align: right;
    transition: all 0.2s;
    font-family: inherit;
    font-weight: bold;
}

@media (hover: hover) {
    .chat-faq-btn:hover {
        background: #007aff;
        color: #fff;
    }
}

/* فوتر چت (محل تایپ پیام) */
.chat-footer {
    padding: 12px 15px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-footer input {
    flex: 1;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    padding: 12px 15px;
    border-radius: 25px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border 0.2s, background 0.2s;
}

.chat-footer input:focus {
    border-color: #000;
    background: #fff;
}

.chat-footer button {
    background: #000;
    color: #fff;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: 0.2s;
    flex-shrink: 0;
}

@media (hover: hover) {
    .chat-footer button:hover:not(:disabled) {
        background: #333;
    }
}

.chat-footer button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* پیام الزام به لاگین */
.chat-need-login {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 25px 20px;
    box-sizing: border-box;
    text-align: center;
    border-top: 1px solid #e2e8f0;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    z-index: 10;
}

.chat-login-btn {
    display: block;
    width: 100%;
    margin-top: 15px;
    background: #000;
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: background 0.2s;
}