:root {
    --chat-primary-color: #007bff;
    --chat-primary-hover: #0056b3;
    --chat-user-bg: var(--chat-primary-color);
    --chat-bot-bg: #f1f1f1;
    --chat-dialog-bg: #ffffff;
    --chat-text-light: #ffffff;
    --chat-text-dark: #212529;
    --chat-border-color: #dee2e6;
}

#chat-search-button {
    position: fixed;
    bottom: 70px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--chat-primary-color);
    color: var(--chat-text-light);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9998;
    transition: all 0.3s ease;
}
#chat-search-button:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

#chat-search-dialog {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 370px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 120px);
    background-color: var(--chat-dialog-bg);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform-origin: bottom right;
}
#chat-search-dialog.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
}

#chat-search-dialog .header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--chat-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--chat-text-dark);
}
#chat-search-dialog .close-btn {
    cursor: pointer;
    font-size: 28px;
    color: #aaa;
    line-height: 1;
    transition: color 0.2s;
}
#chat-search-dialog .close-btn:hover { color: #333; }

#chat-search-dialog .messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.message {
    padding: 12px 18px;
    border-radius: 20px;
    max-width: 85%;
    line-height: 1.6;
    word-wrap: break-word;
    font-size: 14px;
}
.user-message {
    background-color: var(--chat-user-bg);
    color: var(--chat-text-light);
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}
.bot-message {
    background-color: var(--chat-bot-bg);
    color: var(--chat-text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}
.bot-message.error {
    background-color: #ffebee;
    color: #c62828;
}
.bot-message a {
    color: var(--chat-primary-hover);
    text-decoration: underline;
}

/* Thinking animation */
.bot-message.thinking {
    padding-top: 18px;
    padding-bottom: 18px;
}
.thinking-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: currentColor;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.thinking-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

#chat-search-dialog .input-area {
    padding: 15px 20px;
    border-top: 1px solid var(--chat-border-color);
    display: flex;
    gap: 10px;
}
#chat-search-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 25px;
    padding: 10px 18px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
#chat-search-input:focus { border-color: var(--chat-primary-color); }
#chat-search-input:disabled { background-color: #f5f5f5; }

#chat-search-submit {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: none;
    background-color: var(--chat-primary-color);
    color: var(--chat-text-light);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, transform 0.2s;
}
#chat-search-submit:hover { background-color: var(--chat-primary-hover); }
#chat-search-submit:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: scale(1);
}