/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.25rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.logo i {
    font-size: 2rem;
    color: #667eea;
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.3));
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
    margin-top: 0.25rem;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.95);
    color: #667eea;
    border: 2px solid #667eea;
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 1rem auto;
    padding: 0 1rem;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin: 1rem;
    border: 1px solid #e9ecef;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.chat-messages {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.welcome-message {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    border-radius: 15px;
    border: 2px dashed #667eea;
}

.welcome-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.welcome-message h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 1rem;
}

.welcome-message p {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.welcome-message ul {
    text-align: left;
    max-width: 500px;
    margin: 1rem auto;
    padding-left: 2rem;
}

.welcome-message li {
    margin-bottom: 0.5rem;
    color: #555;
}

.welcome-message strong {
    color: #667eea;
}

/* Message Styles */
.message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.3s ease;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-message .message-avatar {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
}

.message-content {
    flex: 1;
    background: #f8f9fa;
    padding: 1.25rem 1.5rem;
    border-radius: 18px;
    border: 1px solid #e9ecef;
    max-width: 100%;
    word-wrap: break-word;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.message-time {
    opacity: 0.8;
    font-size: 0.8rem;
    font-weight: 500;
}

.message-text {
    line-height: 1.6;
    font-size: 0.95rem;
}

/* AI Message Formatting */
.ai-message .message-text {
    white-space: pre-wrap;
    line-height: 1.8;
    font-size: 0.95rem;
    color: #2c3e50;
}

.ai-message .message-text p {
    margin: 0 0 1rem 0;
    padding: 0;
}

.ai-message .message-text p:last-child {
    margin-bottom: 0;
}

.ai-message .message-text .bullet-point {
    color: #667eea;
    font-weight: bold;
    margin-right: 0.5rem;
}

.ai-message .message-text br {
    margin-bottom: 0.5rem;
}

/* Enhanced AI message styling */
.ai-message .message-content {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.ai-message .message-content:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.ai-message .message-text {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 0.01em;
}

/* Message animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: fadeInUp 0.4s ease-out;
}

/* Enhanced bullet points */
.ai-message .message-text .bullet-point {
    color: #667eea;
    font-weight: bold;
    margin-right: 0.5rem;
    font-size: 1.1em;
}

/* Better spacing for lists */
.ai-message .message-text p {
    margin: 0 0 1.2rem 0;
    padding: 0;
}

.ai-message .message-text p:last-child {
    margin-bottom: 0;
}

/* Chat Input */
.chat-input-container {
    padding: 1.5rem 2rem;
    border-top: 1px solid #e9ecef;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.chat-input-wrapper {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    max-width: 800px;
    margin: 0 auto;
}

#chatInput {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    font-size: 1rem;
    resize: none;
    min-height: 50px;
    max-height: 120px;
    transition: all 0.3s ease;
    font-family: inherit;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#chatInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.send-btn:active {
    transform: scale(0.95);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 20px;
    width: 95%;
    max-width: 600px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.large {
    max-width: 900px;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 1.5rem;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 2rem 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #764ba2;
    background: linear-gradient(135deg, #f0f2ff 0%, #e8ebff 100%);
}

.upload-icon {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.upload-area p {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.upload-options {
    margin-top: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Upload Status */
.upload-status {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.status-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #667eea;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
}

/* Documents */
.documents-header {
    margin-bottom: 1.5rem;
}

.documents-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    padding: 1.25rem;
    border-radius: 15px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.stat-item i {
    font-size: 1.5rem;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.stat-item span {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.25rem;
}

.stat-item label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.documents-list {
    display: grid;
    gap: 1rem;
}

.document-item {
    background: white;
    padding: 1.25rem;
    border-radius: 15px;
    border: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    flex-wrap: wrap;
    gap: 1rem;
}

.document-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.document-info {
    flex: 1;
    min-width: 200px;
}

.document-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.document-meta {
    font-size: 0.85rem;
    color: #666;
}

.document-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.document-actions button {
    padding: 0.5rem 0.875rem;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-info:hover, .btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* System Info */
.system-info {
    display: grid;
    gap: 1rem;
}

.info-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.status-online {
    color: #28a745;
    font-weight: 600;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .logo h1 {
        font-size: 1.4rem;
    }
    
    .subtitle {
        font-size: 0.75rem;
    }
    
    .main-content {
        padding: 0 0.75rem;
        margin: 0.75rem auto;
    }
    
    .chat-container {
        border-radius: 15px;
        min-height: 85vh;
    }
    
    .chat-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .chat-title h2 {
        font-size: 1.2rem;
    }
    
    .chat-actions {
        justify-content: center;
        width: 100%;
    }
    
    .chat-actions .btn {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }
    
    .chat-messages {
        padding: 1rem;
        max-height: 50vh;
    }
    
    .welcome-message {
        padding: 1.5rem 1rem;
    }
    
    .welcome-message h3 {
        font-size: 1.3rem;
    }
    
    .welcome-message p {
        font-size: 0.9rem;
    }
    
    .welcome-message ul {
        padding-left: 1.5rem;
    }
    
    .chat-input-container {
        padding: 1rem;
    }
    
    .chat-input-wrapper {
        gap: 0.5rem;
    }
    
    #chatInput {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .send-btn {
        width: 40px;
        height: 40px;
    }
    
    .modal-content {
        width: 98%;
        margin: 1% auto;
        border-radius: 15px;
    }
    
    .modal-header {
        padding: 1rem;
        border-radius: 15px 15px 0 0;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .upload-area {
        padding: 1.5rem 1rem;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
    
    .documents-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .stat-item {
        padding: 1rem;
    }
    
    .stat-item span {
        font-size: 1.25rem;
    }
    
    .document-item {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
    }
    
    .document-info {
        min-width: auto;
        text-align: center;
    }
    
    .document-actions {
        justify-content: center;
        width: 100%;
    }
    
    .document-actions button {
        flex: 1;
        max-width: 120px;
    }
    
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
    }
    
    .header-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 0.75rem;
    }
    
    .main-content {
        padding: 0 0.5rem;
        margin: 0.5rem auto;
    }
    
    .chat-container {
        border-radius: 10px;
    }
    
    .chat-header {
        padding: 0.875rem;
        border-radius: 10px 10px 0 0;
    }
    
    .chat-messages {
        padding: 0.875rem;
    }
    
    .welcome-message {
        padding: 1.25rem 0.875rem;
        border-radius: 10px;
    }
    
    .welcome-message h3 {
        font-size: 1.2rem;
    }
    
    .welcome-message p {
        font-size: 0.85rem;
    }
    
    .chat-input-container {
        padding: 0.875rem;
    }
    
    .modal-content {
        width: 99%;
        margin: 0.5% auto;
        border-radius: 10px;
    }
    
    .modal-header {
        padding: 0.875rem;
        border-radius: 10px 10px 0 0;
    }
    
    .modal-body {
        padding: 0.875rem;
    }
    
    .upload-area {
        padding: 1.25rem 0.875rem;
        border-radius: 10px;
    }
    
    .documents-stats {
        gap: 0.5rem;
    }
    
    .stat-item {
        padding: 0.875rem;
        border-radius: 10px;
    }
    
    .document-item {
        padding: 0.875rem;
        border-radius: 10px;
    }
    
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
    }
}

/* Notification styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 3000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 90vw;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid #28a745;
    color: #155724;
}

.notification-error {
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.notification-info {
    border-left: 4px solid #17a2b8;
    color: #0c5460;
}

.notification i {
    font-size: 1.2rem;
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #666;
}

.empty-state i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 1rem;
}

.document-details p {
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Loading animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

/* Typing indicator styles */
.typing-message {
    opacity: 0.98;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    will-change: transform, opacity;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 24px;
    width: fit-content;
    border: 1px solid rgba(102, 126, 234, 0.1);
    animation: typing-pulse 2s ease-in-out infinite;
}

@keyframes typing-pulse {
    0%, 100% {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.05) 100%);
    }
    50% {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.08) 100%);
    }
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: typing-bounce 1.4s infinite ease-in-out;
    opacity: 0.8;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.7);
        opacity: 0.3;
    }
    40% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

.typing-text {
    min-height: 28px;
    color: #2c3e50;
    font-style: normal;
    border-left: 4px solid #667eea;
    padding-left: 20px;
    margin-top: 12px;
    line-height: 1.6;
    font-size: 1rem;
    font-weight: 400;
    background: rgba(255, 255, 255, 0.7);
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: opacity 0.15s ease;
    opacity: 0.95;
    will-change: opacity;
}

/* Smooth typing effect */
.typing-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Typing message animation */
.typing-message {
    animation: typing-fade-in 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

@keyframes typing-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 0.98;
        transform: translateY(0);
    }
}

/* Hide typing indicator when text appears */
.typing-message .typing-indicator {
    transition: all 0.3s ease;
}

.typing-message .typing-indicator.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

/* Ensure typing text is always visible during streaming */
.typing-text:not(:empty) {
    display: block !important;
}

/* Smooth text appearance without flickering */
.typing-text {
    backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Preserve formatting during typing */
.typing-text p {
    margin: 0 0 0.8rem 0;
    padding: 0;
}

.typing-text p:last-child {
    margin-bottom: 0;
}

.typing-text ul, .typing-text ol {
    margin: 0.8rem 0;
    padding-left: 1.5rem;
}

.typing-text li {
    margin-bottom: 0.3rem;
}

.typing-text .bullet-point {
    color: #667eea;
    font-weight: bold;
    margin-right: 0.5rem;
}

/* Brief loading state styles */
.loading-message {
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    animation: loading-fade-in 0.3s ease;
}

.loading-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 20px;
    width: fit-content;
}

.loading-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #667eea;
    animation: loading-pulse 1.2s infinite ease-in-out;
    opacity: 0.6;
}

.loading-dot:nth-child(1) {
    animation-delay: -0.24s;
}

.loading-dot:nth-child(2) {
    animation-delay: -0.12s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes loading-pulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.3;
    }
    40% {
        transform: scale(1);
        opacity: 0.7;
    }
}

@keyframes loading-fade-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 0.9;
        transform: translateY(0);
    }
}
