/* ──────────────────────────────────────────────────────
   Design Tokens — 数字人前端统一变量
   digital_ui 和 backend_ui 共享此文件
   ────────────────────────────────────────────────────── */

:root {
  /* ── Background ── */
  --bg: #030613;
  --bg-gradient: radial-gradient(circle at 20% 30%, rgba(0, 243, 255, 0.06) 0%, transparent 42%),
                 radial-gradient(circle at 80% 80%, rgba(181, 60, 255, 0.06) 0%, transparent 42%);

  /* ── Text ── */
  --text: #e0f8ff;
  --muted: #6a8b9f;

  /* ── Borders ── */
  --line: rgba(0, 243, 255, 0.25);
  --line-strong: rgba(0, 243, 255, 0.5);

  /* ── Surfaces ── */
  --card: rgba(8, 14, 28, 0.85);
  --card-strong: rgba(12, 22, 45, 0.95);

  /* ── Brand ── */
  --brand: #00f3ff;
  --brand-strong: #00e0df;
  --brand-2: #b53cff;

  /* ── Semantic ── */
  --danger: #ff003c;
  --success: #00ff9d;

  /* ── Effects ── */
  --shadow: 0 8px 32px rgba(0, 243, 255, 0.07);
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.5);
  --glow: 0 0 10px rgba(0, 243, 255, 0.35);

  /* ── Corners (clip-path) ── */
  --corner-sm: 10px;
  --corner-md: 15px;
}

/* ── Reset ── */
* {
  box-sizing: border-box;
}

/* ── Base Typography ── */
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Rajdhani", "Noto Sans SC", sans-serif;
  background: var(--bg);
  background-image:
    var(--bg-gradient),
    linear-gradient(rgba(0, 243, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 243, 255, 0.025) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
}

/* ── Shared Labels ── */
.eyebrow,
.card-kicker,
.overlay-label,
.info-label {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  opacity: 0.8;
}

/* ── Shared Button ── */
.btn {
  border: 1px solid var(--brand);
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  background: rgba(0, 243, 255, 0.05);
  color: var(--brand);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--corner-sm)), calc(100% - var(--corner-sm)) 100%, 0 100%);
  transition: all 0.2s ease;
}

.btn:hover {
  background: rgba(0, 243, 255, 0.2);
  box-shadow: var(--glow);
  transform: translateY(-2px);
}

.btn.primary {
  color: #000;
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: var(--glow);
}

.btn.primary:hover {
  background: #fff;
  border-color: #fff;
}

.btn.ghost {
  color: var(--brand);
  background: transparent;
  border: 1px solid rgba(0, 243, 255, 0.3);
}

.btn.ghost:hover {
  border-color: var(--brand);
}

.btn.danger {
  color: #fff;
  background: rgba(255, 0, 60, 0.2);
  border-color: var(--danger);
  box-shadow: 0 0 10px rgba(255, 0, 60, 0.3);
}

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

/* ── Button Loading State ── */
.btn.is-loading {
  pointer-events: none;
  opacity: 0.65;
  position: relative;
}

.btn.is-loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: middle;
  animation: spin-loading 0.6s linear infinite;
}

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

/* ── Toast Notification ── */
.toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 14px 22px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: rgba(4, 8, 20, 0.92);
  backdrop-filter: blur(12px);
  color: var(--text);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), var(--glow);
  animation: toast-in 0.32s ease-out;
  max-width: min(520px, 90vw);
}

.toast.toast-exit {
  animation: toast-out 0.28s ease-in forwards;
}

.toast.success {
  border-left: 3px solid var(--success);
  color: var(--success);
}

.toast.error {
  border-left: 3px solid var(--danger);
  color: #ffb3c1;
}

.toast.info {
  border-left: 3px solid var(--brand);
  color: var(--brand);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
}

/* ── Shared Card Base ── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--corner-md)), calc(100% - var(--corner-md)) 100%, 0 100%);
  position: relative;
}

.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  border-top: 2px solid var(--brand);
  border-left: 2px solid var(--brand);
  pointer-events: none;
}

/* ── Modal Overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(2, 4, 10, 0.82);
  backdrop-filter: blur(6px);
  animation: modal-bg-in 0.22s ease-out;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-content {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 28px;
  animation: modal-card-in 0.28s ease-out;
}

@keyframes modal-bg-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-card-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
