/* ============================================
   云卡栈 - 高级感UI系统 v14.0
   终极优化20项（第221-240项）
   总计240项高级感优化
   ============================================ */

/* ========== 221. 语音输入 ========== */
.voice-input-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.voice-input-btn:hover {
  background: var(--primary-50);
}

.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 10px rgba(239, 68, 68, 0); }
}

.voice-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 20px;
}

.voice-wave-bar {
  width: 3px;
  background: var(--primary-500);
  border-radius: 2px;
  animation: voiceWave 0.5s ease infinite;
}

.voice-wave-bar:nth-child(1) { animation-delay: 0s; height: 8px; }
.voice-wave-bar:nth-child(2) { animation-delay: 0.1s; height: 16px; }
.voice-wave-bar:nth-child(3) { animation-delay: 0.2s; height: 12px; }
.voice-wave-bar:nth-child(4) { animation-delay: 0.3s; height: 20px; }
.voice-wave-bar:nth-child(5) { animation-delay: 0.4s; height: 10px; }

@keyframes voiceWave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}

/* ========== 223. 二维码扫描 ========== */
.qr-scanner {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 10004;
  display: none;
  flex-direction: column;
}

.qr-scanner.show {
  display: flex;
}

.qr-scanner-video {
  flex: 1;
  width: 100%;
  object-fit: cover;
}

.qr-scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.qr-scanner-frame {
  width: 250px;
  height: 250px;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 16px;
  position: relative;
}

.qr-scanner-frame::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #10b981;
  top: 0;
  animation: qrScan 2s linear infinite;
}

@keyframes qrScan {
  0% { top: 0; }
  50% { top: calc(100% - 2px); }
  100% { top: 0; }
}

.qr-scanner-frame-corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: #10b981;
  border-style: solid;
}

.qr-scanner-frame-corner.tl { top: -2px; left: -2px; border-width: 4px 0 0 4px; border-radius: 8px 0 0 0; }
.qr-scanner-frame-corner.tr { top: -2px; right: -2px; border-width: 4px 4px 0 0; border-radius: 0 8px 0 0; }
.qr-scanner-frame-corner.bl { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; border-radius: 0 0 0 8px; }
.qr-scanner-frame-corner.br { bottom: -2px; right: -2px; border-width: 0 4px 4px 0; border-radius: 0 0 8px 0; }

.qr-scanner-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
}

.qr-scanner-tip {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 14px;
  text-align: center;
  background: rgba(0,0,0,0.5);
  padding: 8px 16px;
  border-radius: 20px;
}

/* ========== 224. 图片压缩 ========== */
.image-compressor {
  padding: 20px;
}

.compress-dropzone {
  border: 2px dashed var(--border-light);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-secondary);
}

.compress-dropzone:hover,
.compress-dropzone.dragover {
  border-color: var(--primary-400);
  background: var(--primary-50);
}

.compress-dropzone-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.compress-dropzone-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.compress-result {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: 12px;
  margin-top: 16px;
}

.compress-result-preview {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
}

.compress-result-info {
  flex: 1;
}

.compress-result-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.compress-result-size {
  font-size: 12px;
  color: var(--text-secondary);
}

.compress-result-saved {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

.compress-slider {
  width: 100%;
  margin: 16px 0;
}

/* ========== 225. 图片裁剪 ========== */
.image-cropper {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 10005;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.image-cropper.show {
  display: flex;
}

.cropper-container {
  position: relative;
  max-width: 90%;
  max-height: 70vh;
  overflow: hidden;
}

.cropper-image {
  max-width: 100%;
  max-height: 70vh;
  display: block;
}

.cropper-overlay {
  position: absolute;
  inset: 0;
  border: 2px solid white;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
  cursor: move;
}

.cropper-controls {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.cropper-btn {
  padding: 10px 24px;
  border-radius: 24px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  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;
}

/* ========== 227. 录屏功能 ========== */
.screen-recorder {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-2xl);
  padding: 16px;
  z-index: 10006;
  display: none;
  align-items: center;
  gap: 12px;
}

.screen-recorder.show {
  display: flex;
}

.recording-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  animation: recordingPulse 1s infinite;
}

@keyframes recordingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.recording-time {
  font-family: monospace;
  font-size: 18px;
  font-weight: 600;
}

.recording-stop-btn {
  padding: 8px 16px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ========== 228. 录音功能 ========== */
.audio-recorder {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
}

.audio-record-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.audio-record-btn.recording {
  background: #ef4444;
  animation: recordingPulse 1s infinite;
}

.audio-record-btn:hover {
  transform: scale(1.1);
}

.audio-waveform {
  flex: 1;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.audio-wave-bar {
  flex: 1;
  background: var(--primary-300);
  border-radius: 2px;
  transition: height 0.1s ease;
}

.audio-duration {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: monospace;
  min-width: 45px;
}

/* ========== 229. 文件夹上传 ========== */
.folder-upload {
  border: 2px dashed var(--border-light);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  background: var(--bg-secondary);
  transition: all 0.2s ease;
}

.folder-upload.dragover {
  border-color: var(--primary-400);
  background: var(--primary-50);
}

.folder-upload-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.folder-upload-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.folder-file-list {
  margin-top: 16px;
  max-height: 200px;
  overflow-y: auto;
}

.folder-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}

.folder-file-icon {
  font-size: 16px;
}

.folder-file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-file-size {
  color: var(--text-secondary);
  font-size: 12px;
}

/* ========== 230. 大文件分片上传 ========== */
.upload-progress {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}

.upload-progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
  position: relative;
}

.upload-progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: uploadShine 1.5s infinite;
}

