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

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #f1f5f9;
  --secondary-hover: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --background: #ffffff;
  --surface: #f8fafc;
  --success: #10b981;
  --error: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  background: var(--background);
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--text);
}

.logo svg {
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.usage-badge {
  background: var(--secondary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

#user-name {
  font-weight: 500;
  font-size: 0.875rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--secondary-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--secondary);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-sm {
  padding: 6px 10px;
}

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 40px 0;
}

/* Auth Required */
.auth-required {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  text-align: center;
  max-width: 400px;
}

.auth-card svg {
  color: var(--primary);
  margin-bottom: 24px;
}

.auth-card h1 {
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.auth-card p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.auth-card .btn {
  width: 100%;
  margin-bottom: 32px;
}

.features {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feature {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.feature svg {
  color: var(--success);
  width: 20px;
  height: 20px;
}

/* Upload Section */
.upload-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.upload-card {
  background: var(--background);
  border-radius: var(--radius);
  padding: 32px;
  border: 1px solid var(--border);
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

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

.dropzone p {
  color: var(--text);
  margin-bottom: 8px;
}

.dropzone span {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.dropzone .btn {
  margin-top: 16px;
}

.dropzone .hint {
  margin-top: 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* File Preview */
.file-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--secondary);
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-info svg {
  color: var(--primary);
}

.file-name {
  font-weight: 500;
}

.file-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Options */
.options {
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.option-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 0.875rem;
}

.option-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  resize: vertical;
  min-height: 80px;
}

.option-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.format-options {
  display: flex;
  gap: 12px;
}

.format-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 400;
}

.format-option input {
  accent-color: var(--primary);
}

/* Results */
.results-section {
  background: var(--background);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

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

.results-header h2 {
  font-size: 1rem;
}

.results-content {
  padding: 24px;
  background: var(--surface);
  max-height: 400px;
  overflow: auto;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Processing Overlay */
.processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.processing-card {
  background: var(--background);
  padding: 48px;
  border-radius: var(--radius);
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 24px;
  animation: spin 1s linear infinite;
}

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

.processing-hint {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 8px;
}

/* Footer */
.footer {
  padding: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
}

/* Utility */
.hidden {
  display: none !important;
}

/* Error State */
.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 640px) {
  .header {
    flex-direction: column;
    gap: 16px;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .upload-card {
    padding: 20px;
  }

  .dropzone {
    padding: 32px 16px;
  }

  .format-options {
    flex-wrap: wrap;
  }
}
