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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a1a;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 30px 0 20px;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #0078d4;
}

.header p {
    color: #666;
    margin-top: 6px;
    font-size: 14px;
}

/* Card */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

/* Input area */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.question-input {
    width: 100%;
    min-height: 100px;
    padding: 12px 16px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.question-input:focus {
    outline: none;
    border-color: #0078d4;
}

.question-input::placeholder {
    color: #aaa;
}

.input-hint {
    font-size: 12px;
    color: #888;
}

/* CSV upload */
.csv-upload-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1.5px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.csv-upload-area:hover {
    border-color: #0078d4;
    background: #f8fbff;
}

.csv-upload-area.has-file {
    border-color: #28a745;
    background: #f6fff8;
}

.csv-upload-area input[type="file"] {
    display: none;
}

.csv-upload-icon {
    font-size: 24px;
}

.csv-upload-text {
    font-size: 14px;
    color: #555;
}

.csv-upload-text strong {
    color: #0078d4;
}

.or-divider {
    text-align: center;
    color: #aaa;
    font-size: 13px;
    position: relative;
}

.or-divider::before,
.or-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #ddd;
}

.or-divider::before { left: 0; }
.or-divider::after { right: 0; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: #0078d4;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #106ebe;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

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

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

.btn-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Progress bar */
.progress-section {
    display: none;
}

.progress-section.visible {
    display: block;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: #0078d4;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 13px;
    color: #666;
}

/* Results */
.results-section {
    display: none;
}

.results-section.visible {
    display: block;
}

.result-item {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.result-question {
    padding: 14px 16px;
    background: #f8f9fa;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid #e9ecef;
    color: #0078d4;
}

.result-answer {
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.result-references {
    padding: 10px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.result-references-title {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 6px;
}

.result-references a {
    display: block;
    font-size: 12px;
    color: #0078d4;
    text-decoration: none;
    padding: 2px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-references a:hover {
    text-decoration: underline;
}

.result-error {
    padding: 16px;
    color: #dc3545;
    font-size: 14px;
}

/* Stats bar */
.stats-bar {
    display: flex;
    gap: 20px;
    padding: 12px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
    font-size: 13px;
    color: #666;
}

.stats-bar span strong {
    color: #333;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 12px;
    }

    .card {
        padding: 16px;
    }

    .btn-row {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
