/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

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

.header h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 16px;
    opacity: 0.9;
}

/* Tabs */
.tabs {
    display: flex;
    background: #f7f7f7;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    flex: 1;
    padding: 16px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background: #eee;
    color: #333;
}

.tab-button.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

/* Sections */
.section {
    margin-bottom: 30px;
}

.section h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 12px;
}

.section h3 {
    font-size: 20px;
    color: #555;
    margin-bottom: 12px;
}

.help-text {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
}

/* Search Box */
.search-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#question-input {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

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

/* Input Group */
.input-group {
    display: flex;
    gap: 12px;
}

.text-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s ease;
}

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

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
}

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

/* Loading */
.loading {
    display: inline-block;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Answer Box */
.answer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.answer-box {
    background: #f9f9f9;
    border-left: 4px solid #667eea;
    padding: 20px;
    border-radius: 8px;
    line-height: 1.6;
    font-size: 15px;
    white-space: pre-wrap;
}

/* Sources List */
.sources-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.source-item {
    background: #f9f9f9;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #764ba2;
}

.source-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.source-meta {
    font-size: 14px;
    color: #666;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.source-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.source-link:hover {
    text-decoration: underline;
}

/* Status Box */
.status-box {
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
}

.status-box.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.status-box.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.status-box.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Error Section */
.section.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 16px;
    border-radius: 8px;
}

/* Stats Box */
.stats-box {
    margin-top: 16px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 13px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 20px;
    color: #333;
    font-weight: 700;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 8px;
    }

    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 24px;
    }

    .tab-content {
        padding: 20px;
    }

    .input-group {
        flex-direction: column;
    }

    .stats-box {
        grid-template-columns: 1fr;
    }
}
