/* ====================================
   components.css: 复杂定制组件 (upload, voice-trainer, alert variants)
   ==================================== */

/* ===== Voice upload area ===== */
.voice-trainer {
  background: var(--color-bg-soft);
  border: 1px solid var(--color-brand-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: var(--s-3);
}
.voice-trainer > summary {
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center;
  font-weight: 600; font-size: 13px;
  user-select: none;
}
.voice-trainer > summary::-webkit-details-marker { display: none; }
.voice-trainer > summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--color-text-secondary);
  transition: transform .2s;
}
.voice-trainer[open] > summary { background: var(--color-brand-100); }
.voice-trainer[open] > summary::after { transform: rotate(180deg); }
.voice-trainer__body {
  padding: var(--s-4);
  border-top: 1px solid var(--color-brand-200);
  background: var(--color-bg-card);
  display: flex; flex-direction: column;
  gap: var(--s-3);
}
.voice-trainer__step {
  display: flex; gap: var(--s-3); align-items: flex-start;
}
.voice-trainer__num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--color-brand-500);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}

/* ===== Final step CTA bar ===== */
.cta-final {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: var(--s-3);
  border-top: 1px solid rgba(255,255,255,.2);
  flex-wrap: wrap;
  gap: var(--s-3);
}

/* ===== Status pill (for model-status / loading) ===== */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600;
}
.status-pill__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.status-pill--ok .status-pill__dot { background: var(--color-success); }
.status-pill--loading .status-pill__dot { background: var(--color-warning); animation: pulse 1.4s infinite; }
.status-pill--off .status-pill__dot { background: var(--color-neutral-300); }
.status-pill--off { opacity: 0.6; }
.status-pill--loading { color: var(--color-warning); border-color: var(--color-warning); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ===== Spinner (loading state) ===== */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--color-brand-100);
  border-top-color: var(--color-brand-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast (瞬时消息) — v5.0.184: 统一浅色卡片 + 语义图标（替代 v5.0.74 满色胶囊）===== */
:root, [data-theme="light"] { --toast-bg: rgba(255,255,255,.92); --toast-border: rgba(0,0,0,.08); }
[data-theme="dark"]        { --toast-bg: rgba(26,26,30,.92); --toast-border: rgba(255,255,255,.14); }
.toast {
  position: fixed;
  top: 20px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 16px 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-text);
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: toastIn .3s ease;
}
.toast__icon { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.toast--success .toast__icon { color: var(--color-success); }
.toast--warning .toast__icon { color: var(--color-warning); }
.toast--danger  .toast__icon { color: var(--color-danger); }
.toast--hide { opacity: 0; transform: translate(-50%, -8px); transition: opacity .3s, transform .3s; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ============ v5.0.161: 媒体加载遮罩 ============
   与主 SPA 的 styles/components.css 里同名类保持一致（两套是独立环境，无法共享）。
   视频直连签名 URL 后加载期没有 JS 回调，靠媒体事件驱动这层遮罩补反馈。 */
.media-loading {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  background: rgba(0, 0, 0, .55);
  color: #fff; font-size: 12px; line-height: 1.5;
  pointer-events: none;
}
/* 必须显式写：display:flex 会盖掉 [hidden] 默认的 display:none */
.media-loading[hidden] { display: none; }
.media-loading .spinner { width: 20px; height: 20px; border-width: 2px; margin: 0; }
