﻿/* آیکون شناور چت */
#chat-fab {
    position: fixed;
    bottom: 100px;
    right: 20px;
    cursor: pointer;
    z-index: 1000;
    opacity: 0;
}

    #chat-fab img {
        width: 56px;
        height: auto;
        display: block;
    }

    #chat-fab.animate {
        animation: chatBounce 0.6s ease-out 1.2s forwards;
    }

@keyframes chatBounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.2);
        opacity: 1;
    }

    80% {
        transform: scale(0.95);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* پنجره پاپ‌آپ چت */
#chat-popup {
    display: none;
    position: fixed;
    bottom: 120px;
    right: 20px;
    width: 340px;
    height: 480px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
}

    #chat-popup.show {
        display: flex;
        flex-direction: column;
    }

/* هدر چت */
.chat-header {
    background-color: #28a745;
    color: white;
    padding: 10px 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* دکمه بستن */
#chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

/* بخش پیام‌ها */
#chat-messages {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    font-size: 14px;
    direction: rtl;
}

/* فرم مشخصات کاربر */
.chat-input {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #f9f9f9;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

    .input-wrapper input {
        width: 100%;
        padding-right: 24px;
        padding-left: 8px;
        height: 40px;
        font-size: 15px;
        border: 1px solid #ccc;
        border-radius: 6px;
    }

.required {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    color: red;
    font-size: 18px;
    pointer-events: none;
}

#chat-start {
    padding: 10px;
    font-size: 15px;
    border-radius: 6px;
    background-color: #28a745;
    color: white;
    border: none;
    cursor: pointer;
}

    #chat-start:hover {
        background-color: #218838;
    }

/* فرم ارسال پیام */
.chat-input-row {
    padding: 10px;
    border-top: 1px solid #eee;
    background-color: #fff;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

#chat-text {
    flex: 1;
    height: 45px;
    resize: none;
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

.send-btn {
    width: 42px;
    height: 42px;
    
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

    .send-btn:hover {
        background-color: #c9ff70;
        transform: scale(1.05);
    }

    .send-btn img {
        width: 20px;
        height: 20px;
        object-fit: contain;
        pointer-events: none;
    }


/* پیام‌ها */
.chat-line {
    background-color: #f1f1f1;
    padding: 10px 14px;
    border-radius: 12px;
    margin: 8px 0;
    max-width: 80%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-size: 14px;
    position: relative;
}

    .chat-line.self {
        background-color: #e0ffe0;
        margin-left: auto;
        text-align: right;
    }

.msg-text {
    margin-bottom: 4px;
}

.msg-time {
    font-size: 11px;
    color: #888;
    text-align: right;
}

/* موبایل */
@media (max-width: 480px) {
    #chat-popup {
        width: 90%;
        right: 5%;
        bottom: 60px;
        height: 85vh;
    }

    .chat-header {
        padding: 8px 12px;
        font-size: 15px;
    }

    .chat-input {
        padding: 8px;
        gap: 10px;
    }

    .input-wrapper input {
        height: 38px;
        font-size: 14px;
    }

    #chat-text {
        height: 45px;
        font-size: 14px;
    }

    .send-btn {
        font-size: 16px;
        padding: 8px;
    }
}
