/* 微课教学平台 — 组件库 (优化版) */
/* 对齐 Ant Design 5.x 精炼感，增强交互细节与动画层次 */

/* ══════════════════════════════════════
   按钮系统
══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 34px;
  padding: 5px 16px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  line-height: 1.5715;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
  user-select: none;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

/* 点击涟漪感 */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition-fast);
}
.btn:active:not(:disabled)::after {
  background: rgba(255,255,255,0.15);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* 主按钮 */
.btn-primary {
  background: var(--ant-primary);
  color: #fff;
  border-color: var(--ant-primary);
  box-shadow: 0 2px 0 rgba(37,99,235,0.15), inset 0 1px 0 rgba(255,255,255,0.12);
}
.btn-primary:hover:not(:disabled) {
  background: var(--ant-primary-h);
  border-color: var(--ant-primary-h);
  box-shadow: 0 4px 12px rgba(37,99,235,0.30);
  color: #fff;
}

/* 描边按钮 */
.btn-outline {
  background: #fff;
  border-color: var(--border);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.btn-outline:hover:not(:disabled) {
  color: var(--ant-primary);
  border-color: var(--ant-primary);
  background: var(--primary-light);
}

/* 幽灵按钮 */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
}
.btn-ghost:hover:not(:disabled) {
  color: var(--interactive);
  background: var(--primary-glow);
}

/* 危险按钮 */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 2px 0 rgba(220,38,38,0.15);
}
.btn-danger:hover:not(:disabled) {
  background: #EF4444;
  border-color: #EF4444;
  box-shadow: 0 4px 12px rgba(220,38,38,0.28);
  color: #fff;
}

/* 成功按钮 */
.btn-success {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 0 rgba(22,163,74,0.15);
}
.btn-success:hover:not(:disabled) {
  background: #15803D;
  border-color: #15803D;
  box-shadow: 0 4px 12px rgba(22,163,74,0.28);
  color: #fff;
}

/* 尺寸 */
.btn-sm {
  min-height: 26px;
  padding: 1px 10px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}
.btn-lg {
  min-height: 42px;
  padding: 8px 24px;
  font-size: 15px;
}
.btn-block {
  width: 100%;
  display: flex;
}

/* ══════════════════════════════════════
   表单控件
══════════════════════════════════════ */
.form-group {
  margin-bottom: var(--space-md);
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.5;
}
.form-group label .required {
  color: var(--danger);
  margin-left: 2px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 34px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5715;
  color: var(--text-primary);
  background: #fff;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}
.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--ant-primary-l);
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--ant-primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: #fff;
}
.textarea {
  min-height: 96px;
  resize: vertical;
  padding-top: 8px;
  line-height: 1.65;
}

/* 选项构建器 */
.option-builder label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}
.option-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.option-row { display: flex; align-items: center; gap: 8px; }
.option-row-label {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.option-row .input { flex: 1; min-width: 0; }
.option-builder-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ══════════════════════════════════════
   Tab 切换
══════════════════════════════════════ */
.tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-md);
  padding: var(--space-xs) 0;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 450;
  line-height: 1.5715;
  color: var(--text-secondary);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
  user-select: none;
}
.tab:hover:not(.active) {
  color: var(--ant-primary);
  border-color: var(--ant-primary);
  background: var(--primary-light);
}
.tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.tab.active {
  background: var(--ant-primary);
  border-color: var(--ant-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37,99,235,0.28);
  transform: translateY(-1px);
}
.tab.active:hover {
  background: var(--ant-primary-h);
  border-color: var(--ant-primary-h);
  color: #fff;
}
.tab .tab-icon { display: inline-flex; font-size: 16px; line-height: 1; }

/* ══════════════════════════════════════
   卡片
══════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border-light);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.card:hover {
  box-shadow: var(--shadow-card-hover);
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 var(--space-sm);
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: -4px 0 var(--space-sm);
}

/* ══════════════════════════════════════
   表格
══════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th,
.table td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}
.table th {
  background: var(--bg-subtle);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.table tbody tr:hover td {
  background: #F8FAFF;
}
.table tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════
   模态框
══════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
  backdrop-filter: blur(2px);
  animation: backdropIn var(--transition-base) ease;
}
@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border-light);
  animation: modalIn var(--transition-base) ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.modal-close {
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  color: var(--text-primary);
  background: var(--border-light);
}
.modal-body { padding: 24px; }

/* ══════════════════════════════════════
   Toast 通知
══════════════════════════════════════ */
.toast-host {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  color: #fff;
  opacity: 0;
  transform: translateX(16px) scale(0.96);
  transition: opacity var(--transition-base), transform var(--transition-base);
  max-width: 380px;
  box-shadow: var(--shadow-modal);
  font-size: 14px;
  font-weight: 500;
  pointer-events: auto;
  border: 1px solid rgba(255,255,255,0.15);
}
.toast-show {
  opacity: 1;
  transform: translateX(0) scale(1);
}
.toast-success { background: var(--accent); }
.toast-error   { background: var(--danger); }
.toast-warning { background: var(--warning); color: rgba(0,0,0,0.88); }
.toast-info    { background: var(--ant-primary); }

/* ══════════════════════════════════════
   分页
══════════════════════════════════════ */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  align-items: center;
}
.page-btn {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.page-btn:hover:not(.is-active) {
  color: var(--ant-primary);
  border-color: var(--ant-primary);
  background: var(--primary-light);
}
.page-btn.is-active {
  background: var(--ant-primary);
  color: #fff;
  border-color: var(--ant-primary);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(37,99,235,0.22);
}

/* ══════════════════════════════════════
   徽章 / 标签
══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  border-radius: var(--radius-full);
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}
.badge-success {
  background: #F0FDF4;
  color: #15803D;
  border-color: #BBF7D0;
}
.badge-danger {
  background: #FFF2F0;
  color: #C81E1E;
  border-color: #FECACA;
}
.badge-warning {
  background: #FFFBEB;
  color: #B45309;
  border-color: #FDE68A;
}
.badge-purple {
  background: #F5F3FF;
  color: #6D28D9;
  border-color: #DDD6FE;
}
.badge-gray {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-color: var(--border);
}

/* 难度标签 */
.diff-badge {
  display: inline-block;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  border-radius: var(--radius-sm);
}
.diff-1 { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }
.diff-3 { background: #FFFBEB; color: #B45309; border: 1px solid #FDE68A; }
.diff-5 { background: #FFF2F0; color: #C81E1E; border: 1px solid #FECACA; }

/* ══════════════════════════════════════
   空态
══════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  color: var(--text-muted);
  font-size: 14px;
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}
.empty-state-text {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ══════════════════════════════════════
   进度环
══════════════════════════════════════ */
.progress-ring-wrap {
  width: 120px;
  height: 120px;
  position: relative;
}
.progress-ring-wrap svg {
  transform: rotate(-90deg);
  filter: drop-shadow(0 2px 6px rgba(37,99,235,0.18));
}
.progress-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--ant-primary);
}

/* ══════════════════════════════════════
   工具类
══════════════════════════════════════ */
mark {
  background: #FEF08A;
  padding: 0 0.15em;
  border-radius: 2px;
}
.hidden { display: none !important; }

/* 分割线 */
.divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: var(--space-md) 0;
}

/* 统计数字 */
.stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* 加载态 */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--bg-subtle) 50%, var(--border-light) 75%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
