/* ============================================
   智慧教育云平台 - 全局样式
   ============================================ */

/* CSS Variables */
:root {
  --bg-primary: #0a1628;
  --bg-secondary: #0f1f3a;
  --bg-card: #132744;
  --bg-card-hover: #1a3358;
  --bg-nav: #0d1b32;
  --bg-sidebar: #0b1a2e;
  --bg-input: #1a2d4a;
  --bg-glass: rgba(15, 31, 58, 0.85);
  --border-color: #1e3a5f;
  --border-light: #2a4a78;
  --text-primary: #e8edf5;
  --text-secondary: #8899b4;
  --text-muted: #5a6f8a;
  --accent-blue: #1e88e5;
  --accent-cyan: #00d4ff;
  --accent-green: #00c853;
  --accent-orange: #ff9100;
  --accent-red: #ff1744;
  --accent-purple: #7c4dff;
  --accent-gold: #ffd700;
  --gradient-primary: linear-gradient(135deg, #1e88e5, #00d4ff);
  --gradient-card: linear-gradient(145deg, rgba(30, 136, 229, 0.08), rgba(0, 212, 255, 0.04));
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.15);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

a { color: var(--accent-cyan); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-blue); }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ============================================
   Login Page
   ============================================ */
.login-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 9999;
}

.login-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(30, 138, 229, 0.2);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0, 212, 255, 0.05);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent, rgba(0, 212, 255, 0.03), transparent, rgba(30, 136, 229, 0.03), transparent);
  animation: login-rotate 10s linear infinite;
}

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

.login-logo {
  text-align: center;
  margin-bottom: 36px;
  position: relative;
  z-index: 1;
}

.login-logo .icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  background: var(--gradient-primary);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  box-shadow: 0 8px 24px rgba(0, 212, 255, 0.25);
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

.login-form {
  position: relative;
  z-index: 1;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group .input-wrap {
  position: relative;
}

.form-group .input-wrap .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

.form-group input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  transition: var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.15);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.form-options label {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.form-options label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-blue);
}

.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-login:hover {
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
  transform: translateY(-1px);
}

.btn-login:active { transform: translateY(0); }

.btn-login .btn-loading {
  display: none;
}

.btn-login.loading .btn-text { display: none; }
.btn-login.loading .btn-loading { display: inline-block; }

.login-error {
  display: none;
  background: rgba(255, 23, 68, 0.1);
  border: 1px solid rgba(255, 23, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--accent-red);
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}

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

/* ============================================
   Layout - Main App
   ============================================ */
.app-layout {
  display: none;
  height: 100vh;
  width: 100vw;
}

.app-layout.active { display: flex; }

/* Top Navigation */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.top-nav .nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-right: 32px;
}

.top-nav .nav-brand .brand-icon {
  width: 34px;
  height: 34px;
  background: var(--gradient-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.top-nav .nav-search {
  flex: 1;
  max-width: 360px;
  position: relative;
}

.top-nav .nav-search input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.top-nav .nav-search input:focus {
  border-color: var(--accent-blue);
  width: 100%;
}

.top-nav .nav-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.top-nav .nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
  position: relative;
}

.nav-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-cyan);
  background: rgba(30, 136, 229, 0.1);
}

.nav-btn .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: var(--accent-red);
  border-radius: 50%;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.nav-user:hover {
  border-color: var(--border-color);
  background: var(--bg-input);
}

.nav-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.nav-user .user-info {
  line-height: 1.3;
}

.nav-user .user-info .name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.nav-user .user-info .role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  width: 220px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 16px 0;
  overflow-y: auto;
  z-index: 90;
  transition: var(--transition);
}

.sidebar-menu {
  list-style: none;
}

.sidebar-menu .menu-item {
  padding: 0 12px;
  margin-bottom: 2px;
}

.sidebar-menu .menu-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
}

.sidebar-menu .menu-item a:hover {
  background: rgba(30, 136, 229, 0.08);
  color: var(--text-primary);
}

