/* ==========================================================
   M2V Dashboard — 样式表
   ========================================================== */

:root {
  --bg: #0f0f17;
  --bg-card: #1a1a2e;
  --bg-hover: #252545;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #334155;
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Auth Overlay ───────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.auth-card input {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-card button[type="submit"] {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.auth-card button[type="submit"]:hover {
  background: var(--accent-light);
}

.auth-switch {
  text-align: center;
  margin-top: 1rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--accent-light);
  text-decoration: none;
}

.error-text {
  color: var(--red);
  font-size: 0.875rem;
  text-align: center;
  margin-top: 0.5rem;
}

/* ── Header ─────────────────────────────────────────────── */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-left h1 {
  font-size: 1.4rem;
}

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

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#user-info {
  color: var(--text-muted);
}

.badge {
  background: var(--accent);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ── Buttons ────────────────────────────────────────────── */

.btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-size: 1rem;
  padding: 0.75rem 2rem;
}

.btn-primary:hover {
  background: var(--accent-light);
}

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

.btn-outline {
  background: transparent;
}

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

.btn-danger:hover {
  background: var(--red);
  color: white;
}

/* ── Upload Section ─────────────────────────────────────── */

#upload-section {
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

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

.upload-card h2 {
  margin-bottom: 1.5rem;
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.upload-field label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.upload-field input[type="file"] {
  width: 100%;
  padding: 0.75rem;
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.upload-field input[type="file"]:hover {
  border-color: var(--accent);
}

.upload-options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.upload-options label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.upload-options select {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

#btn-upload {
  display: block;
  width: 100%;
}

/* ── Tasks Section ──────────────────────────────────────── */

#tasks-section {
  padding: 0 2rem 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s;
}

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

.task-card[data-status="completed"] {
  border-left: 3px solid var(--green);
}

.task-card[data-status="failed"] {
  border-left: 3px solid var(--red);
}

.task-card[data-status="processing"] {
  border-left: 3px solid var(--yellow);
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.task-title {
  font-size: 1rem;
}

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

.task-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.task-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Progress Bar ───────────────────────────────────────── */

.progress-bar {
  width: 100%;
  height: 24px;
  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  transition: width 0.5s ease;
  min-width: 40px;
}

.step-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: block;
}

/* ── Empty State ────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ── Toast ──────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 9999;
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 3.5s;
}

.toast-success {
  background: var(--green);
  color: white;
}

.toast-error {
  background: var(--red);
  color: white;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
  }
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 640px) {
  header {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
  }

  .upload-row {
    grid-template-columns: 1fr;
  }

  .upload-options {
    flex-direction: column;
    align-items: flex-start;
  }

  #upload-section,
  #tasks-section {
    padding: 1rem;
  }

  .header-right {
    flex-wrap: wrap;
    justify-content: center;
  }
}
