﻿@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;600&display=swap');

body {
    margin: 0;
    background: linear-gradient(135deg, #dbe9ff, #f5faff);
    font-family: 'Vazirmatn', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    direction: rtl !important;
    text-align: right;
}

.chat-container {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    width: 420px;
    height: 620px;
    border-radius: 25px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.header {
    background: linear-gradient(90deg, #3a8ef6, #6ac7ff);
    color: white;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
}

    .header img {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid white;
    }

/* 🌈 پس‌زمینه زیبا برای بخش چت */
#chatBox {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(180deg, #e6f0ff 0%, #ffffff 100%);
    /* یا از یک تصویر ملایم استفاده کن 👇 */
    /* background: url('https://i.ibb.co/VWsY1T3/chat-bg-light.jpg') center/cover no-repeat; */
    backdrop-filter: blur(3px);
}

.message-wrapper {
    display: flex;
    align-items: flex-end;
    margin-bottom: 12px;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
}

    .avatar.bot {
        background-image: url('https://api.dicebear.com/7.x/bottts/svg?seed=robot');
    }

    .avatar.user {
        background-image: url('https://api.dicebear.com/7.x/adventurer/svg?seed=user');
    }

.message {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

    .message.bot {
        background: #fff;
        color: #333;
    }

    .message.user {
        background: #daf1ff;
        color: #222;
    }

.typing-bubble {
    background: #fff;
    padding: 8px 12px;
    border-radius: 14px;
    display: inline-flex;
    gap: 5px;
}

    .typing-bubble span {
        width: 6px;
        height: 6px;
        background: #999;
        border-radius: 50%;
        animation: blink 1.4s infinite;
    }

        .typing-bubble span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-bubble span:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes blink {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

/* ورودی خشک‌تر */
.footer {
    display: flex;
    padding: 10px;
    background: #f2f2f2;
    border-top: 1px solid #d1d1d1;
    align-items: center;
}

#userInput {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid #bdbdbd;
    border-radius: 6px;
    outline: none;
    font-size: 14px;
    background: #fff;
    color: #333;
}

button {
    background: #e0e0e0;
    color: #333;
    border: 1px solid #bdbdbd;
    border-radius: 6px;
    width: 42px;
    height: 36px;
    margin-right: 8px;
    cursor: pointer;
    font-size: 16px;
}

    button:hover {
        background: #d5d5d5;
    }
