/* ============================================
   云卡栈 - 高级感UI系统 v13.0
   极致优化20项（第201-220项）
   总计220项高级感优化
   ============================================ */

/* ========== 201. 虚拟滚动 ========== */
.virtual-scroll {
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

.virtual-scroll-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.virtual-scroll-item {
  position: absolute;
  left: 0;
  right: 0;
  will-change: transform;
}

/* ========== 202. 滚动驱动动画 ========== */
.scroll-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-reveal-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

.scroll-reveal-rotate {
  opacity: 0;
  transform: rotate(-10deg) scale(0.9);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-reveal-rotate.visible {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* 滚动进度条 */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--gradient-primary);
  z-index: 9999;
  transition: width 0.1s ease;
}

/* ========== 203. 物理弹簧动画 ========== */
.spring-animation {
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.spring-animation:hover {
  transform: scale(1.05);
}

.spring-animation:active {
  transform: scale(0.95);
}

.spring-bounce {
  animation: springBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes springBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.spring-pop {
  animation: springPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes springPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ========== 204. 3D图表 ========== */
.chart-3d-container {
  perspective: 1000px;
  width: 100%;
  height: 300px;
}

.chart-3d {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

.chart-3d-bar {
  position: absolute;
  bottom: 0;
  width: 40px;
  background: var(--gradient-primary);
  border-radius: 4px 4px 0 0;
  transform-style: preserve-3d;
  transition: height 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 -4px 12px rgba(59, 130, 246, 0.3);
}

.chart-3d-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 10px;
  background: rgba(255,255,255,0.3);
  transform: rotateX(90deg);
  transform-origin: top;
}

.chart-3d-bar::after {
  content: '';
  position: absolute;
  top: 0;
  right: -10px;
  bottom: 0;
  width: 10px;
  background: rgba(0,0,0,0.2);
  transform: rotateY(90deg);
  transform-origin: left;
}

/* ========== 205. 关系图谱 ========== */
.graph-container {
  position: relative;
  width: 100%;
  height: 400px;
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
}

.graph-node {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.graph-node:hover {
  transform: scale(1.2);
  z-index: 10;
}

.graph-node.center {
  width: 70px;
  height: 70px;
  font-size: 14px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.graph-line {
  position: absolute;
  height: 2px;
  background: var(--primary-300);
  transform-origin: left center;
  z-index: 1;
  opacity: 0.6;
}

.graph-label {
  position: absolute;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  transform: translate(-50%, -50%);
  z-index: 3;
}

/* ========== 206. 桑基图 ========== */
.sankey-container {
  position: relative;
  width: 100%;
  height: 300px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px;
}

.sankey-node {
  position: absolute;
  width: 20px;
  background: var(--gradient-primary);
  border-radius: 4px;
  transition: all 0.3s ease;
}

.sankey-node:hover {
  opacity: 0.8;
}

.sankey-flow {
  position: absolute;
  background: linear-gradient(90deg, var(--primary-300), var(--primary-500));
  opacity: 0.4;
  border-radius: 10px;
  transition: opacity 0.3s ease;
}

.sankey-flow:hover {
  opacity: 0.7;
}

/* ========== 207. 自定义右键菜单 ========== */
.context-menu {
  position: fixed;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-2xl);
  padding: 8px;
  min-width: 180px;
  z-index: 10000;
  display: none;
  border: 1px solid var(--border-light);
}

.context-menu.show {
  display: block;
  animation: contextMenuIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes contextMenuIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.context-menu-item:hover {
  background: var(--bg-secondary);
}

.context-menu-item.danger {
  color: var(--danger);
}

.context-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.context-menu-icon {
  width: 18px;
  text-align: center;
}

.context-menu-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

.context-menu-shortcut {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ========== 208. 命令面板 ========== */
.command-palette {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 10001;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.command-palette.show {
  display: flex;
}

.command-palette-box {
  width: 90%;
  max-width: 560px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  animation: commandPaletteIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes commandPaletteIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.command-palette-input {
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-bottom: 1px solid var(--border-light);
  font-size: 16px;
  outline: none;
  background: transparent;
  color: var(--text-primary);
}

.command-palette-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
}

.command-palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.command-palette-item:hover,
.command-palette-item.active {
  background: var(--primary-50);
}

.command-palette-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.command-palette-text {
  flex: 1;
}

.command-palette-title {
  font-size: 14px;
  font-weight: 500;
}

.command-palette-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.command-palette-shortcut {
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ========== 209. Web Push通知 ========== */
.push-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 320px;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-2xl);
  padding: 16px;
  z-index: 10002;
  display: flex;
  gap: 12px;
  animation: pushIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-left: 4px solid var(--primary-500);
}

@keyframes pushIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

.push-notification.hide {
  animation: pushOut 0.3s ease forwards;
}

@keyframes pushOut {
  to { opacity: 0; transform: translateX(100%); }
}

.push-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.push-content {
  flex: 1;
  min-width: 0;
}

.push-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.push-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.push-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.push-close:hover {
  background: var(--bg-secondary);
}

/* ========== 210. PWA安装提示 ========== */
.pwa-install-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 400px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-2xl);
  padding: 16px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: pwaBannerIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pwaBannerIn {
  from { opacity: 0; transform: translateX(-50%) translateY(100%); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.pwa-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.pwa-info {
  flex: 1;
}

.pwa-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.pwa-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.pwa-install-btn {
  padding: 8px 16px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.pwa-install-btn:hover {
  transform: scale(1.05);
}

.pwa-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* ========== 212. 多语言切换 ========== */
.lang-switcher {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: 8px;
}

.lang-option {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.lang-option.active {
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ========== 213. 主题生成器 ========== */
.theme-generator {
  padding: 20px;
}

.theme-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.theme-color-label {
  width: 80px;
  font-size: 13px;
  color: var(--text-secondary);
}

.theme-color-picker {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

.theme-color-preview {
  flex: 1;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  font-weight: 600;
}

.theme-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.theme-preset {
  aspect-ratio: 2;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.theme-preset:hover {
  transform: scale(1.05);
}

.theme-preset.active {
  border-color: var(--primary-500);
}

.theme-preset.active::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: var(--primary-500);
  color: white;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== 217. 代码编辑器 ========== */
.code-editor {
  background: #1e1e1e;
  border-radius: 12px;
  overflow: hidden;
  font-family: 'Consolas', 'Monaco', monospace;
}

.code-editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #2d2d2d;
  border-bottom: 1px solid #404040;
}

.code-editor-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.code-editor-dot.red { background: #ff5f56; }
.code-editor-dot.yellow { background: #ffbd2e; }
.code-editor-dot.green { background: #27c93f; }

.code-editor-filename {
  margin-left: 8px;
  color: #999;
  font-size: 13px;
}

.code-editor-body {
  display: flex;
  max-height: 400px;
  overflow: auto;
}

.code-line-numbers {
  padding: 16px 12px;
  color: #666;
  text-align: right;
  user-select: none;
  font-size: 13px;
  line-height: 1.6;
  background: #252526;
  min-width: 50px;
}

.code-content {
  flex: 1;
  padding: 16px;
  color: #d4d4d4;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}

.code-keyword { color: #569cd6; }
.code-string { color: #ce9178; }
.code-comment { color: #6a9955; }
.code-function { color: #dcdcaa; }
.code-number { color: #b5cea8; }
.code-variable { color: #9cdcfe; }

/* ========== 218. 地图可视化 ========== */
.map-container {
  position: relative;
  width: 100%;
  height: 300px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: 16px;
  overflow: hidden;
}

.map-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
  animation: mapDotPulse 2s infinite;
}

@keyframes mapDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.7; }
}

.map-dot::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.2);
  animation: mapDotRipple 2s infinite;
}

@keyframes mapDotRipple {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.map-tooltip {
  position: absolute;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
}

/* ========== 220. 全局快捷键系统 ========== */
.shortcut-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.shortcut-key {
  display: inline-block;
  padding: 2px 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 11px;
  font-family: monospace;
  color: var(--text-secondary);
  box-shadow: 0 1px 0 var(--border-light);
}

.shortcut-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 10003;
  display: none;
  align-items: center;
  justify-content: center;
}

.shortcut-overlay.show {
  display: flex;
}

.shortcut-modal {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.shortcut-modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shortcut-group {
  margin-bottom: 16px;
}

.shortcut-group-title {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}

.shortcut-row-keys {
  display: flex;
  gap: 4px;
}

/* 响应式 */
@media (max-width: 768px) {
  .command-palette-box { width: 95%; }
  .push-notification { width: calc(100% - 40px); }
  .theme-preset-grid { grid-template-columns: repeat(3, 1fr); }
}
