@import url('https://cdn.fontcdn.ir/Font/Persian/Vazir/Vazir.css');

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    background: #e6f0ea;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><g fill="none" stroke="%2388b7a5" stroke-width="1" stroke-opacity="0.5"><path d="M0 0 L100 100 M100 0 L0 100" /></g></svg>');
    background-size: 50px 50px;
    background-repeat: repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    font-family: 'Vazir', sans-serif;
    direction: rtl;
}

.chat-container {
    width: 400px;
    max-width: 90%;
    background: rgba(210, 230, 228, 0.95);
    border-radius: 15px;
    box-shadow: 0 0 25px rgba(136, 183, 165, 0.4), 0 0 50px rgba(136, 183, 165, 0.2);
    overflow: hidden;
    position: relative;
}

.chat-header {
    background: #88b7a5;
    padding: 15px;
    text-align: center;
    color: #ffffff;
    font-size: 24px;
    font-family: 'Vazir', cursive;
    position: relative;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6), 0 0 15px rgba(255, 255, 255, 0.4);
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #66a28f, transparent);
}

.chat-box {
    height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: rgba(230, 240, 234, 0.7);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30"><circle cx="15" cy="15" r="2" fill="%2388b7a5" fill-opacity="0.3"/></svg>');
    background-size: 30px 30px;
    background-repeat: repeat;
    backdrop-filter: blur(5px);
    color: #000; /* تغییر رنگ متن به سیاه */
    position: relative;
}

.chat-box::-webkit-scrollbar {
    width: 6px;
}

.chat-box::-webkit-scrollbar-track {
    background: rgba(136, 183, 165, 0.1);
    border-radius: 10px;
}

.chat-box::-webkit-scrollbar-thumb {
    background: #66a28f;
    border-radius: 10px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
    background: #5a8f7d;
}

.message {
    margin: 10px 5px;
    padding: 10px 15px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    white-space: pre-wrap;
    position: relative;
    animation: slideIn 0.3s ease-out;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 1;
    position: relative;
    padding-bottom: 25px;
    display: flex;
    flex-direction: column;
}

.message:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(102, 162, 143, 0.2);
}

.user-message {
    background: linear-gradient(135deg, #b3d9d1, #88b7a5);
    margin-left: auto;
    text-align: right;
    border-top-right-radius: 5px;
    color: #000; /* تغییر رنگ متن کاربر به سیاه */
    position: relative;
}

.bot-message {
    background: linear-gradient(135deg, #d2e6e4, #c1d9d6);
    margin-right: auto;
    text-align: right;
    border-top-left-radius: 5px;
    line-height: 1.6;
    color: #000; /* تغییر رنگ متن ربات به سیاه */
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
}

.bot-message p {
    margin: 5px 0;
}

.bot-message strong {
    font-weight: bold;
    color: #1a3c33; /* رنگ جدید برای بولد: سبز تیره‌تر و با کنتراست بهتر */
}

/* استایل برای جدول‌ها در پیام‌های ربات */
.bot-message table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 14px;
    direction: rtl;
    table-layout: auto;
    overflow-x: auto;
    max-height: 200px;
    display: block;
    white-space: nowrap;
    border: 1px solid #88b7a5;
}

.bot-message th, .bot-message td {
    border: 1px solid #88b7a5;
    padding: 6px;
    text-align: right;
}

.bot-message th {
    background: linear-gradient(135deg, #b3d9d1, #88b7a5);
    color: #ffffff;
    font-weight: bold;
}

.bot-message tr:nth-child(even) {
    background: rgba(102, 162, 143, 0.05);
}

.bot-message tr:hover {
    background: rgba(102, 162, 143, 0.1);
}

@media only screen and (max-width: 600px) {
    .bot-message table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        touch-action: auto;
        margin-top: 15px;
        max-height: 150px;
    }
    .bot-message th, .bot-message td {
        min-width: 80px;
        font-size: 12px;
        padding: 4px;
    }
    .chat-container {
        width: 95%;
        margin-bottom: 50px;
        transform: translateY(-30px);
        border-radius: 15px;
    }
    .chat-header {
        font-size: 20px;
        padding: 10px;
    }
    .chat-box {
        height: 400px;
        padding: 15px;
    }
    .message {
        margin: 8px 5px;
        padding: 10px 12px;
        max-width: 90%;
        padding-bottom: 25px;
    }
    .input-container {
        padding: 10px;
    }
    textarea {
        font-size: 14px;
        padding: 8px;
        min-height: 35px;
    }
    .send-button {
        width: 45px;
        height: 35px;
        margin-right: 8px;
    }
    .send-button::before {
        font-size: 18px;
    }
    .send-button.stop::before {
        font-size: 16px;
    }
}

.input-container {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #d2e6e4;
    border-top: 1px solid rgba(136, 183, 165, 0.2);
}

textarea {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 20px;
    background: rgba(230, 240, 234, 0.8);
    color: #333;
    outline: none;
    font-size: 16px;
    font-family: 'Vazir', sans-serif;
    resize: none;
    min-height: 40px;
    max-height: 100px;
    overflow-y: auto;
}

textarea:disabled {
    background: rgba(230, 240, 234, 0.5);
    color: rgba(0, 0, 0, 0.5);
    cursor: not-allowed;
}

textarea::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

textarea::-webkit-scrollbar {
    width: 6px;
}

textarea::-webkit-scrollbar-track {
    background: rgba(136, 183, 165, 0.1);
    border-radius: 10px;
}

textarea::-webkit-scrollbar-thumb {
    background: #66a28f;
    border-radius: 10px;
}

textarea::-webkit-scrollbar-thumb:hover {
    background: #5a8f7d;
}

.send-button {
    width: 50px;
    height: 40px;
    background: #66a28f;
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s, opacity 0.3s;
    box-shadow: 0 0 10px rgba(102, 162, 143, 0.5);
    position: relative;
}

.send-button:hover {
    transform: scale(1.1);
    background: #5a8f7d;
    box-shadow: 0 0 15px rgba(102, 162, 143, 0.7);
}

.send-button:active {
    transform: scale(0.95);
    box-shadow: 0 0 20px rgba(102, 162, 143, 0.9);
}

.send-button::before {
    content: '▶';
    font-size: 20px;
    color: #ffffff;
    transition: opacity 0.3s;
}

.send-button.stop::before {
    content: '⏹';
    font-size: 18px;
}

.loading-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(102, 162, 143, 0.3);
    border-top: 2px solid #66a28f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 5px 10px 10px auto;
}

.copy-button {
    font-size: 16px;
    color: #66a28f;
    cursor: pointer;
    position: absolute;
    bottom: 5px;
    left: 10px;
    transition: opacity 0.3s;
    display: none;
    z-index: 10;
    font-family: 'Arial', sans-serif;
    margin-left: 10px;
}

.copy-button:hover {
    opacity: 0.7;
}

.copy-notification {
    display: none;
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #b3d9d1, #88b7a5);
    color: #ffffff;
    padding: 8px 15px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(102, 162, 143, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
    font-family: 'Vazir', sans-serif;
    text-align: center;
    direction: rtl;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}