.pdf-ai-chat-widget {
    max-width: 800px;
    margin: 30px auto;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.chat-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
    color: white;
}

.chat-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.chat-messages {
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    padding: 20px 25px;
    background: #f9fafb;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.welcome-message p {
    margin: 0;
    font-size: 16px;
}

.message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in;
}

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

.message.user {
    display: flex;
    justify-content: flex-end;
}

.message.assistant {
    display: flex;
    justify-content: flex-start;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
    word-wrap: break-word;
}

.message.user .message-content {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.message-text {
    line-height: 1.5;
    margin: 0;
    white-space: pre-wrap;
}

.message-sources {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    font-size: 13px;
}

.message-sources strong {
    display: block;
    margin-bottom: 6px;
    color: #6b7280;
    font-weight: 600;
}

.source-link {
    display: inline-block;
    margin-right: 12px;
    margin-bottom: 6px;
    color: #667eea;
    text-decoration: none;
    padding: 4px 8px;
    background: #f3f4f6;
    border-radius: 6px;
    transition: all 0.2s;
}

.source-link:hover {
    background: #e5e7eb;
    color: #5a67d8;
}

.loading-message {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    max-width: 75%;
}

.loading-dots {
    display: flex;
    gap: 6px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

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

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

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

.chat-input-container {
    padding: 20px 25px;
    background: white;
    border-radius: 0 0 12px 12px;
    border-top: 1px solid #e5e7eb;
}

.chat-options {
    margin-bottom: 12px;
}

.knowledge-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #6b7280;
    user-select: none;
}

.knowledge-toggle input[type="checkbox"] {
    cursor: pointer;
}

.knowledge-toggle:hover {
    color: #374151;
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.send-button {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.send-button:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.send-button:active {
    transform: translateY(0);
}

.send-button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.error-message {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Responsive design */
@media (max-width: 768px) {
    .pdf-ai-chat-widget {
        margin: 20px 10px;
        border-radius: 8px;
    }
    
    .chat-header {
        padding: 15px 20px;
        border-radius: 8px 8px 0 0;
    }
    
    .chat-messages {
        padding: 15px 20px;
        min-height: 300px;
        max-height: 400px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .chat-input-container {
        padding: 15px 20px;
    }
    
    .chat-input-wrapper {
        flex-direction: column;
        gap: 10px;
    }
    
    .send-button {
        width: 100%;
        justify-content: center;
    }
}
