* {
    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: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
}

header p {
    color: #666;
    font-size: 1.1em;
}

.upload-section {
    margin-bottom: 30px;
}

.upload-box {
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    background: #f8f9ff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-box:hover {
    border-color: #764ba2;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.upload-box.dragover {
    border-color: #764ba2;
    background: #e8ebff;
    transform: scale(1.02);
}

.upload-content svg {
    color: #667eea;
    margin-bottom: 20px;
}

.upload-content h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.upload-content p {
    color: #666;
    margin-bottom: 20px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.btn-remove:hover {
    background: #c82333;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #e8f5e9;
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 15px;
}

.file-info span {
    color: #2e7d32;
    font-weight: 500;
}

.loading {
    text-align: center;
    padding: 40px;
}

.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 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.results {
    margin-top: 30px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.results-header h2 {
    color: #667eea;
    font-size: 1.8em;
}

.result-section {
    margin-bottom: 40px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 12px;
}

.result-section h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.4em;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.info-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.info-item strong {
    display: block;
    color: #667eea;
    margin-bottom: 5px;
    font-size: 0.9em;
    text-transform: uppercase;
}

.info-item span {
    color: #333;
    font-size: 1.1em;
}

.fields-container {
    display: grid;
    gap: 15px;
}

.field-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.field-name {
    font-weight: 600;
    color: #333;
    font-size: 1.1em;
}

.confidence-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.confidence-high {
    background: #d4edda;
    color: #155724;
}

.confidence-medium {
    background: #fff3cd;
    color: #856404;
}

.confidence-low {
    background: #f8d7da;
    color: #721c24;
}

.field-value {
    color: #666;
    margin-top: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    word-wrap: break-word;
}

.field-meta {
    margin-top: 10px;
    font-size: 0.85em;
    color: #999;
}

.text-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    border: 1px solid #e0e0e0;
}

.annotations-container {
    display: grid;
    gap: 20px;
}

.page-annotation {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.page-header {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.annotation-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.stat-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    text-align: center;
}

.stat-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.2em;
    font-weight: 600;
    color: #667eea;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #dc3545;
}

.no-data {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 2em;
    }

    .results-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}
