/* pro-recording.css — volume controls + recording UI */
/* 音量控制樣式 - 增強設計 */
.volume-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(var(--overlay-rgb), 0.05);
    border-radius: var(--radius-md);
    border: 1px solid rgba(var(--overlay-rgb), 0.1);
}

.volume-btn {
    background: var(--color-border-hover);
    border: none;
    color: var(--color-text-primary);
    font-size: 16px;
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast) ease;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.volume-btn:hover {
    background: var(--color-border-hover);
}

.volume-btn:active {
    transform: translateY(0);
}

.volume-slider-container {
    flex: 1;
    max-width: 100px;
    position: relative;
}

.volume-slider {
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--color-bg-tertiary) 0%, var(--color-bg-secondary) 100%);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: inset 0 2px 4px rgba(var(--shadow-rgb), 0.3);
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--slider-thumb-bg);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-normal) cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow:
        0 2px 8px rgba(var(--shadow-rgb), 0.3),
        0 0 0 2px var(--slider-thumb-border);
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow:
        0 4px 12px rgba(var(--shadow-rgb), 0.4),
        0 0 0 3px var(--slider-thumb-border);
}

.volume-slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--slider-thumb-bg);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--slider-thumb-border);
    transition: all var(--transition-normal) cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 2px 8px rgba(var(--shadow-rgb), 0.3);
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    border-color: var(--color-brand-dark);
    box-shadow: 
        0 4px 12px rgba(var(--shadow-rgb), 0.4),
        inset 0 1px 0 rgba(var(--overlay-rgb), 0.9);
}

/* 音量數值顯示 */
.volume-value {
    font-size: 12px;
    color: var(--color-text-secondary);
    font-weight: 500;
    min-width: 30px;
    text-align: right;
}

/* 翻譯預留行樣式 - 流暢顯示優化 */
.pending-translation {
    opacity: 0.8 !important;
    font-style: normal !important;
    border-left: 3px solid var(--color-purple) !important;
    background-color: rgba(var(--purple-rgb), 0.05) !important;
    margin-left: 20px !important;
    padding-left: 10px !important;
    border-radius: 0 4px 4px 0;
    transition: all var(--transition-normal) ease;
    text-align: left !important;
}

.completed-translation {
    opacity: 1 !important;
    font-style: normal !important;
    border-left: 3px solid var(--color-purple) !important;
    background-color: rgba(var(--purple-rgb), 0.08) !important;
    margin-left: 20px !important;
    padding-left: 10px !important;
    border-radius: 0 4px 4px 0;
    text-align: left !important;
}

/* 翻譯中三個點循環動畫 */
.translation-dots::after {
    content: '';
    animation: translationDots 1.5s infinite;
}

@keyframes translationDots {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
    100% { content: '.'; }
}

/* 翻譯完成的淡入動畫 */
@keyframes translationComplete {
    from {
        opacity: 0.6;
        background-color: rgba(var(--purple-rgb), 0.05);
    }
    to {
        opacity: 1;
        background-color: rgba(var(--purple-rgb), 0.08);
    }
}

/* 轉錄結果行的改進樣式 */
.transcription-result-pair {
    margin-bottom: 8px;
}

.transcription-original {
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 2px;
}

.transcription-translation {
    color: var(--color-purple);
    font-style: italic;
    margin-left: 20px;
    padding-left: 10px;
    border-left: 3px solid var(--color-purple);
    background-color: rgba(var(--purple-rgb), 0.08);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

/* ===== 分頁式 UI 樣式 ===== */

/* 分頁導航 */
.tab-navigation {
    display: flex;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-xs);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--color-border);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: 44px;  /* 確保可觸控 */
}

.tab-btn:hover {
    background: rgba(var(--overlay-rgb), 0.1);
    color: var(--color-text-primary);
}

.tab-btn.active {
    background: var(--surface-active-bg);
    color: var(--surface-active-text);
    box-shadow: var(--surface-active-shadow);
}

/* 分頁內容 */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

/* (fadeIn keyframes — consolidated above) */

/* Seeking 指示器動畫 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.seeking-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(var(--overlay-rgb), 0.3);
    border-top: 2px solid var(--color-brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 共用控制區域 */
.shared-controls {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

/* 設定群組標籤 */
.section-group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    padding-bottom: 8px;
}

