:root {
    --primary-color: #05141f;
    --secondary-color: #bb162b;
    --accent-color: #f4f4f4;
    --text-dark: #333;
    --text-light: #666;
    --border-color: #ddd;
    --success-color: #28a745;
    --error-color: #dc3545;
}

* {
    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;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: var(--primary-color);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

.status-bar {
    padding: 15px 30px;
    background: var(--accent-color);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    font-weight: 500;
}

.status-bar.success {
    background: #d4edda;
    color: var(--success-color);
}

.status-bar.error {
    background: #f8d7da;
    color: var(--error-color);
}

.upload-section {
    padding: 40px;
    text-align: center;
}

.upload-section h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
}

#pdf-upload {
    display: block;
    margin: 20px auto;
    padding: 10px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
}

.chat-section {
    display: flex;
    flex-direction: column;
    height: 600px;
}

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

.message {
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 10px;
    max-width: 80%;
    animation: slideIn 0.3s ease;

    /* Preserve line breaks and wrap long content */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

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

.message.user {
    background: var(--secondary-color);
    color: white;
    margin-left: auto;
    text-align: right;
}

.message.assistant {
    background: white;
    border: 1px solid var(--border-color);
    margin-right: auto;
}

.message.loading {
    background: white;
    border: 1px solid var(--border-color);
    margin-right: auto;
    font-style: italic;
    color: var(--text-light);
}

.input-section {
    padding: 20px;
    background: white;
    border-top: 2px solid var(--border-color);
}

.input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#question-input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    min-height: 50px;
}

#question-input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.voice-btn {
    width: 50px;
    height: 50px;
    border: none;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s ease;
}

.voice-btn:hover {
    background: #9a1323;
    transform: scale(1.05);
}

.voice-btn.listening {
    animation: pulse 1s infinite;
    background: var(--success-color);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.button-group {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background: #9a1323;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: var(--accent-color);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e0e0e0;
}

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

footer {
    padding: 20px;
    text-align: center;
    background: var(--accent-color);
    color: var(--text-light);
    font-size: 0.9em;
}

#upload-progress {
    margin-top: 15px;
    font-weight: 500;
    color: var(--secondary-color);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .container {
        border-radius: 10px;
    }
    
    .chat-section {
        height: calc(100vh - 300px);
    }
    
    .message {
        max-width: 90%;
    }
    
    .button-group {
        flex-direction: column;
    }
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

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