@keyframes uploadShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.upload-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.upload-speed {
  color: var(--primary-500);
  font-weight: 600;
}

/* ========== 232. 下载管理器 ========== */
.download-manager {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 320px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-2xl);
  z-index: 10007;
  overflow: hidden;
  display: none;
}

.download-manager.show {
  display: block;
}

.download-manager-header {
  padding: 12px 16px;
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.download-manager-title {
  font-size: 14px;
  font-weight: 600;
}

.download-manager-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
}

.download-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
}

.download-item {
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 4px;
  transition: background 0.2s ease;
}

.download-item:hover {
  background: var(--bg-secondary);
}

.download-item-name {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== 234. 手势密码 ========== */
.gesture-lock {
  padding: 20px;
  text-align: center;
}

.gesture-canvas {
  touch-action: none;
  margin: 0 auto;
  display: block;
}

.gesture-tip {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.gesture-tip.error {
  color: var(--danger);
}

.gesture-tip.success {
  color: var(--success);
}

/* ========== 235. 图案解锁 ========== */
.pattern-lock {
  padding: 20px;
}

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 240px;
  margin: 0 auto;
}

.pattern-dot {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid var(--border-light);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.pattern-dot.active {
  border-color: var(--primary-500);
  background: var(--primary-50);
  transform: scale(0.9);
}

.pattern-dot.active::after {
  content: '';
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  background: var(--primary-500);
}

/* ========== 236. 手写签名 ========== */
.signature-pad {
  border: 2px solid var(--border-light);
  border-radius: 12px;
  background: white;
  cursor: crosshair;
  touch-action: none;
}

.signature-controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.signature-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.signature-btn:hover {
  background: var(--bg-secondary);
}

.signature-btn.primary {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
}

/* ========== 237. 画板功能 ========== */
.drawing-board {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 10008;
  display: none;
  flex-direction: column;
}

.drawing-board.show {
  display: flex;
}

.drawing-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.drawing-tool {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.drawing-tool:hover,
.drawing-tool.active {
  background: var(--primary-50);
  border-color: var(--primary-400);
}

.drawing-color {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--border-light);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.drawing-color:hover {
  transform: scale(1.2);
}

.drawing-color.active {
  box-shadow: 0 0 0 2px var(--primary-500);
}

.drawing-canvas {
  flex: 1;
  cursor: crosshair;
}

/* ========== 238. 颜色拾取器 ========== */
.color-picker-popup {
  position: absolute;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-2xl);
  padding: 12px;
  z-index: 10009;
  display: none;
}

.color-picker-popup.show {
  display: block;
}

.color-picker-saturation {
  width: 200px;
  height: 150px;
  border-radius: 8px;
  position: relative;
  cursor: crosshair;
  margin-bottom: 8px;
}

.color-picker-hue {
  width: 200px;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  cursor: pointer;
  position: relative;
  margin-bottom: 8px;
}

.color-picker-preview {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-picker-value {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 12px;
  font-family: monospace;
}

/* ========== 240. 网页标注 ========== */
.annotation-toolbar {
  position: fixed;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  background: var(--bg-card);
  border-radius: 24px;
  box-shadow: var(--shadow-2xl);
  padding: 8px;
  z-index: 10010;
  display: none;
  flex-direction: column;
  gap: 4px;
}

.annotation-toolbar.show {
  display: flex;
}

.annotation-tool {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.annotation-tool:hover,
.annotation-tool.active {
  background: var(--primary-50);
}

.annotation-canvas {
  position: fixed;
  inset: 0;
  z-index: 10009;
  pointer-events: none;
}

.annotation-canvas.active {
  pointer-events: auto;
  cursor: crosshair;
}

.annotation-note {
  position: absolute;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  max-width: 200px;
  z-index: 10010;
  box-shadow: var(--shadow-md);
}

/* 响应式 */
@media (max-width: 768px) {
  .qr-scanner-frame { width: 200px; height: 200px; }
  .pattern-grid { gap: 16px; }
  .pattern-dot { width: 50px; height: 50px; }
}
