/* ============================================
   云卡栈 - 高级感UI系统 v21.0
   功能增强20项（第361-380项）
   总计380项高级感优化
   ============================================ */

/* ========== 361. 数据可视化图表 ========== */
.chart-container {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.chart-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-canvas {
  width: 100%;
  height: 200px;
  position: relative;
}

.chart-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 100%;
  gap: 8px;
}

.chart-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.chart-bar-fill {
  width: 100%;
  background: var(--gradient-primary);
  border-radius: 6px 6px 0 0;
  transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 4px;
  position: relative;
}

.chart-bar-fill:hover {
  opacity: 0.85;
}

.chart-bar-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.chart-line {
  position: relative;
  height: 100%;
}

.chart-line-svg {
  width: 100%;
  height: 100%;
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.chart-tooltip {
  position: absolute;
  background: rgba(0,0,0,0.85);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  pointer-events: none;
  z-index: 100;
  transform: translate(-50%, -100%);
  white-space: nowrap;
}

/* ========== 362. 实时通知推送 ========== */
.notification-badge {
  position: relative;
}

.notification-badge::after {
  content: attr(data-count);
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  background: #ef4444;
  color: white;
  border-radius: 8px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-weight: 600;
  animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.notification-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: var(--shadow-2xl);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  z-index: 10000;
  max-width: 320px;
  animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-left: 4px solid var(--primary-500);
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

.notification-toast.hide {
  animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideOut {
  to { opacity: 0; transform: translateX(100%); }
}

.notification-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
}

.notification-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.notification-body {
  font-size: 12px;
  color: var(--text-secondary);
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
}

/* ========== 363. 拖拽排序 ========== */
.drag-item {
  cursor: grab;
  transition: all 0.2s ease;
  user-select: none;
}

.drag-item:active {
  cursor: grabbing;
}

.drag-item.dragging {
  opacity: 0.5;
  transform: scale(1.02);
  box-shadow: var(--shadow-2xl);
  z-index: 100;
}

.drag-item.drag-over {
  border-top: 3px solid var(--primary-500);
}

.drag-handle {
  cursor: grab;
  color: var(--text-tertiary);
  padding: 8px;
}

.drag-handle:active {
  cursor: grabbing;
}

/* ========== 364. 富文本编辑器 ========== */
.rich-editor {
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-card);
}

.rich-editor-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
  flex-wrap: wrap;
}

.rich-editor-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.rich-editor-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.rich-editor-btn.active {
  background: var(--primary-100);
  color: var(--primary-600);
}

.rich-editor-content {
  padding: 12px;
  min-height: 120px;
  outline: none;
  font-size: 14px;
  line-height: 1.6;
}

.rich-editor-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-tertiary);
}

/* ========== 365. 图片裁剪上传 ========== */
.image-cropper {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cropper-container {
  position: relative;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 12px;
}

.cropper-image {
  max-width: 100%;
  max-height: 100%;
  user-select: none;
  pointer-events: none;
}

.cropper-overlay {
  position: absolute;
  inset: 0;
  border: 2px solid white;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
  border-radius: 50%;
}

.cropper-controls {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.cropper-btn {
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.cropper-btn.primary {
  background: var(--gradient-primary);
  color: white;
}

.cropper-btn.secondary {
  background: rgba(255,255,255,0.2);
  color: white;
}

.cropper-slider {
  width: 100%;
  max-width: 300px;
  margin-top: 16px;
  -webkit-appearance: none;
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  outline: none;
}

.cropper-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
}

/* ========== 366. 二维码生成 ========== */
.qr-code-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
}

.qr-code {
  width: 180px;
  height: 180px;
  background: white;
  padding: 12px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.qr-code canvas {
  width: 100%;
  height: 100%;
}

.qr-code-label {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.qr-code-actions {
  display: flex;
  gap: 10px;
}

.qr-action-btn {
  padding: 8px 16px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.qr-action-btn:hover {
  background: var(--bg-card);
}

/* ========== 367. 分享卡片优化 ========== */
.share-card {
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  max-width: 320px;
}

.share-card-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--bg-secondary);
}

.share-card-body {
  padding: 14px;
}

.share-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.share-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.share-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.share-card-price {
  font-size: 18px;
  font-weight: 700;
  color: #ef4444;
}

.share-card-brand {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ========== 368. 语音输入搜索 ========== */
.voice-input-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s ease;
}

.voice-input-btn.recording {
  background: #ef4444;
  color: white;
  animation: voicePulse 1s infinite;
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 12px rgba(239,68,68,0); }
}

.voice-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 20px;
}

.voice-wave-bar {
  width: 3px;
  background: currentColor;
  border-radius: 2px;
  animation: voiceWave 0.5s ease-in-out infinite;
}

