/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #22263a;
  --border: #2d3149;
  --border-active: #5b6af0;
  --text: #e8eaf6;
  --text-muted: #8b91b8;
  --accent: #5b6af0;
  --accent-hover: #6e7cf5;
  --danger: #e05c5c;
  --success: #4caf7d;
  --warning: #f0a04b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,.45);
  --transition: 140ms ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem 4rem;
}

/* ── App shell ─────────────────────────────────────────────── */
.app {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Header ────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.5rem;
}
.header-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.header-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.header-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Main card area ────────────────────────────────────────── */
.main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Drop zone ─────────────────────────────────────────────── */
.drop-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--surface);
}
.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--accent);
  background: var(--surface-hover);
  outline: none;
}
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--surface-hover);
}
.drop-zone-icon {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.drop-zone.drag-over .drop-zone-icon { color: var(--accent); }
.drop-zone-text {
  font-size: 0.95rem;
  color: var(--text-muted);
}
.drop-zone-link {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.drop-zone-formats {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  opacity: 0.7;
}
.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ── File list ─────────────────────────────────────────────── */
.file-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.file-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.file-item-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: default;
}
.file-status-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.file-badge.processing { background: #2a2d4a; color: var(--accent); }
.file-badge.success    { background: #1a3329; color: var(--success); }
.file-badge.error      { background: #3a1e1e; color: var(--danger); }

.toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  white-space: nowrap;
  transition: color var(--transition);
}
.toggle-btn:hover { color: var(--text); }
.toggle-btn svg { transition: transform var(--transition); }
.toggle-btn.open svg { transform: rotate(180deg); }

/* ── Metadata detail panel ─────────────────────────────────── */
.metadata-panel {
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem 1rem;
  display: none;
}
.metadata-panel.open { display: block; }
.metadata-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.metadata-section-title.removed { color: var(--success); }
.metadata-section-title.remaining { color: var(--warning); }
.metadata-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-bottom: 0.75rem;
}
.metadata-table tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
.metadata-table td {
  padding: 4px 0;
  vertical-align: top;
}
.metadata-table td:first-child {
  color: var(--text-muted);
  padding-right: 1rem;
  width: 40%;
  font-weight: 500;
}
.metadata-table td:last-child {
  color: var(--text);
  word-break: break-all;
}
.metadata-none {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Error message ─────────────────────────────────────────── */
.file-error {
  font-size: 0.8rem;
  color: var(--danger);
  padding: 0 1rem 0.75rem;
}

/* ── Progress bar ──────────────────────────────────────────── */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.progress-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 200ms ease;
}
.progress-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}

/* ── Action buttons ────────────────────────────────────────── */
.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform 80ms ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); color: var(--text); }

/* ── Spinner ───────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ── SEO content sections ──────────────────────────────────── */
.seo-section {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 0.5rem;
}
.seo-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}
.seo-steps {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.seo-steps li {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.seo-steps li strong { color: var(--text); }

.seo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.seo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem;
}
.seo-card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.seo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.seo-list li {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-left: 0.75rem;
  position: relative;
}
.seo-list li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--border-active);
}
.seo-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}
.seo-text strong { color: var(--text); }

.seo-faq {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.seo-faq dt {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 0.75rem;
}
.seo-faq dd {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0.2rem 0 0;
  padding-left: 0.75rem;
  border-left: 2px solid var(--border);
}

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.6;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
  .seo-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .drop-zone { padding: 1.75rem 1rem; }
  .actions { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
}
