* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 900px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

header p {
    opacity: 0.9;
    font-size: 1rem;
}

.main-content {
    display: flex;
    flex-direction: column;
    height: 600px;
}

.file-upload-section {
    padding: 20px;
    background: #f7f9fc;
    border-bottom: 1px solid #e2e8f0;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: white;
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-label:hover {
    border-color: #667eea;
    background: #f7f9fc;
}

.upload-icon {
    width: 24px;
    height: 24px;
    color: #667eea;
}

.file-info {
    margin-top: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-info.hidden {
    display: none;
}

#file-name {
    color: #2d3748;
    font-weight: 500;
}

.remove-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background 0.3s ease;
}

.remove-btn:hover {
    background: #dc2626;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #ffffff;
}

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

.welcome-message h2 {
    color: #2d3748;
    margin-bottom: 16px;
}

.welcome-message ul {
    list-style: none;
    margin-top: 20px;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.welcome-message li {
    padding: 8px 0;
}

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

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

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

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    max-width: 70%;
    word-wrap: break-word;
}

.ai-message .message-content {
    background: #f1f5f9;
    color: #2d3748;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    max-width: 70%;
    word-wrap: break-word;
}

.ai-message.streaming .message-content::after {
    content: '▋';
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.system-message {
    text-align: center;
    margin: 20px 0;
}

.system-message .message-content {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.input-section {
    padding: 20px;
    background: #f7f9fc;
    border-top: 1px solid #e2e8f0;
}

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

#user-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #cbd5e0;
    border-radius: 12px;
    font-size: 1rem;
    resize: none;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

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

#user-input:disabled {
    background: #e2e8f0;
    cursor: not-allowed;
}

.send-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn svg {
    width: 24px;
    height: 24px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loader {
    width: 50px;
    height: 50px;
    border: 3px solid #ffffff20;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-text {
    color: white;
    margin-top: 20px;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .container {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .main-content {
        height: calc(100vh - 120px);
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .welcome-message {
        padding: 20px 10px;
    }
    
    .user-message .message-content,
    .ai-message .message-content {
        max-width: 85%;
    }
}