/* Chatbot Base Container */
#autosource-chatbot {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: var(--font-inter, sans-serif);
}

/* Floating Button */
.chat-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #D90429, #EF233C);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(217, 4, 41, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border: none;
    outline: none;
}

.chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 25px rgba(217, 4, 41, 0.5);
}

.chat-btn .pulse {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: rgba(217, 4, 41, 0.5);
    animation: chatPulse 2s infinite;
    z-index: -1;
}

@keyframes chatPulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 550px;
    max-height: calc(100vh - 120px);
    background: var(--bg-card, #1A1A1A);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9) translateY(20px);
}

.chat-window.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1) translateY(0);
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #2B2B2B, #1A1A1A);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #D90429, #EF233C);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: white;
}

.online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #10B981;
    border-radius: 50%;
    border: 2px solid var(--bg-card, #1A1A1A);
}

.chat-header h3 {
    margin: 0;
    font-size: 1rem;
    color: white;
    font-weight: 600;
}

.chat-header p {
    margin: 0;
    font-size: 0.75rem;
    color: #10B981;
}

.chat-header-actions button {
    background: none;
    border: none;
    color: var(--text-muted, #9CA3AF);
    cursor: pointer;
    transition: color 0.2s;
    padding: 5px;
}

.chat-header-actions button:hover {
    color: white;
}

/* Chat Body */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--bg-dark, #121212);
}

.chat-body::-webkit-scrollbar {
    width: 6px;
}
.chat-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

/* Messages */
.msg-wrap {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeInMsg 0.3s ease;
}

@keyframes fadeInMsg {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-bot {
    align-self: flex-start;
}

.msg-user {
    align-self: flex-end;
}

.msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
}

.msg-bot .msg-bubble {
    background: rgba(255,255,255,0.05);
    color: white;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
}

.msg-user .msg-bubble {
    background: var(--accent, #D90429);
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-time {
    font-size: 0.65rem;
    color: var(--text-muted, #9CA3AF);
    margin-top: 5px;
    align-self: flex-end;
}
.msg-bot .msg-time {
    align-self: flex-start;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quick-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-muted, #9CA3AF);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-btn:hover {
    background: rgba(217, 4, 41, 0.1);
    color: var(--accent, #D90429);
    border-color: rgba(217, 4, 41, 0.3);
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 5px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-muted, #9CA3AF);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Chat Footer */
.chat-footer {
    padding: 15px;
    background: var(--bg-card, #1A1A1A);
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 12px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--accent, #D90429);
}

.chat-send-btn {
    background: var(--accent, #D90429);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-send-btn:hover {
    transform: scale(1.1);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: 600px;
        max-height: calc(100vh - 100px);
        bottom: 70px;
        right: 20px;
    }
    #autosource-chatbot {
        bottom: 20px;
        right: 20px;
    }
}
