/* ======================================================================
 *  音频类工具公共样式 /audio-common.css
 *  供 video-to-mp3 / audio-trim / audio-merge / audio-convert /
 *      audio-pitch / audio-record / speech-to-text 复用
 *  依赖 home.css 全局变量 + calc-common.css + crypto-common.css，支持黑夜模式。
 * ====================================================================== */

/* ---------- 拖拽上传区 ---------- */
.au-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 132px;
    padding: 20px 16px;
    border: 2px dashed var(--c-border);
    border-radius: 16px;
    background: var(--c-surface-soft);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease;
}
.au-drop:hover,
.au-drop.is-over { border-color: var(--c-primary); background: rgba(0, 150, 220, 0.07); }
.au-drop-emoji { font-size: 30px; line-height: 1; opacity: 0.85; }
.au-drop-title { font-size: 13.5px; font-weight: 800; color: var(--c-text); }
.au-drop-sub { font-size: 11.5px; color: var(--c-text-muted); line-height: 1.7; }
.au-drop.has-file { border-style: solid; border-color: rgba(0, 150, 220, 0.45); }
.au-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- 波形 ---------- */
.au-wave {
    position: relative;
    margin: 4px 0 10px;
    padding: 8px;
    border: 1px solid var(--c-border);
    border-radius: 14px;
    background: var(--c-surface-soft);
}
.au-wave canvas {
    display: block;
    width: 100%;
    height: 132px;
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
}
.au-wave.is-empty canvas { cursor: default; }
.au-wave-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--c-text-muted);
}
.au-wave-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: -1px;
}

/* ---------- 播放器 ---------- */
.au-player { width: 100%; margin: 6px 0 10px; }
.au-player audio { width: 100%; height: 42px; }

/* ---------- 时间 / 数值行 ---------- */
.au-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.au-time {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text);
}
.au-slider {
    flex: 1 1 160px;
    min-width: 140px;
    accent-color: var(--c-primary);
    height: 26px;
}
.au-num {
    width: 96px;
    height: 38px;
    padding: 0 10px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--c-text);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    outline: none;
}
.au-num:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }

/* ---------- 文件列表 ---------- */
.au-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 10px; }
.au-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    background: var(--c-surface-soft);
}
.au-item.is-active { border-color: rgba(0, 150, 220, 0.5); background: rgba(0, 150, 220, 0.07); }
.au-item-idx {
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: rgba(0, 150, 220, 0.14);
    color: #0a7fc0;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}
.au-item-main { flex: 1 1 auto; min-width: 0; }
.au-item-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.au-item-meta { font-size: 11px; color: var(--c-text-muted); margin-top: 2px; }
.au-item-act { display: flex; gap: 4px; flex: none; }
.au-icon-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--c-border);
    border-radius: 9px;
    background: var(--c-bg-card);
    color: var(--c-text-sub);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.14s ease;
}
.au-icon-btn:hover:not([disabled]) { border-color: var(--c-primary); color: var(--c-primary); }
.au-icon-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ---------- 电平表 / 录音指示 ---------- */
.au-meter {
    height: 12px;
    border-radius: 99px;
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    overflow: hidden;
    margin: 8px 0 6px;
}
.au-meter-fill {
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: linear-gradient(90deg, #34c759, #ffd60a 70%, #e0447c);
    transition: width 0.08s linear;
}
.au-rec {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 800;
    color: var(--c-text-sub);
}
.au-rec i {
    width: 9px;
    height: 9px;
    border-radius: 99px;
    background: #e0447c;
    display: inline-block;
}
.au-rec.is-on i { animation: auPulse 1s infinite; }
@keyframes auPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.8); }
}
.au-clock {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 24px;
    font-weight: 800;
    color: var(--c-text);
    letter-spacing: 0.02em;
}

/* ---------- 识别结果区 ---------- */
.au-transcript {
    min-height: 150px;
    max-height: 320px;
    overflow-y: auto;
    padding: 12px 14px;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    background: var(--c-surface-soft);
    font-size: 14px;
    line-height: 1.9;
    color: var(--c-text);
    white-space: pre-wrap;
    word-break: break-word;
}
.au-transcript .interim { color: var(--c-text-muted); }
.au-transcript .au-ph { color: var(--c-text-muted); font-size: 13px; }

/* ---------- 小标签 ---------- */
.au-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.au-chip {
    padding: 3px 10px;
    border-radius: 99px;
    border: 1px solid var(--c-border);
    background: var(--c-bg-card);
    font-size: 11px;
    font-weight: 700;
    color: var(--c-text-sub);
}
.au-chip.is-on { border-color: rgba(0, 150, 220, 0.5); background: rgba(0, 150, 220, 0.1); color: #0a7fc0; }

/* ---------- 编码候选 ---------- */
.au-cand {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0 10px;
}
.au-cand-item {
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    background: var(--c-surface-soft);
    cursor: pointer;
    transition: border-color 0.14s ease, background 0.14s ease;
}
.au-cand-item:hover { border-color: var(--c-primary); }
.au-cand-item.is-on { border-color: rgba(0, 150, 220, 0.5); background: rgba(0, 150, 220, 0.08); }
.au-cand-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12.5px;
    font-weight: 800;
    color: var(--c-text);
}
.au-cand-head span { font-size: 11px; font-weight: 700; color: var(--c-text-muted); }
.au-cand-body {
    margin-top: 6px;
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--c-text-sub);
    word-break: break-all;
    max-height: 62px;
    overflow: hidden;
}
.au-cand-body .bad { color: #e0447c; font-weight: 700; }

/* ---------- 状态行 ---------- */
.au-status {
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--c-text-sub);
    margin-top: 8px;
}
.au-status.is-busy { color: var(--c-primary); font-weight: 700; }
.au-status.is-ok { color: #1f9d43; font-weight: 700; }
.au-status.is-bad { color: #e0447c; font-weight: 700; }

/* ---------- 响应式 ---------- */
@media (max-width: 620px) {
    .au-wave canvas { height: 108px; }
    .au-num { width: 78px; }
    .au-item { flex-wrap: wrap; }
    .au-item-main { flex: 1 1 100%; }
}

/* ---------- 黑夜模式 ---------- */
[data-theme="dark"] .au-drop,
[data-theme="dark"] .au-wave,
[data-theme="dark"] .au-item,
[data-theme="dark"] .au-num,
[data-theme="dark"] .au-meter,
[data-theme="dark"] .au-transcript,
[data-theme="dark"] .au-cand-item { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .au-drop:hover,
[data-theme="dark"] .au-drop.is-over { background: rgba(0, 150, 220, 0.14); }
[data-theme="dark"] .au-item.is-active,
[data-theme="dark"] .au-cand-item.is-on { background: rgba(0, 150, 220, 0.14); }
[data-theme="dark"] .au-icon-btn { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .au-item-idx { background: rgba(0, 150, 220, 0.22); color: #58bdf0; }
[data-theme="dark"] .au-chip.is-on { background: rgba(0, 150, 220, 0.18); color: #58bdf0; }
[data-theme="dark"] .au-status.is-ok { color: #4ede78; }
[data-theme="dark"] .au-status.is-bad { color: #f87171; }
[data-theme="dark"] .au-cand-body .bad { color: #f87171; }
