* {
    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;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
}

.nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.nav a {
    padding: 10px 20px;
    text-decoration: none;
    color: #666;
    border-radius: 6px;
    transition: all 0.3s;
}

.nav a:hover {
    background: #f5f5f5;
}

.nav a.active {
    background: #667eea;
    color: white;
}

h1 {
    color: #333;
    margin-bottom: 30px;
    text-align: center;
}

.form-container {
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.upload-area:hover {
    background: #f8f9ff;
    border-color: #5568d3;
}

.upload-area.dragover {
    background: #f0f2ff;
    border-color: #5568d3;
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: #667eea;
}

.upload-area p {
    color: #666;
    font-size: 16px;
}

.file-info {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.file-info p {
    margin-bottom: 5px;
    color: #555;
}

.loading {
    text-align: center;
    padding: 30px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.results {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.results h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
}

.results-summary {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid #4caf50;
}

.file-header {
    background: #667eea;
    color: white;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    margin-top: 20px;
    font-size: 14px;
}

.file-header:first-child {
    margin-top: 0;
}

.result-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-question {
    color: #667eea;
    font-weight: 600;
    margin-bottom: 8px;
}

.result-answer {
    color: #333;
    font-size: 18px;
    font-weight: 500;
}

.result-confidence {
    color: #888;
    font-size: 12px;
    margin-top: 5px;
}

.preset-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn-preset {
    padding: 10px 20px;
    background: #f5f5f5;
    border: 2px solid #667eea;
    border-radius: 6px;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-preset:hover {
    background: #667eea;
    color: white;
}

.btn-secondary {
    padding: 10px 16px;
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 6px;
    color: #666;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: #e8e8e8;
    border-color: #999;
}

.info {
    background: #e3f2fd;
    color: #1976d2;
    padding: 12px 15px;
    border-radius: 6px;
    border-left: 4px solid #1976d2;
    margin-top: 20px;
    font-size: 14px;
}

.error {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #c33;
    margin-top: 20px;
    white-space: pre-line;
    line-height: 1.6;
}

.success {
    background: #efe;
    color: #2a7;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #3c3;
    margin-top: 20px;
    white-space: pre-line;
    font-family: monospace;
    font-size: 13px;
}

.recent-uploads {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.recent-uploads h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.recent-info-message {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    color: #666;
}

.recent-info-message p {
    margin: 0;
}

.recent-item {
    background: #f8f9ff;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.recent-info {
    flex: 1;
}

.recent-info strong {
    display: block;
    color: #333;
    margin-bottom: 5px;
}

.recent-info small {
    display: block;
    color: #666;
    font-size: 12px;
    margin-top: 3px;
}

.recent-actions {
    display: flex;
    gap: 8px;
}

.btn-copy,
.btn-query {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.btn-copy {
    background: #f5f5f5;
    border: 2px solid #ddd;
    color: #666;
}

.btn-copy:hover {
    background: #e8e8e8;
}

.btn-query {
    background: #667eea;
    border: 2px solid #667eea;
    color: white;
}

.btn-query:hover {
    background: #5568d3;
}

.csv-download {
    background: #f0f9ff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    border: 2px dashed #0066cc;
}

.btn-download {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-download:hover {
    background: #218838;
}

.csv-info {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.csv-info small {
    color: #666;
    font-size: 12px;
}

.summary-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
}

.stat-item.success {
    background: #e8f5e9;
}

.stat-item.error {
    background: #ffebee;
}

.stat-label {
    font-weight: 600;
    color: #555;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.stat-item.success .stat-value {
    color: #2e7d32;
}

.stat-item.error .stat-value {
    color: #c62828;
}

.file-section {
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.file-section .file-header {
    margin: 0;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-number {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 700;
}

.file-section .result-item {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-bottom: 1px solid #f0f0f0;
}

.file-section .result-item:last-of-type {
    border-bottom: none;
}

.raw-text-toggle {
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.btn-toggle {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-toggle:hover {
    background: #5a6268;
}

.raw-text-content {
    margin-top: 15px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.raw-text-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #333;
}

.raw-response-panel {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #dee2e6;
}

.btn-toggle-raw {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    width: 100%;
}

.btn-toggle-raw:hover {
    background: #5a6268;
}

.raw-response-content {
    margin-top: 15px;
    background: #1e1e1e;
    border-radius: 6px;
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.raw-response-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #d4d4d4;
}
