:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --fg: #e2e8f0;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --border: #334155;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
}

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

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

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

/* Header */
.header {
  padding: 2rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
}

.subtitle {
  color: var(--muted);
  margin-top: 0.25rem;
}

.back-link {
  color: var(--accent);
  font-size: 0.9rem;
  display: inline-block;
  margin-bottom: 0.5rem;
}

/* Upload Section */
.upload-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.upload-section h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
}

.file-input {
  display: none;
}

.file-info {
  margin-top: 0.75rem;
  color: var(--accent);
  font-weight: 500;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
  margin-top: 1rem;
}

.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.small { padding: 0.4rem 0.8rem; font-size: 0.85rem; margin-top: 0; }
.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--fg); }
.btn-secondary:hover { background: var(--border); }

/* Progress */
.progress {
  margin-top: 1rem;
  background: var(--border);
  border-radius: 6px;
  height: 28px;
  position: relative;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
  transition: width 0.3s;
  width: 0%;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8rem;
  color: white;
  font-weight: 500;
}

/* Result & Error */
.result, .error {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
}

.result {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid var(--green);
}

.result-success {
  color: var(--green);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.result code {
  display: block;
  background: var(--bg);
  color: var(--fg);
  padding: 0.5rem;
  border-radius: 4px;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  word-break: break-all;
}

.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--red);
  color: var(--red);
}

/* File List */
.files-section h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 3rem 0;
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.file-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  transition: border-color 0.2s;
}

.file-card:hover {
  border-color: var(--accent);
}

.file-card.perma { border-left: 3px solid var(--green); }
.file-card.pending { border-left: 3px solid var(--yellow); }

.file-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.file-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.file-size {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.file-status {
  margin-bottom: 0.75rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-perma { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.badge-pending { background: rgba(234, 179, 8, 0.15); color: var(--yellow); }
.badge-local { background: rgba(148, 163, 184, 0.15); color: var(--muted); }

.file-actions {
  display: flex;
  gap: 0.5rem;
}

/* File Detail */
.file-detail {
  max-width: 600px;
}

.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.detail-card p {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.detail-card code {
  background: var(--bg);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85rem;
  word-break: break-all;
}

.share-section {
  margin-bottom: 1.5rem;
}

.share-section h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.share-box {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}

.share-box code {
  flex: 1;
  font-size: 0.85rem;
  word-break: break-all;
}

.detail-actions {
  display: flex;
  gap: 0.75rem;
}

/* Responsive */
@media (max-width: 600px) {
  .file-grid {
    grid-template-columns: 1fr;
  }
  .header h1 { font-size: 1.4rem; }
}
