/* Chat Widget Container */
.chat-widget {
    position: fixed;
    bottom: 7rem; /* Moved up to avoid overlap with upload button */
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: 'Inter', sans-serif;
}

/* Chat Button (Floating Bubble) */
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    background: #3B82F6;
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

.chat-toggle-btn:hover {
    transform: scale(1.05);
    background: #2563EB;
}

.chat-toggle-btn i {
    transition: transform 0.2s;
}

.chat-toggle-btn.active i {
    transform: rotate(45deg); /* Spin plus/close icon */
}

/* Chat Window */
.chat-window {
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 0 0 1px #F3F4F6;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-window.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Chat Header */
.chat-header {
    padding: 1rem;
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    background: #EFF6FF;
    color: #3B82F6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.chat-title h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.chat-title p {
    font-size: 0.75rem;
    color: #6B7280;
    margin: 0;
}

/* Chat Messages Area */
.chat-messages {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: white;
}

/* Message Bubbles */
.message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.message.user {
    background: #3B82F6;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 0.25rem;
}

.message.bot {
    background: #F3F4F6;
    color: #1F2937;
    align-self: flex-start;
    border-bottom-left-radius: 0.25rem;
}

.message.system {
    background: transparent;
    color: #9CA3AF;
    font-size: 0.75rem;
    text-align: center;
    align-self: center;
    padding: 0;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.5rem 0.75rem;
    background: #F3F4F6;
    border-radius: 1rem;
    align-self: flex-start;
    width: fit-content;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Chat Input */
.chat-input-area {
    padding: 1rem;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 0.5rem;
    background: white;
}

.chat-input {
    flex-grow: 1;
    padding: 0.625rem 1rem;
    border: 1px solid #E5E7EB;
    border-radius: 999px;
    outline: none;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #3B82F6;
}

.chat-send-btn {
    background: #3B82F6;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-send-btn:hover {
    background: #2563EB;
}

.chat-send-btn:disabled {
    background: #E5E7EB;
    cursor: not-allowed;
}

