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

:root {
  --bg: #0a0a0a;
  --surface: #111113;
  --surface-2: #1a1a1e;
  --border: #2a2a2e;
  --border-hover: #3a3a3e;
  --text: #e4e4e7;
  --text-muted: #71717a;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 12px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

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

header {
  text-align: center;
  margin-bottom: 48px;
}

header h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Upload Area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 64px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.04);
}

.upload-icon {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.upload-text {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.upload-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Preview */
.preview-section {
  margin-top: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.preview-header h2 {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-clear {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}

.btn-clear:hover {
  border-color: var(--red);
  color: var(--red);
}

.preview-container {
  padding: 24px;
  display: flex;
  justify-content: center;
  max-height: 400px;
  overflow: auto;
}

.preview-container img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 8px;
}

.pdf-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 32px;
}

/* Analyse Button */
.analyse-section {
  margin-top: 24px;
  text-align: center;
}

.btn-analyse {
  background: var(--accent);
  color: white;
  border: none;
  padding: 14px 48px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  max-width: 400px;
}

.btn-analyse:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

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

/* Loading */
.loading {
  text-align: center;
  margin-top: 48px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Results */
.results-section {
  margin-top: 32px;
}

.result-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.doc-type {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.doc-issuer {
  color: var(--accent);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.doc-summary {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.results-table thead {
  background: var(--surface-2);
}

.results-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.results-table td {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.results-table tr:last-child td {
  border-bottom: none;
}

.results-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.category-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.confidence-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.confidence-fill {
  width: 60px;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}

.confidence-fill-inner {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.confidence-text {
  font-size: 0.8rem;
  font-weight: 500;
  min-width: 36px;
}

.conf-high { color: var(--green); }
.conf-high .confidence-fill-inner { background: var(--green); }
.conf-mid { color: var(--amber); }
.conf-mid .confidence-fill-inner { background: var(--amber); }
.conf-low { color: var(--red); }
.conf-low .confidence-fill-inner { background: var(--red); }

/* Error */
.error-section {
  margin-top: 32px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  padding: 16px 20px;
  color: var(--red);
  font-size: 0.9rem;
}

/* Footer */
footer {
  margin-top: 64px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 24px 16px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .upload-area {
    padding: 40px 20px;
  }

  .results-table th,
  .results-table td {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .confidence-fill {
    width: 40px;
  }
}
