/**
 * voice-input.css - 语音输入 UI 样式
 *
 * 按需加载（非 AppAsset 全局），通过 extCss block 注入。
 * 依赖 Bootstrap 5 基础样式。
 */

/* ===== 录音控制区 ===== */
.vi-control {
    text-align: center;
    padding: 20px 0;
}

.vi-control.vi-control-compact {
    padding: 2px 0;
}

.vi-canvas-wrap {
    position: relative;
    margin: 0 auto 16px;
    max-width: 500px;
}

.vi-canvas-compact {
    margin: 0;
    flex: 1;
    max-width: 300px;
}

.vi-canvas {
    width: 100%;
    height: 80px;
    border-radius: 6px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.vi-canvas-compact .vi-canvas {
    height: 32px;
}

.vi-control-compact .vi-timer {
    font-size: 16px;
    margin-bottom: 0;
    min-width: 50px;
}

.vi-timer {
    font-size: 28px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #333;
    margin-bottom: 16px;
    letter-spacing: 1px;
}

.vi-timer.recording {
    color: #FF0000;
}

/* 录音按钮组 */
.vi-btn-group {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.vi-btn-group-inline {
    display: flex;
    gap: 8px;
}

.vi-btn-record {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #FF0000;
    background: #fff;
    color: #FF0000;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vi-btn-record:hover {
    background: #fff5f5;
}

.vi-btn-record.recording {
    background: #FF0000;
    color: #fff;
    animation: vi-pulse 1.5s ease-in-out infinite;
}

.vi-btn-record:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    animation: none;
}

@keyframes vi-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(237, 64, 20, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(237, 64, 20, 0); }
}

/* ===== 状态提示 ===== */
.vi-control-compact .vi-status {
    padding: 2px 0;
    min-height: 20px;
    font-size: 12px;
}

.vi-status {
    text-align: center;
    padding: 8px 0;
    font-size: 14px;
    color: #888;
    min-height: 36px;
}

.vi-status.error {
    color: #FF0000;
}

.vi-status.success {
    color: #00a256;
}

.vi-status .fa-spinner {
    margin-right: 6px;
}

/* ===== 识别结果区 ===== */
.vi-result-area {
    min-height: 80px;
}

.vi-richtext {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    min-height: 300px;
    max-height: 60vh;
    overflow-y: auto;
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    padding: 12px;
    outline: none;
}

.vi-richtext:focus {
    border-color: #0087F7;
    box-shadow: 0 0 0 2px rgba(0, 135, 247, 0.15);
}

.vi-richtext.empty:empty::before {
    content: attr(data-placeholder);
    color: #bbb;
    font-style: italic;
    pointer-events: none;
}

.vi-result-actions {
    display: flex;
    gap: 8px;
}

/* ===== 历史记录 ===== */
.vi-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.vi-history-body {
    max-height: 70vh;
    overflow-y: auto;
}

.vi-history-item {
    display: flex;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.vi-history-item:last-child {
    border-bottom: none;
}

.vi-history-meta {
    flex-shrink: 0;
    font-size: 12px;
    color: #999;
    min-width: 50px;
}

.vi-history-text {
    flex: 1;
    font-size: 14px;
    color: #333;
    line-height: 1.6;
    word-break: break-all;
}

.vi-history-actions {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
}

.vi-history-actions .btn {
    padding: 2px 6px;
    font-size: 12px;
    line-height: 1;
}

.vi-history-more {
    padding: 8px 0;
}

/* ===== 服务状态 ===== */
.vi-config-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
}

.vi-config-status.configured {
    background: #f0fff4;
    color: #00a256;
    border: 1px solid #b7eb8f;
}

.vi-config-status.not-configured {
    background: #fff7e6;
    color: #d48806;
    border: 1px solid #ffe58f;
}

.vi-config-status.checking {
    background: #f0f5ff;
    color: #1890ff;
    border: 1px solid #91caff;
}

/* ===== 使用说明 ===== */
.vi-tips dt {
    font-weight: 600;
    margin-top: 8px;
    color: #555;
}

.vi-tips dd {
    margin-left: 0;
    margin-bottom: 4px;
    color: #888;
    font-size: 13px;
}

/* ===== 富文本工具栏 ===== */
.vi-toolbar {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.vi-toolbar .vi-tb-btn {
    width: 30px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: none;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.vi-toolbar .vi-tb-btn:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.vi-toolbar .vi-tb-btn.active {
    background: #dee2e6;
    border-color: #ced4da;
    color: #0087F7;
}

.vi-toolbar .vi-tb-sep {
    width: 1px;
    height: 20px;
    background: #dee2e6;
    margin: 4px 4px;
    align-self: center;
}

.vi-toolbar + .vi-richtext {
    border-radius: 0 0 6px 6px;
}
