/* ============================================
   云卡栈 - 高级感UI系统 v8.0
   最终补充20项优化（第101-120项）
   总计120项高级感优化
   ============================================ */

/* ========== 101. 自定义主题色 ========== */
.theme-custom {
  --primary-50: var(--custom-primary-50, #eff6ff);
  --primary-100: var(--custom-primary-100, #dbeafe);
  --primary-200: var(--custom-primary-200, #bfdbfe);
  --primary-300: var(--custom-primary-300, #93c5fd);
  --primary-400: var(--custom-primary-400, #60a5fa);
  --primary-500: var(--custom-primary-500, #3b82f6);
  --primary-600: var(--custom-primary-600, #2563eb);
  --primary-700: var(--custom-primary-700, #1d4ed8);
  --gradient-primary: var(--custom-gradient, linear-gradient(135deg, #667eea, #764ba2));
}

.theme-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-color {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s ease;
}

.theme-color:hover {
  transform: scale(1.1);
}

.theme-color.active {
  border-color: var(--text-primary);
  transform: scale(1.1);
}

/* ========== 102. 字体大小调节 ========== */
.font-size-small { font-size: 14px; }
.font-size-medium { font-size: 16px; }
.font-size-large { font-size: 18px; }

.font-size-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.font-size-btn {
  padding: 4px 10px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s ease;
}

.font-size-btn.active {
  background: var(--primary-500);
  color: white;
  border-color: var(--primary-500);
}

/* ========== 103. 高对比度模式 ========== */
.high-contrast {
  --text-primary: #000;
  --text-secondary: #333;
  --border-light: #000;
  --border-medium: #000;
  --bg-card: #fff;
  --bg-primary: #fff;
  --bg-secondary: #f0f0f0;
}

.high-contrast .btn-primary {
  background: #000 !important;
  color: #fff !important;
  border: 2px solid #000 !important;
}

.high-contrast a {
  text-decoration: underline;
  color: #0000ee;
}

/* ========== 104. 键盘快捷键提示 ========== */
.kbd {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  font-family: monospace;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  box-shadow: 0 2px 0 var(--border-light);
}

.shortcut-hint {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  color: var(--text-secondary);
  z-index: 2000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.shortcut-hint.show {
  opacity: 1;
  transform: translateY(0);
}

/* ========== 105. 拖拽上传 ========== */
.drop-zone {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  background: var(--bg-card);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--primary-400);
  background: var(--primary-50);
}

.drop-zone.dragover {
  transform: scale(1.02);
}

.drop-zone-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* ========== 106. 图片裁剪 ========== */
.crop-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.crop-container {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px;
  max-width: 90vw;
  max-height: 90vh;
}

.crop-area {
  position: relative;
  max-width: 400px;
  max-height: 400px;
  overflow: hidden;
}

.crop-area img {
  max-width: 100%;
  display: block;
}

.crop-overlay {
  position: absolute;
  inset: 0;
  border: 2px solid white;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
}

/* ========== 107. 图片压缩提示 ========== */
.compress-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}

.compress-progress-bar {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ========== 108. 视频缩略图 ========== */
.video-thumbnail {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
}

.video-thumbnail img {
  width: 100%;
  display: block;
}

.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.2s ease;
}

.video-thumbnail:hover .video-play-btn {
  background: var(--primary-500);
  transform: translate(-50%, -50%) scale(1.1);
}

.video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

/* ========== 109. 音频波形 ========== */
.audio-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 0 8px;
}

.audio-wave-bar {
  flex: 1;
  background: var(--primary-300);
  border-radius: 2px;
  transition: height 0.1s ease;
  min-height: 4px;
}

.audio-wave-bar.playing {
  background: var(--primary-500);
  animation: wavePulse 0.5s ease infinite alternate;
}

@keyframes wavePulse {
  from { transform: scaleY(0.5); }
  to { transform: scaleY(1); }
}

/* ========== 110. 文件预览 ========== */
.file-preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.file-preview-content {
  background: var(--bg-card);
  border-radius: 16px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  padding: 20px;
}

/* ========== 111. 代码高亮 ========== */
.code-block {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 16px;
  border-radius: 8px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 14px;
  overflow-x: auto;
  position: relative;
}

.code-block .keyword { color: #569cd6; }
.code-block .string { color: #ce9178; }
.code-block .comment { color: #6a9955; }
.code-block .function { color: #dcdcaa; }
.code-block .number { color: #b5cea8; }

.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.1);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.code-copy-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* ========== 112. Markdown渲染 ========== */
.markdown-body h1 { font-size: 2em; font-weight: 700; margin: 0.67em 0; }
.markdown-body h2 { font-size: 1.5em; font-weight: 600; margin: 0.83em 0; }
.markdown-body h3 { font-size: 1.17em; font-weight: 600; margin: 1em 0; }
.markdown-body p { margin: 1em 0; line-height: 1.7; }
.markdown-body ul, .markdown-body ol { padding-left: 2em; margin: 1em 0; }
.markdown-body li { margin: 0.5em 0; }
.markdown-body blockquote {
  border-left: 4px solid var(--primary-300);
  padding-left: 16px;
  margin: 1em 0;
  color: var(--text-secondary);
}
.markdown-body code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
}
.markdown-body pre {
  background: #1e1e1e;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
}
.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--border-light);
  padding: 8px 12px;
  text-align: left;
}
.markdown-body th {
  background: var(--bg-secondary);
  font-weight: 600;
}

/* ========== 113. 表格排序 ========== */
.sortable-table th {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.sortable-table th:hover {
  background: var(--bg-secondary);
}

.sortable-table th::after {
  content: '↕';
  margin-left: 4px;
  opacity: 0.3;
  font-size: 12px;
}

.sortable-table th.sort-asc::after {
  content: '↑';
  opacity: 1;
  color: var(--primary-500);
}

.sortable-table th.sort-desc::after {
  content: '↓';
  opacity: 1;
  color: var(--primary-500);
}

/* ========== 114. 表格筛选 ========== */
.table-filter-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  margin-top: 4px;
}

/* ========== 115/116. 导出按钮 ========== */
.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.export-btn:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

/* ========== 117. 打印优化 ========== */
@media print {
  .no-print { display: none !important; }
  body { background: white !important; }
  .print-area { box-shadow: none !important; border: none !important; }
  a { text-decoration: none; color: black; }
  .btn { display: none !important; }
}

/* ========== 118. 分享卡片 ========== */
.share-card {
  width: 300px;
  background: var(--gradient-primary);
  border-radius: 16px;
  padding: 24px;
  color: white;
  position: relative;
  overflow: hidden;
}

.share-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}

.share-card-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.share-card-desc {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 16px;
}

.share-card-qr {
  width: 80px;
  height: 80px;
  background: white;
  border-radius: 8px;
  padding: 4px;
}

/* ========== 119. 二维码生成 ========== */
.qr-code-container {
  display: inline-block;
  padding: 16px;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.qr-code-container canvas {
  display: block;
}

/* ========== 120. 截图功能 ========== */
.screenshot-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--primary-500);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.screenshot-btn:hover {
  background: var(--primary-600);
}

/* 响应式 */
@media (max-width: 768px) {
  .share-card { width: 100%; }
  .crop-container { padding: 12px; }
}
