/* =====================================================
   晋金源教育科技 — Vibrant Premium Design System
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

:root {
  /* Backgrounds */
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --bg-elevated: #f1f5f9;
  --bg-hover: #e2e8f0;

  /* Ink */
  --ink: #0f172a;
  --ink-secondary: #475569;
  --ink-muted: #64748b;
  --ink-placeholder: #94a3b8;

  /* Primary: Bright Indigo */
  --primary: #6366f1;
  --primary-deep: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #e0e7ff;
  --primary-muted: #c7d2fe;

  /* Accent: Vibrant Amber */
  --accent: #f59e0b;
  --accent-deep: #d97706;
  --accent-bright: #fbbf24;
  --accent-soft: #fef3c7;
  --accent-glow: rgba(245, 158, 11, 0.25);

  /* Accents */
  --emerald: #10b981;
  --emerald-deep: #059669;
  --emerald-soft: #d1fae5;
  --danger: #ef4444;
  --danger-deep: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --info: #3b82f6;
  --info-soft: #dbeafe;
  --success: #10b981;
  --success-soft: #d1fae5;

  /* Hairlines */
  --hairline: #e2e8f0;
  --hairline-strong: #cbd5e1;
  --hairline-subtle: #f1f5f9;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.02);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.02);
  --shadow-glow: 0 0 0 1px rgba(99, 102, 241, 0.12), 0 8px 24px -6px rgba(99, 102, 241, 0.18);

  /* Radius */
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Manrope', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;

  /* Easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --content-max: 1440px;

  /* Legacy aliases for backward compatibility during redesign */
  --font-display: var(--font-sans);
  --canvas: var(--bg-soft);
  --canvas-soft: var(--bg);
  --canvas-elevated: var(--bg-elevated);
  --hairline-soft: var(--hairline-subtle);
  --gold: var(--accent);
  --gold-deep: var(--accent-deep);
  --gold-bright: var(--accent-bright);
  --gold-soft: var(--accent-soft);
  --gold-glow: var(--accent-glow);
  --accent-gold: var(--accent);
  --accent-gold-soft: var(--accent-soft);
  --accent-gold-deep: var(--accent-deep);
  --accent-gold-glow: var(--accent-glow);
  --accent-emerald: var(--emerald);
  --accent-emerald-soft: var(--emerald-soft);
  --accent-emerald-deep: var(--emerald-deep);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 15px;
  overflow-x: hidden;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-deep);
}

ul, ol {
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* =====================================================
   Typography
   ===================================================== */

.text-xs { font-size: 12px; line-height: 1.5; }
.text-sm { font-size: 13px; line-height: 1.55; }
.text-base { font-size: 14px; line-height: 1.65; }
.text-md { font-size: 15px; line-height: 1.65; }
.text-lg { font-size: 18px; line-height: 1.55; }
.text-xl { font-size: 20px; line-height: 1.45; }
.text-2xl { font-size: 24px; line-height: 1.35; }
.text-3xl { font-size: 32px; line-height: 1.25; }
.text-4xl { font-size: 42px; line-height: 1.15; }
.text-5xl { font-size: clamp(40px, 6vw, 72px); line-height: 1.05; letter-spacing: -0.03em; }
.text-6xl { font-size: clamp(48px, 7vw, 88px); line-height: 1.0; letter-spacing: -0.035em; }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.tracking-tight { letter-spacing: -0.03em; }
.tracking-wide { letter-spacing: 0.04em; }
.tracking-wider { letter-spacing: 0.08em; }

.leading-tight { line-height: 1.15; }
.leading-snug { line-height: 1.35; }
.leading-normal { line-height: 1.65; }
.leading-relaxed { line-height: 1.8; }

.text-ink { color: var(--ink); }
.text-ink-secondary { color: var(--ink-secondary); }
.text-ink-muted { color: var(--ink-muted); }
.text-primary { color: var(--primary); }
.text-primary-deep { color: var(--primary-deep); }
.text-accent { color: var(--accent); }
.text-accent-deep { color: var(--accent-deep); }
.text-emerald { color: var(--emerald); }
.text-danger { color: var(--danger); }
.text-white { color: #fff; }

/* =====================================================
   Layout utilities
   ===================================================== */

.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 1100px;
}

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }

.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.gap-10 { gap: 40px; }
.gap-12 { gap: 48px; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* =====================================================
   Spacing
   ===================================================== */

.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-6 { padding: 24px; }
.p-8 { padding: 32px; }
.p-10 { padding: 40px; }
.p-12 { padding: 48px; }

.pt-4 { padding-top: 16px; }
.pt-6 { padding-top: 24px; }
.pt-8 { padding-top: 32px; }
.pt-10 { padding-top: 40px; }
.pt-12 { padding-top: 48px; }
.pt-16 { padding-top: 64px; }
.pt-20 { padding-top: 80px; }
.pt-24 { padding-top: 96px; }

.pb-4 { padding-bottom: 16px; }
.pb-6 { padding-bottom: 24px; }
.pb-8 { padding-bottom: 32px; }
.pb-10 { padding-bottom: 40px; }
.pb-12 { padding-bottom: 48px; }
.pb-16 { padding-bottom: 64px; }
.pb-20 { padding-bottom: 80px; }
.pb-24 { padding-bottom: 96px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mt-10 { margin-top: 40px; }
.mt-12 { margin-top: 48px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mb-10 { margin-bottom: 40px; }
.mb-12 { margin-bottom: 48px; }

.mx-auto { margin-left: auto; margin-right: auto; }

/* =====================================================
   Surfaces
   ===================================================== */

.bg-bg { background: var(--bg); }
.bg-soft { background: var(--bg-soft); }
.bg-elevated { background: var(--bg-elevated); }
.bg-hover { background: var(--bg-hover); }
.bg-primary { background: var(--primary); }
.bg-primary-deep { background: var(--primary-deep); }
.bg-primary-soft { background: var(--primary-soft); }
.bg-accent { background: var(--accent); }
.bg-accent-soft { background: var(--accent-soft); }
.bg-emerald-soft { background: var(--emerald-soft); }
.bg-danger-soft { background: var(--danger-soft); }

.rounded-xs { border-radius: var(--radius-xs); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.border { border: 1px solid var(--hairline); }
.border-strong { border: 1px solid var(--hairline-strong); }
.border-subtle { border: 1px solid var(--hairline-subtle); }
.border-primary { border-color: var(--primary); }
.border-bottom { border-bottom: 1px solid var(--hairline); }
.border-top { border-top: 1px solid var(--hairline); }

.shadow-xs { box-shadow: var(--shadow-xs); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-glow { box-shadow: var(--shadow-glow); }

/* =====================================================
   Components
   ===================================================== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-deep);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: #fff;
}

.btn-primary:active {
  background: var(--primary-dark);
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--hairline);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-secondary);
}

.btn-ghost:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-deep);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--accent-glow);
  color: #fff;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
  border-radius: var(--radius-md);
}

/* Cards */
.card {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-flat {
  box-shadow: none;
}

.card-flat:hover {
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.card-desc {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  transition: all 0.2s var(--ease-out);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--ink-placeholder);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--hairline-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  background: var(--bg);
  box-shadow: 0 0 0 4px var(--primary-soft);
  outline: none;
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.form-textarea {
  height: auto;
  min-height: 100px;
  padding: 12px 14px;
  resize: vertical;
}

.form-error {
  display: none;
  font-size: 12px;
  color: var(--danger);
  margin-top: 6px;
}

.form-error.show {
  display: block;
}

.form-hint {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 6px;
}

/* Tables */
.table-wrap {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: var(--bg-soft);
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline-subtle);
  color: var(--ink-secondary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.03);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-primary { background: var(--primary-soft); color: var(--primary-deep); }
.badge-accent { background: var(--accent-soft); color: var(--accent-deep); }
.badge-emerald { background: var(--emerald-soft); color: var(--emerald-deep); }
.badge-danger { background: var(--danger-soft); color: var(--danger-deep); }
.badge-muted { background: var(--bg-soft); color: var(--ink-muted); }

/* Status dots */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.active { background: var(--emerald); box-shadow: 0 0 0 2px var(--emerald-soft); }
.status-dot.pending { background: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.status-dot.inactive { background: var(--ink-muted); }
.status-dot.danger { background: var(--danger); box-shadow: 0 0 0 2px var(--danger-soft); }

/* Avatar */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-md { width: 44px; height: 44px; font-size: 16px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-muted);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size: 13px;
  margin-bottom: 20px;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 400px;
  pointer-events: auto;
  animation: toastIn 0.3s var(--ease-out);
}

.toast.success { background: var(--emerald); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--accent); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* =====================================================
   Animation helpers
   ===================================================== */

[data-reveal] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: translateY(0);
}

[data-stagger] > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-stagger].is-revealed > * {
  opacity: 1;
  transform: translateY(0);
}

/* =====================================================
   Reduced motion
   ===================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =====================================================
   Responsive helpers
   ===================================================== */

@media (max-width: 768px) {
  .container {
    padding: 0 18px;
  }

  .hide-mobile {
    display: none !important;
  }

  .text-5xl { font-size: clamp(32px, 9vw, 52px); }
  .text-6xl { font-size: clamp(38px, 10vw, 64px); }

  .card {
    padding: 20px;
  }

  .data-table th,
  .data-table td {
    padding: 12px;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
}