.sidebar-menu .menu-item a.active {
  background: rgba(30, 136, 229, 0.15);
  color: var(--accent-cyan);
  border-left: 3px solid var(--accent-cyan);
}

.sidebar-menu .menu-item .menu-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-menu .menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 12px 16px;
}

.sidebar-menu .menu-label {
  padding: 8px 24px 4px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

/* Main Content */
.main-content {
  margin-left: 220px;
  margin-top: 60px;
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  height: calc(100vh - 60px);
}

.page-section {
  display: none;
  animation: page-enter 0.4s ease;
}

.page-section.active { display: block; }

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-header .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.page-actions {
  display: flex;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(0, 212, 255, 0.25);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 10px;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(255, 23, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(255, 23, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 23, 68, 0.25);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

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

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.05;
  transform: translate(30%, -30%);
}

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

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-card .stat-info { flex: 1; }

.stat-card .stat-info .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card .stat-info .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.stat-card .stat-info .stat-trend {
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-trend.up { color: var(--accent-green); }
.stat-trend.down { color: var(--accent-red); }

.stat-icon.blue { background: rgba(30, 136, 229, 0.15); color: var(--accent-blue); }
.stat-icon.cyan { background: rgba(0, 212, 255, 0.15); color: var(--accent-cyan); }
.stat-icon.green { background: rgba(0, 200, 83, 0.15); color: var(--accent-green); }
.stat-icon.orange { background: rgba(255, 145, 0, 0.15); color: var(--accent-orange); }
.stat-icon.purple { background: rgba(124, 77, 255, 0.15); color: var(--accent-purple); }
.stat-icon.red { background: rgba(255, 23, 68, 0.15); color: var(--accent-red); }
.stat-icon.gold { background: rgba(255, 215, 0, 0.15); color: var(--accent-gold); }

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.content-grid .card { margin-bottom: 0; }

.full-width { grid-column: 1 / -1; }

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.tab-item {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-sans);
}

.tab-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.tab-item.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Table */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th, table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

table th {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.02);
}

table td {
  color: var(--text-primary);
}

table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.badge-success {
  background: rgba(0, 200, 83, 0.15);
  color: var(--accent-green);
}

.badge-warning {
  background: rgba(255, 145, 0, 0.15);
  color: var(--accent-orange);
}

.badge-danger {
  background: rgba(255, 23, 68, 0.15);
  color: var(--accent-red);
}

.badge-info {
  background: rgba(30, 136, 229, 0.15);
  color: var(--accent-blue);
}

.badge-default {
  background: rgba(136, 153, 180, 0.15);
  color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.2s ease;
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.3s ease;
}

.modal-lg { max-width: 840px; }

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

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-color);
}

/* Form Elements */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition);
  resize: vertical;
  min-height: 80px;
}

.form-group textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.15);
}

select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238899b4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.15);
}

/* ============================================
   Knowledge Graph Page
   ============================================ */
.knowledge-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.view-switcher {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 3px;
}

.view-btn {
  padding: 7px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-sans);
}

.view-btn:hover { color: var(--text-primary); }
.view-btn.active {
  background: var(--bg-card);
  color: var(--accent-cyan);
  box-shadow: var(--shadow-sm);
}

.knowledge-canvas-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  height: 560px;
}

.knowledge-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.knowledge-outline {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  min-height: 400px;
}

.knowledge-outline.active { display: block; }

.knowledge-map {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  min-height: 400px;
  position: relative;
  overflow: hidden;
}

.knowledge-map.active { display: block; }

/* Tree (Outline) */
.tree-node {
  margin-left: 24px;
  position: relative;
}

.tree-node::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 0;
  bottom: 50%;
  width: 1px;
  background: var(--border-color);
}

.tree-node::after {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  width: 12px;
  height: 1px;
  background: var(--border-color);
}

.tree-root > .tree-node::before,
.tree-root > .tree-node::after { display: none; }