.voice-wave-bar:nth-child(1) { animation-delay: 0s; height: 40%; }
.voice-wave-bar:nth-child(2) { animation-delay: 0.1s; height: 70%; }
.voice-wave-bar:nth-child(3) { animation-delay: 0.2s; height: 100%; }
.voice-wave-bar:nth-child(4) { animation-delay: 0.3s; height: 60%; }
.voice-wave-bar:nth-child(5) { animation-delay: 0.4s; height: 30%; }

@keyframes voiceWave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}

/* ========== 370. 生物识别登录 ========== */
.biometric-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.biometric-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--primary-300);
}

.biometric-icon {
  font-size: 20px;
}

.biometric-scanning {
  animation: biometricScan 1.5s ease-in-out infinite;
}

@keyframes biometricScan {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.1); }
}

/* ========== 371. 应用内热更新 ========== */
.update-banner {
  position: fixed;
  bottom: 80px;
  left: 16px;
  right: 16px;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-2xl);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  animation: updateBannerIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes updateBannerIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.update-icon {
  font-size: 28px;
}

.update-info {
  flex: 1;
}

.update-title {
  font-size: 14px;
  font-weight: 600;
}

.update-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.update-btn {
  padding: 8px 16px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.update-progress {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--bg-secondary);
  z-index: 10000;
}

.update-progress-bar {
  height: 100%;
  background: var(--gradient-primary);
  transition: width 0.3s ease;
}

/* ========== 373. 数据导出Excel ========== */
.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.export-btn:hover {
  background: #059669;
  transform: translateY(-1px);
}

.export-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ========== 374. 批量操作 ========== */
.batch-toolbar {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.batch-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-600);
}

.batch-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.batch-btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.batch-btn.primary {
  background: var(--primary-500);
  color: white;
}

.batch-btn.danger {
  background: #ef4444;
  color: white;
}

.batch-btn.secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ========== 375. 键盘快捷键 ========== */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 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);
}

/* ========== 376. 命令面板 ========== */
.command-palette {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  display: none;
  justify-content: center;
  padding-top: 15vh;
  animation: paletteFadeIn 0.15s ease;
}

@keyframes paletteFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.command-palette-modal {
  width: 100%;
  max-width: 500px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  animation: paletteSlideIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes paletteSlideIn {
  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;
  outline: none;
  font-size: 16px;
  background: transparent;
  border-bottom: 1px solid var(--border-light);
}

.command-palette-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
}

.command-palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.command-palette-item:hover,
.command-palette-item.active {
  background: var(--bg-secondary);
}

.command-palette-icon {
  font-size: 18px;
  width: 28px;
  text-align: center;
}

.command-palette-text {
  flex: 1;
  font-size: 14px;
}

.command-palette-shortcut {
  display: flex;
  gap: 4px;
}

/* ========== 377. 全局搜索 ========== */
.global-search {
  position: relative;
}

.global-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-2xl);
  margin-top: 8px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
}

.search-result-group {
  padding: 8px 0;
}

.search-result-group-title {
  padding: 6px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-result-item:hover {
  background: var(--bg-secondary);
}

.search-result-icon {
  font-size: 18px;
  width: 28px;
  text-align: center;
}

.search-result-text {
  flex: 1;
  font-size: 14px;
}

.search-result-text mark {
  background: var(--primary-100);
  color: var(--primary-600);
  padding: 0 2px;
  border-radius: 2px;
}

.search-highlight {
  background: #fef08a;
  padding: 0 2px;
  border-radius: 2px;
}

/* ========== 378. 性能仪表盘 ========== */
.perf-dashboard {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.85);
  color: #10b981;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 11px;
  font-family: monospace;
  z-index: 9999;
  pointer-events: none;
  line-height: 1.6;
  min-width: 140px;
}

.perf-dashboard .label {
  color: #94a3b8;
}

.perf-dashboard .value {
  color: #10b981;
}

.perf-dashboard .value.warn {
  color: #f59e0b;
}

.perf-dashboard .value.error {
  color: #ef4444;
}

/* ========== 379. 图片自动压缩 ========== */
.upload-zone {
  border: 2px dashed var(--border-light);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-secondary);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary-500);
  background: var(--primary-50);
}

.upload-zone-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.upload-zone-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.upload-zone-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.upload-progress {
  margin-top: 12px;
}

.upload-progress-bar {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.upload-progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-align: center;
}

/* ========== 380. 深色模式增强 ========== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --border-light: #334155;
  }
}

[data-theme="auto"] {
  /* 跟随系统 */
}

/* 主题切换动画 */
* {
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* 通用工具类 */
.gpu-accelerated {
  transform: translateZ(0);
  will-change: transform;
}

.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.safe-area-top {
  padding-top: env(safe-area-inset-top, 0);
}
\n.command-palette.show { display: flex !important; }
