/* فونت فارسی */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700&display=swap');

* {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* دکمه چت - حالت Fixed */
#chat-toggle {

    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    
    background: url(../images/ipnbot.png) center / cover no-repeat, linear-gradient(135deg, #b6ccdc 0%, #d3e8ff 100%);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(26, 155, 142, 0.3);
    z-index: 9998;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(26, 155, 142, 0.4);
}

#chat-toggle svg {
    width: 32px;
    height: 32px;
    fill: white;
}

/* باکس چت - حالت Fixed */
#chat-box {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

#chat-box.active {
    display: flex;
}

/* هدر چت */
#chat-header {
    background: linear-gradient(135deg, #1a9b8e 0%, #16857a 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center  !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

#chat-header-icon {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

#chat-header-text h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

#chat-header-text p {
    margin: 2px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
    font-weight: 400;
}

#chat-close {
    background: rgba(255, 255, 255, 0.15) !important;
    border: none !important;
    color: white !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    font-size: 24px !important;
    line-height: 1 !important;
    transition: all 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    align-self: center !important;
    padding: 0 !important;
    margin: 0 !important;
}

#chat-close:hover {
    background: rgba(255,255,255,0.25);
    transform: rotate(90deg);
}

/* پیام‌ها */
#chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f7fa;
    direction: rtl;
    background: #f3f3f3 url(../images/bgchat.png);
}

.message-wrapper {
    display: flex;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

.message-wrapper.user {
    justify-content: flex-start;
}

.message-wrapper.bot {
    justify-content: flex-end;
}

.user-message, .bot-message {
    padding: 12px 18px;
    border-radius: 18px;
    max-width: 75%;
    word-wrap: break-word;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
}

.user-message {
    background: #5b7ced;
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(91, 124, 237, 0.2);
}

.bot-message {
    background: white;
    color: #2d3748;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

.bot-message.loading {
    background: #e6f2ff;
    color: #5b7ced;
    font-style: italic;
    border-color: #d0e5ff;
}

.bot-message.error {
    background: #fff5f5;
    color: #e53e3e;
    border-color: #feb2b2;
}

/* اینپوت */
#chat-input-container {
    padding: 16px 20px 20px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: center;
}

#chat-input {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 25px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    background: #f7fafc;
    direction: rtl;
    text-align: right;
}

#chat-input::placeholder {
    color: #a0aec0;
}

#chat-input:focus {
    border-color: #5b7ced;
    background: white;
    box-shadow: 0 0 0 3px rgba(91, 124, 237, 0.1);
}

#chat-send {
    background: #5b7ce4 !important;
    color: white !important;
    border: none !important;
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    min-height: 50px !important;
    max-width: 50px !important;
    max-height: 50px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    margin-right: 8px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(91, 124, 237, 0.3) !important;
}

#chat-send:hover {
    background: #4c6fd8 !important;
    transform: scale(1.05) !important;
    box-shadow: 0 6px 16px rgba(91, 124, 237, 0.4) !important;
}

#chat-send:active {
    transform: scale(0.95);
}

/* اسکرول‌بار سفارشی */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* انیمیشن */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* موبایل */
@media (max-width: 480px) {
    #chat-box {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
        bottom: 10px;
        right: 10px;
        border-radius: 16px;
    }
    
    #chat-toggle {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
    }
}