.tree-item {
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.tree-item:hover {
  background: rgba(30, 136, 229, 0.08);
  color: var(--text-primary);
}

.tree-item .toggle {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.tree-item .toggle.expanded { transform: rotate(90deg); }

.tree-item .node-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.tree-children { display: none; }
.tree-children.expanded { display: block; }

/* Micro Course */
.micro-course-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.micro-course-header .back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.micro-course-header .back-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-cyan);
}

.micro-course-content {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}

.micro-course-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-height: 400px;
}

.micro-course-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.micro-course-side .card {
  flex: 1;
}

/* ============================================
   Virtual Portal
   ============================================ */
.portal-config {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.portal-config .card { margin-bottom: 0; }

.template-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.template-item {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.template-item:hover {
  border-color: var(--border-light);
}

.template-item.selected {
  border-color: var(--accent-blue);
  background: rgba(30, 136, 229, 0.08);
}

.template-item .template-preview {
  width: 100%;
  height: 80px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.portal-3d-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 500px;
  position: relative;
}

/* ============================================
   Academic Tracking
   ============================================ */
.academic-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
}

.academic-sidebar .card {
  margin-bottom: 16px;
}

.interest-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.interest-tag {
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(30, 136, 229, 0.1);
  border: 1px solid rgba(30, 136, 229, 0.2);
  color: var(--accent-cyan);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.interest-tag:hover {
  background: rgba(30, 136, 229, 0.2);
}

.interest-tag .remove {
  margin-left: 4px;
  cursor: pointer;
  opacity: 0.6;
}

.interest-tag .remove:hover { opacity: 1; }

.literature-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.literature-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.literature-item:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.literature-item .lit-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.literature-item .lit-authors {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.literature-item .lit-journal {
  font-size: 12px;
  color: var(--text-muted);
}

.literature-item .lit-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.literature-item .lit-checkbox {
  margin-right: 8px;
  accent-color: var(--accent-blue);
}

/* Citation format selector */
.citation-format {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.citation-format select {
  width: auto;
  min-width: 140px;
}

/* Comparison Panel */
.comparison-panel {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 16px;
}

.comparison-panel.active { display: block; }

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.comparison-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.comparison-item h4 {
  font-size: 13px;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.comparison-item p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================
   Learning Tasks
   ============================================ */
.tasks-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
}

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

.task-card .task-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.task-card .task-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.task-card .task-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
  background: var(--gradient-primary);
}

.progress-bar .progress-fill.danger { background: var(--accent-red); }
.progress-bar .progress-fill.warning { background: var(--accent-orange); }

/* Path modes */
.path-mode-switcher {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.path-mode-btn {
  padding: 8px 20px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-sans);
  transition: var(--transition);
}

.path-mode-btn.active {
  border-color: var(--accent-blue);
  background: rgba(30, 136, 229, 0.1);
  color: var(--accent-cyan);
}

.path-mode-btn:hover {
  border-color: var(--border-light);
}

/* Task Detail */
.task-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.task-detail-header .back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.task-detail-header .back-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-cyan);
}

.task-points {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-point {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}

.task-point:hover {
  border-color: var(--border-light);
}

.task-point .point-status {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.point-status.completed { background: rgba(0, 200, 83, 0.15); color: var(--accent-green); }
.point-status.locked { background: rgba(136, 153, 180, 0.15); color: var(--text-muted); }
.point-status.pending { background: rgba(255, 145, 0, 0.15); color: var(--accent-orange); border: 2px solid var(--accent-orange); }

.task-point .point-info { flex: 1; }
.task-point .point-info .point-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.task-point .point-info .point-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 3D Island placeholder */
.island-container {
  width: 100%;
  height: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

/* ============================================
   Security Detection
   ============================================ */
.security-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

.security-nav {
  list-style: none;
}

.security-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  transition: var(--transition);
  cursor: pointer;
}

.security-nav li a:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.security-nav li a.active {
  background: rgba(30, 136, 229, 0.1);
  color: var(--accent-cyan);
}

.config-section {
  margin-bottom: 20px;
}

.config-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.keyword-item .remove {
  cursor: pointer;
  opacity: 0.5;
  font-size: 14px;
}

.keyword-item .remove:hover { opacity: 1; }

.keyword-item.blocked { border-color: rgba(255, 23, 68, 0.3); color: var(--accent-red); }
.keyword-item.ignored { border-color: rgba(0, 200, 83, 0.3); color: var(--accent-green); }

.review-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.review-item .review-content { flex: 1; }
.review-item .review-content .review-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
}

.review-item .review-content .review-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.review-item .review-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Text Correction */
.correction-editor {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.correction-editor .editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.1);
}

.correction-editor .editor-area {
  padding: 16px;
}

.correction-editor textarea {
  width: 100%;
  min-height: 200px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  line-height: 1.8;
  outline: none;
  resize: vertical;
}

.correction-editor textarea::placeholder { color: var(--text-muted); }

.correction-results {
  margin-top: 16px;
}

.correction-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.correction-item .corr-icon {
  color: var(--accent-orange);
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.correction-item .corr-info { flex: 1; }
.correction-item .corr-info .corr-issue {
  font-size: 13px;
  color: var(--text-primary);
}

.correction-item .corr-info .corr-suggestion {
  font-size: 12px;
  color: var(--accent-green);
  margin-top: 2px;
}

/* ============================================
   Coding Module
   ============================================ */
.coding-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.coding-layout .card { margin-bottom: 0; }

.coding-editor-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.coding-editor-wrap .editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
}

.coding-editor-wrap .editor-body {
  min-height: 400px;
  position: relative;
}

.coding-output {
  background: #0d1117;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-green);
  min-height: 120px;
  white-space: pre-wrap;
  margin-top: 12px;
}

.score-display {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 12px;
}

.score-display .score-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.score-circle.excellent { background: rgba(0, 200, 83, 0.15); color: var(--accent-green); border: 3px solid var(--accent-green); }
.score-circle.good { background: rgba(30, 136, 229, 0.15); color: var(--accent-blue); border: 3px solid var(--accent-blue); }
.score-circle.fair { background: rgba(255, 145, 0, 0.15); color: var(--accent-orange); border: 3px solid var(--accent-orange); }
.score-circle.poor { background: rgba(255, 23, 68, 0.15); color: var(--accent-red); border: 3px solid var(--accent-red); }

.score-details { flex: 1; }
.score-details .score-dimension {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.score-details .score-dimension .dim-name { color: var(--text-secondary); }
.score-details .score-dimension .dim-score { color: var(--text-primary); font-weight: 500; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
  .sidebar { width: 60px; }
  .sidebar .menu-item a span:not(.menu-icon) { display: none; }
  .sidebar .menu-item a { justify-content: center; padding: 11px; }
  .sidebar .menu-label { display: none; }
  .main-content { margin-left: 60px; }
  .academic-layout { grid-template-columns: 1fr; }
  .security-layout { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .micro-course-content { grid-template-columns: 1fr; }
  .portal-config { grid-template-columns: 1fr; }
  .coding-layout { grid-template-columns: 1fr; }
  .comparison-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 16px; }
  .top-nav .nav-search { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .tasks-list { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
  .template-selector { grid-template-columns: 1fr; }
  .mobile-bottom-nav {
    display: flex;
  }
}

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-nav);
  border-top: 1px solid var(--border-color);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
}

.mobile-bottom-nav .m-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: var(--transition);
  background: none;
  border: none;
  font-family: var(--font-sans);
}

.mobile-bottom-nav .m-nav-item .m-icon {
  font-size: 20px;
}

.mobile-bottom-nav .m-nav-item.active {
  color: var(--accent-cyan);
}

/* Utility */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }

/* Loading Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card-hover) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease infinite;
  border-radius: 4px;
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Confirm Dialog */
.confirm-dialog .modal { max-width: 400px; }
.confirm-dialog .modal-body { text-align: center; padding: 32px 24px; }
.confirm-dialog .modal-body .confirm-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.confirm-dialog .modal-body h3 { font-size: 18px; margin-bottom: 8px; }
.confirm-dialog .modal-body p { color: var(--text-secondary); font-size: 14px; }