/* 面板底部資訊 */
.panel-footer-info {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.usage-mini {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.usage-mini .lucide {
    width: 14px;
    height: 14px;
}

/* ===== 錄音功能樣式 ===== */

/* 設備選擇器 */
.device-selector {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

/* 在折疊面板內的設備選擇器 */
.section-content .device-selector {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: var(--space-md);
}

.device-selector label {
    display: block;
    margin-bottom: var(--space-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.device-selector select {
    width: 100%;
    height: 36px;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    padding: var(--space-sm) var(--space-md);
    color: var(--color-text-primary);
    font-size: 14px;
    margin-bottom: var(--space-md);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.device-selector select:focus {
    outline: none;
    border-color: var(--color-brand);
}

.device-selector select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 錄音控制區域 */
.recording-controls {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: var(--space-md) 0;
    margin-bottom: 0;
}

/* 錄音按鈕底部固定 */
.left-panel {
    display: flex;
    flex-direction: column;
}

.left-panel .recording-controls {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--color-bg-secondary);
    padding: var(--space-md) 0 0 0;
    margin-top: auto;
}

/* 固定底部漸變遮罩效果 */
.left-panel .recording-controls::before {
    content: '';
    position: absolute;
    top: -24px;
    left: 0;
    right: 0;
    height: 24px;
    background: linear-gradient(to bottom, transparent, var(--color-bg-secondary));
    pointer-events: none;
}

/* 錄音狀態區（簡潔統一風格） */
.recording-status-unified {
    margin-bottom: 12px;
    padding: 10px 14px;
    background: rgba(var(--overlay-rgb), 0.03);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
}

.recording-status-unified .status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.recording-status-unified .status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;  /* 防止被壓縮 */
    /* 覆蓋通用 .status-indicator 樣式 */
    width: auto;
    height: auto;
    background: none;
    border-radius: 0;
    margin-right: 0;
}

/* 狀態圓點 - 取代 emoji */
.recording-status-unified .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-text-secondary);  /* 灰色（閒置狀態） */
    flex-shrink: 0;
}

.recording-status-unified .status-label {
    font-weight: 500;
    font-size: 13px;
    color: var(--color-text-secondary);
    overflow: visible;
    width: auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.recording-status-unified .recording-time {
    font-size: 13px;
    color: var(--color-text-secondary);
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* 音量進度條 — 未錄音時隱藏 */
.recording-status-unified .volume-row {
    display: none;
    align-items: center;
    gap: 10px;
}

.recording-status-unified.recording .volume-row {
    display: flex;
}

.recording-status-unified .volume-bars {
    flex: 1;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
    display: flex;
    gap: 2px;
}

.recording-status-unified .volume-bar {
    flex: 1;
    background: var(--color-border);
    border-radius: 2px;
    transition: background-color 0.1s ease;
}

.recording-status-unified .volume-bar.active {
    background: var(--color-success);
}

.recording-status-unified .volume-bar.active:nth-child(n+6) {
    background: var(--color-warning);
}

.recording-status-unified .volume-bar.active:nth-child(8) {
    background: var(--color-error);
}

.recording-status-unified .volume-level {
    font-size: 11px;
    color: var(--color-text-secondary);
    min-width: 32px;
    text-align: right;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    background: none;
    height: auto;
    width: auto;
    box-shadow: none;
}

/* 錄音中狀態 */
.recording-status-unified.recording .status-dot {
    background: var(--color-error);
    animation: pulse-dot 1.2s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(var(--error-rgb), 0.6);
}

.recording-status-unified.recording .status-label {
    color: var(--color-error);
    font-weight: 600;
}

.recording-status-unified.recording .recording-time {
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 6px rgba(var(--error-rgb), 0.6); }
    50% { opacity: 0.7; transform: scale(1.3); box-shadow: 0 0 12px rgba(var(--error-rgb), 0.8); }
}

/* 錄音中整體區域微光呼吸 */
.recording-controls:has(.recording-status-unified.recording) {
    border-top: 1px solid rgba(var(--error-rgb), 0.15);
}

/* 錄音按鈕 */
.recording-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 0;
}

.record-btn {
    flex: 2;
    background: var(--btn-cta-bg);
    border: var(--btn-cta-border);
    color: var(--btn-cta-text);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-fast);
    min-height: 44px;
    box-shadow: var(--btn-cta-shadow);
    border-radius: var(--radius-sm);
}

.record-btn:hover {
    background: var(--btn-cta-hover-bg);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(var(--brand-rgb), 0.3);
}

.record-btn:disabled {
    background: var(--color-border-hover);
    color: var(--color-text-secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 錄音中 → 暫停按鈕：amber/warning（可逆動作） */
.record-btn.recording {
    background: var(--color-warning);
    box-shadow: 0 2px 8px rgba(var(--warning-rgb), 0.3);
    flex: 1;
}

.record-btn.recording:hover {
    background: #E68600;
    box-shadow: 0 4px 16px rgba(var(--warning-rgb), 0.4);
}

/* 暫停中 → 繼續按鈕：brand blue（恢復動作） */
.record-btn.paused {
    background: var(--btn-cta-bg);
    box-shadow: var(--btn-cta-shadow);
    flex: 1;
}

.record-btn.paused:hover {
    background: var(--btn-cta-hover-bg);
}

/* 停止按鈕：錄音中顯示時，紅色語意但內斂 */
#stopRecordBtn {
    flex: 1;
    background: rgba(var(--error-rgb), 0.12);
    color: var(--color-error);
    border: 1px solid rgba(var(--error-rgb), 0.25);
}

#stopRecordBtn:hover {
    background: rgba(var(--error-rgb), 0.2);
    border-color: var(--color-error);
}

/* 音量監測（舊樣式已整合到 .recording-status-unified） */

