/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), #7c3aed);
  color: #fff;
  box-shadow: 0 4px 15px rgba(168,85,247,0.3);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(168,85,247,0.45);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-card-hover); }

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(239,68,68,0.35); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); border-color: var(--accent-purple); }

.btn-cyan {
  background: linear-gradient(135deg, var(--accent-cyan), #0891b2);
  color: #fff;
  box-shadow: 0 4px 15px rgba(6,182,212,0.3);
}
.btn-cyan:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(6,182,212,0.45); }

.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.8rem; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; border-radius: var(--radius-md); }
.btn-full { width: 100%; }

.btn-icon {
  width: 2.25rem; height: 2.25rem;
  padding: 0;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-icon:hover { color: var(--text-primary); border-color: var(--accent-purple); }

/* Loading spinner inside button */
.btn .spinner {
  width: 1em; height: 1em;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Form elements */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.form-label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); }

.form-input, .form-textarea, .form-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  padding: 0.625rem 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  /* 多语言字体支持：优先使用 UKIJ 字体渲染维吾尔文/阿拉伯文 */
  font-family: 'UKIJ Esliye', 'UKIJ Tor', 'Scheherazade New',
               'Inter', 'PingFang SC', 'Microsoft YaHei',
               'Jomolhari', 'Mongolian Baiti',
               'Helvetica Neue', sans-serif;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(168,85,247,0.15);
}
.form-textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.form-select { 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 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem;
}
.form-select option { background: var(--bg-surface); color: var(--text-primary); }

/* Slider */
.form-range {
  -webkit-appearance: none;
  width: 100%; height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(168,85,247,0.2);
  cursor: pointer;
  transition: box-shadow var(--transition);
}
.form-range::-webkit-slider-thumb:hover { box-shadow: 0 0 0 5px rgba(168,85,247,0.3); }

/* Badge */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
}
.badge-purple { background: rgba(168,85,247,0.15); color: var(--accent-purple); }
.badge-cyan { background: rgba(6,182,212,0.15); color: var(--accent-cyan); }
.badge-green { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.badge-orange { background: rgba(249,115,22,0.15); color: var(--accent-orange); }
.badge-red { background: rgba(239,68,68,0.15); color: #ef4444; }

/* Audio player */
.audio-player {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex; align-items: center; gap: 1rem;
}
.audio-player audio { flex: 1; height: 36px; }
audio { accent-color: var(--accent-purple); }

/* Toast notifications */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  z-index: 9999;
}
.toast {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}
.toast-success { border-left: 3px solid var(--accent-green); }
.toast-error { border-left: 3px solid #ef4444; }
.toast-info { border-left: 3px solid var(--accent-cyan); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-title { font-size: 1.1rem; font-weight: 600; }

/* Table */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead { background: var(--bg-card); }
th { padding: 0.75rem 1rem; text-align: left; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
td { padding: 0.75rem 1rem; border-top: 1px solid var(--border); color: var(--text-primary); }
tr:hover td { background: var(--bg-card); }

/* Stat card */
.stat-card { text-align: center; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; margin-bottom: 0.25rem; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

/* Progress bar */
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan)); border-radius: 3px; transition: width 0.5s ease; }

/* Avatar */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 1rem;
  overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.5rem; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent-purple);
  background: rgba(168,85,247,0.05);
  color: var(--text-secondary);
}
.upload-zone svg { margin: 0 auto 0.75rem; opacity: 0.5; }

/* Recording indicator */
.recording-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: pulse 1s ease infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.8); } }

/* Copy button */
.copy-btn {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.copy-btn:hover { color: var(--accent-cyan); border-color: var(--accent-cyan); }

/* Tabs */
.tabs { display: flex; gap: 0.25rem; background: var(--bg-card); border-radius: var(--radius-md); padding: 0.25rem; }
.tab-btn {
  flex: 1; padding: 0.5rem 1rem;
  border-radius: calc(var(--radius-md) - 4px);
  border: none; background: transparent;
  color: var(--text-muted); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.tab-btn.active { background: var(--accent-purple); color: #fff; }
.tab-btn:hover:not(.active) { color: var(--text-primary); }
