/* AI Help Chatbot widget — reusable across pages via Views/Shared/_AIHelpChatWidget.cshtml */

#aiChatContainer {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 7999;
    display: inline-block;
}

#aiChatBtn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg,#1b2d5b 0%,#2a5bbf 100%);
    color: #fff;
    border-radius: 50px;
    padding: 0 20px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    height: 42px;
    vertical-align: middle;
    user-select: none;
    box-shadow: 0 4px 16px rgba(27,45,91,0.40);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    letter-spacing: 0.3px;
}

#aiChatBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(27,45,91,0.55);
}

@keyframes aiChatSpin { from{transform:rotate(0deg);} to{transform:rotate(360deg);} }
@keyframes aiChatSlideUp { from{opacity:0;transform:translateY(18px) scale(0.97);} to{opacity:1;transform:translateY(0) scale(1);} }
@keyframes aiChatPulse { 0%,100%{box-shadow:0 0 0 0 rgba(104,211,145,0.55);} 50%{box-shadow:0 0 0 6px rgba(104,211,145,0);} }
@keyframes aiChatBotReveal { from{opacity:0;transform:translateY(6px);} to{opacity:1;transform:translateY(0);} }

#aiChatWindow {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 540px;
    height: calc(100vh - 100px);
    max-height: 680px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.08);
    z-index: 8001;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

#aiChatWindow.aichat-open { animation: aiChatSlideUp 0.24s cubic-bezier(0.34,1.56,0.64,1); }

#aiChatHeader {
    background: #1b2d5b;
    color: #fff;
    padding: 14px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#aiChatHeaderLeft { display: flex; align-items: center; gap: 11px; }
#aiChatLogo { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.5); flex-shrink: 0; background: rgba(255,255,255,0.15); }
#aiChatHeaderText { display: flex; flex-direction: column; gap: 2px; }
#aiChatTitle { font-size: 14px; font-weight: 700; line-height: 1.2; letter-spacing: 0.2px; }
#aiChatSubtitle { font-size: 10px; font-weight: 400; opacity: 0.76; letter-spacing: 0.3px; }
#aiChatHeaderRight { display: flex; align-items: center; gap: 10px; }
#aiChatOnlineDot { width: 9px; height: 9px; background: #68d391; border-radius: 50%; border: 2px solid rgba(255,255,255,0.55); animation: aiChatPulse 2.4s infinite; flex-shrink: 0; }
#aiChatCloseBtn { cursor: pointer; background: rgba(255,255,255,0.14); border: none; color: #fff; padding: 5px 6px; border-radius: 8px; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
#aiChatCloseBtn:hover { background: rgba(255,255,255,0.28); }

#aiChatMessages { flex: 1; overflow-y: auto; padding: 14px 13px; background: #eef2f7; display: flex; flex-direction: column; gap: 10px; }
#aiChatMessages::-webkit-scrollbar { width: 4px; }
#aiChatMessages::-webkit-scrollbar-thumb { background: #c3cfe2; border-radius: 4px; }

.aichat-msg-user { background: linear-gradient(135deg,#2563ab 0%,#3b82c4 100%); color: #fff; border-radius: 16px 16px 4px 16px; padding: 10px 14px; font-size: 13px; max-width: 78%; align-self: flex-end; word-wrap: break-word; line-height: 1.5; box-shadow: 0 2px 8px rgba(37,99,171,0.32); }
.aichat-msg-bot { background: #fff; color: #2d3748; border-radius: 16px 16px 16px 4px; padding: 10px 14px; font-size: 13px; max-width: 88%; align-self: flex-start; word-wrap: break-word; line-height: 1.5; box-shadow: 0 1px 5px rgba(0,0,0,0.09); border: 1px solid #dde5ef; animation: aiChatBotReveal 0.35s cubic-bezier(0.16,1,0.3,1) both; }
.aichat-msg-bot h3, .aichat-msg-bot h4 { margin: 6px 0 3px; font-weight: 700; color: #1a202c; }
.aichat-msg-bot p { margin: 2px 0; }
.aichat-msg-bot ul, .aichat-msg-bot ol { margin: 3px 0; padding-left: 18px; }
.aichat-msg-bot li { margin: 1px 0; }
.aichat-msg-error { background: #fff5f5; color: #c53030; border-radius: 12px; padding: 9px 13px; font-size: 12px; align-self: flex-start; max-width: 92%; word-wrap: break-word; border: 1px solid #fed7d7; line-height: 1.45; }
.aichat-msg-typing { align-self: flex-start; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; max-width: 88%; border-radius: 14px; border: 1px solid #dde5ef; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,0.08); }
.aichat-thinking-row { display: flex; align-items: center; gap: 8px; }
.aichat-spin-icon { width: 15px; height: 15px; flex-shrink: 0; animation: aiChatSpin 1s linear infinite; }
.aichat-thinking-text { font-size: 13px; font-weight: 600; color: #1a3f6f; transition: opacity 0.18s ease; letter-spacing: 0.1px; }
.aichat-md-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12px; }
.aichat-md-table th { background: #eef2f7; color: #1a202c; font-weight: 700; padding: 5px 8px; text-align: left; border: 1px solid #dde5ef; }
.aichat-md-table td { padding: 4px 8px; border: 1px solid #dde5ef; color: #2d3748; vertical-align: top; }
.aichat-md-table tr:nth-child(even) td { background: #f7fafc; }

#aiChatDisclaimer { text-align: center; padding: 5px 8px 6px; font-size: 10px; color: #94a3b8; background: #eef2f7; border-top: 1px solid #dde5ef; flex-shrink: 0; letter-spacing: 0.2px; }
#aiChatInputArea { display: flex; padding: 10px 10px 10px 12px; border-top: 1px solid #e2e8f0; background: #fff; gap: 8px; align-items: flex-end; flex-shrink: 0; }
#aiChatTxt { flex: 1; border: 1.5px solid #dde5ef; border-radius: 12px; padding: 9px 12px; font-size: 13px; outline: none; font-family: Arial, sans-serif; resize: none; max-height: 80px; overflow-y: auto; line-height: 1.4; background: #f8fafc; transition: border-color 0.15s, background 0.15s; }
#aiChatTxt:focus { border-color: #3b82c4; background: #fff; }
#aiChatSendBtn { background: linear-gradient(135deg,#2563ab 0%,#3b82c4 100%); color: #fff; border: none; border-radius: 12px; width: 38px; height: 38px; flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 8px rgba(59,130,196,0.42); transition: box-shadow 0.15s, transform 0.10s; }
#aiChatSendBtn:hover:not(:disabled) { box-shadow: 0 5px 14px rgba(59,130,196,0.54); transform: translateY(-1px); }
#aiChatSendBtn:disabled { background: #cbd5e0; box-shadow: none; transform: none; cursor: not-allowed; }

@media (max-width: 575px) {
    #aiChatWindow {
        width: calc(100vw - 24px);
        right: 12px;
        left: 12px;
        bottom: 72px;
    }

    #aiChatContainer {
        right: 16px;
    }
}
