/* VoiceTube LiveTranslate Enterprise - Apple/Tesla 風格樣式 */

/* 設計系統變量 */
:root {
    /* 間距系統 (基於 8px) */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-xxl: 48px;
    
    /* 顏色系統 */
    --color-bg-primary: #1C1C1E;
    --color-bg-secondary: #2C2C2E;
    --color-bg-tertiary: #3A3A3C;
    --color-border: #3A3A3C;
    --color-border-hover: #48484A;
    --color-text-primary: #FFFFFF;
    --color-text-secondary: #8E8E93;
    --color-brand: #007AFF;
    --color-brand-dark: #0051D0;
    --color-success: #34C759;
    --color-warning: #FF9500;
    --color-error: #FF3B30;
    
    /* 陰影系統 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    
    /* 動畫時長 */
    --transition-fast: 0.2s;
    --transition-normal: 0.3s;
    --transition-slow: 0.5s;
    
    /* 圓角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* 基礎樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* HHTD25 優化: 開發模式切換開關樣式 */
.dev-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    transition: background-color 0.2s;
}

.dev-mode-toggle:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.toggle-label {
    font-size: 14px;
    color: var(--color-text-primary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #48484a;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--color-brand);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* HHTD25 優化: 緊急重連按鈕 */
.reconnect-btn {
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 12px;
    background-color: var(--color-warning);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.reconnect-btn:hover {
    background-color: #e68900;
}

.reconnect-btn:active {
    transform: scale(0.95);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    overflow-x: hidden;
}

/* 頂部頭部 */
.header {
    background: linear-gradient(135deg, var(--color-bg-primary) 0%, var(--color-bg-secondary) 100%);
    padding: var(--space-md) 0;
    position: relative;
    z-index: 100;
}

.header-container {
    width: 100%;
    padding: 0 var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-brand) 0%, var(--color-success) 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.brand-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--color-brand) 0%, var(--color-success) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-subtitle {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin: 0;
    font-weight: 400;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;  /* 改為 flex-start 讓內容靠左，配合 margin-left: auto 推到右邊 */
    gap: 12px;  /* 減少間距避免擠壓 */
    flex: 1;
    min-height: 36px;  /* 改為最小高度，允許換行擴展 */
    padding: 4px 8px;  /* 增加垂直內邊距 */
    flex-wrap: nowrap;  /* 預設不換行 */
}

/* 場次快速切換器 */
.quick-session-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.2s;
    height: 36px;
}

.quick-session-switcher:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.session-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    line-height: 1.4;
}

.session-select {
    background: rgba(0, 0, 0, 0.2);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;  /* 增大字體方便閱讀 */
    max-width: 380px;  /* 限制最大寬度，以最長場次名稱為基準 */
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
    min-height: 24px;  /* 改為最小高度 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-select:hover {
    border-color: #007AFF;
    background: rgba(0, 122, 255, 0.1);
}

.session-select:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

/* 轉錄中的場次選擇器樣式（防誤觸視覺提示）*/
.session-select.transcribing {
    border-color: #FF9500;
    background: rgba(255, 149, 0, 0.1);
    position: relative;
}

.session-select.transcribing:hover {
    border-color: #FF3B30;
    background: rgba(255, 59, 48, 0.1);
    cursor: help;
}

.session-select.transcribing::after {
    content: '⚠️ 轉錄中';
    position: absolute;
    top: -24px;
    left: 0;
    font-size: 11px;
    color: #FF9500;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
}

.session-select.transcribing:hover::after {
    opacity: 1;
}

.switch-time {
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    transition: opacity 0.3s;
    white-space: nowrap;
}

/* 狀態列分區 */
.status-section {
    display: flex;
    align-items: center;
    height: 36px;
    line-height: 36px;
}

.core-section {
    margin-left: auto;  /* 推到右邊 */
    padding: 0 24px;  /* 左右對稱的內邊距 */
    flex: 0 0 auto;  /* 不伸縮，保持內容寬度 */
}

.status-separator {
    color: rgba(255, 255, 255, 0.2);
    font-size: 14px;
    margin: 0 16px;
    line-height: 36px;
    height: 36px;
    display: flex;
    align-items: center;
}

/* 系統狀態區 */
.system-section {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 0 16px;
    min-height: 36px;
}

.system-status,
.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    line-height: 1;
    height: 36px;
}

/* 狀態列內的 vocab-sync-status 特殊處理 - 覆蓋所有其他樣式 */
#syncStatusIndicator,
.header-actions #syncStatusIndicator,
.header-actions .system-section #syncStatusIndicator,
.header-actions .system-section .vocab-sync-status,
.header-actions .vocab-sync-status,
.header .header-actions .vocab-sync-status {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    font-size: 13px !important;
    line-height: 1 !important;
    height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    vertical-align: middle !important;
}

.status-label {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    font-size: 13px;
    display: inline-block;
    vertical-align: baseline;
    line-height: 36px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-value {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 13px;
    display: inline-block;
    vertical-align: baseline;
    line-height: 36px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 確保 sync-detail 也對齊 */
#syncStatusIndicator .sync-detail,
.vocab-sync-status .sync-detail {
    display: inline-flex !important;
    align-items: center !important;
    height: 36px !important;
    line-height: 1 !important;  /* 使用正常行高，讓 flexbox 處理對齊 */
    font-size: 13px !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap !important;  /* 防止換行 */
    overflow: visible !important;  /* 允許內容顯示 */
}

/* 同步狀態指示器 - 簡化版 */
.vocab-sync-status {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;  /* 不允許換行 */
    white-space: nowrap;  /* 內容不換行 */
}

.sync-detail {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    margin-left: 4px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    min-height: 36px;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    transition: all 0.3s;
}

.sync-dot.active {
    background: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
    animation: pulse 2s infinite;
}

.sync-dot.inactive {
    background: #FFA500;
    box-shadow: 0 0 8px rgba(255, 165, 0, 0.4);
}

.sync-dot.error {
    background: #FF4444;
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.4);
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.sync-text {
    font-size: 13px;
    font-weight: 500;
    color: #FFFFFF;
}

/* 移除重複的 .sync-detail 定義 */
/* .sync-detail - 已在上方定義 */
}

.user-profile {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    transition: all var(--transition-fast);
    height: 36px;
    margin-left: 16px;
}
.user-profile:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}
.user-profile-main {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    cursor: pointer;
    user-select: none;
    height: 36px;
}
.dropdown-arrow {
    margin-left: auto;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    transition: transform var(--transition-fast);
}
.user-profile.expanded .dropdown-arrow {
    transform: rotate(180deg);
}
.user-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: var(--color-bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 1000;
}
.user-profile.expanded .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-avatar {
    font-size: 18px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-brand) 0%, #5856D6 100%);
    border-radius: 8px;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
    line-height: 1.2;
}

.user-role {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 10px;
    color: var(--color-error);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.5);
    transform: translateY(-1px);
}

/* 下拉選單中的一般按鈕 */
.dropdown-menu-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: calc(100% - 24px);
    margin: 0 12px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--color-text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-menu-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-menu-btn .menu-text {
    flex: 1;
    text-align: left;
}

.dropdown-menu-btn .menu-icon {
    opacity: 0.5;
    font-size: 16px;
}

/* 下拉選單中的登出按鈕 */
.dropdown-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 24px);
    margin: 0 12px 12px 12px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 6px;
    color: var(--color-error);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.dropdown-logout-btn:hover {
    background: rgba(255, 59, 48, 0.1);
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

.logout-text {
    font-size: 14px;
}

.logout-icon {
    font-size: 16px;
    transition: transform 0.2s ease;
}

.logout-btn:hover .logout-icon {
    transform: translateX(2px);
}

/* 增強版本橫幅 - 已移除 */

/* Radio 按鈕樣式 */
.radio-label {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.radio-label:hover {
    background: var(--color-border);
}

.radio-label input[type="radio"] {
    margin-right: 6px;
}

.radio-label input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--color-brand);
}

/* 快速開始提示 - 已移除 */

/* 主要容器 */
.main-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    height: calc(100vh - 160px);  /* 固定高度，確保面板高度受限 */
    gap: var(--space-lg);
    padding: var(--space-lg);
}

/* 左右面板 */
.left-panel, .right-panel {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--color-border);
}

/* 左側面板特別設置 - 確保下拉選單能正常顯示 */
.left-panel {
    overflow: visible;
    position: relative;
}

/* 右側面板特別設置 - 使用 flexbox 讓內容自動擴展 */
.right-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden; /* 防止整個面板捲動 */
}

/* 結果操作按鈕區域 */
.result-actions {
    margin-top: var(--space-md);
    text-align: right;
    flex-shrink: 0; /* 防止按鈕區域被壓縮 */
}

.left-panel h3, .right-panel h3 {
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
}

/* 結果面板頭部 */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.results-header h3 {
    margin-bottom: 0;
}

/* 顯示控制區域 */
.display-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 彈出控制按鈕群組 */
.popup-controls {
    display: flex;
    gap: 8px;
    padding-left: 8px;
    border-left: 1px solid var(--color-border);
}

.popup-controls button {
    transition: all var(--transition-fast);
}

.popup-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

/* 顯示模式選擇器 */
.display-mode-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.display-mode-selector label {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.display-mode-select {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.display-mode-select:hover {
    border-color: var(--color-border-hover);
    background: #3A3A3C;
}

.display-mode-select:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

/* 字幕控制面板 */
.subtitle-controls {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subtitle-controls .control-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.subtitle-controls .control-group:last-child {
    margin-bottom: 0;
}

.subtitle-controls label {
    font-size: 14px;
    color: var(--color-text-secondary);
    min-width: 80px;
}

/* 滑桿樣式 */
.subtitle-controls .slider {
    flex: 1;
    max-width: 200px;  /* 限制最大寬度 */
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #48484A;  /* 更明顯的對比色 */
    border-radius: 3px;
    outline: none;
    transition: background 0.2s ease;
}

.subtitle-controls .slider:hover {
    background: #5A5A5C;  /* hover 時更亮 */
}

.subtitle-controls .slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--color-brand);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle-controls .slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--color-brand-dark);
}

.subtitle-controls .slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--color-brand);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle-controls .slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: var(--color-brand-dark);
}

/* 顏色選擇器 */
.subtitle-controls .color-picker {
    width: 60px;
    height: 32px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

/* 複選框樣式 */
.subtitle-controls .checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    cursor: pointer;
}

.subtitle-controls .checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

/* 語言模式選擇器 */
.language-mode-select {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    min-width: 150px;
}

.language-mode-select:hover {
    border-color: var(--color-border-hover);
}

.language-mode-select:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

/* 預設樣式按鈕 */
.preset-buttons {
    display: flex;
    gap: 8px;
}

.preset-btn {
    padding: 4px 12px;
    font-size: 13px;
}

/* 字幕模式下的特殊樣式 */
.subtitle-mode {
    background: #000000;
    padding: var(--space-xl);
}

.subtitle-mode div {
    font-size: var(--subtitle-font-size, 32px) !important;
    line-height: 1.4;
}

.subtitle-mode span {
    color: var(--subtitle-text-color, #ffffff) !important;
    background-color: var(--subtitle-bg-color, rgba(0, 0, 0, 0.8));
    padding: 8px 16px;
    border-radius: 8px;
    display: inline-block;
}

.subtitle-mode .translation-line span {
    color: var(--subtitle-text-color, #ffffff) !important;
    opacity: 0.9;
}

.subtitle-mode .interim-line {
    opacity: 0.6;
}

/* 字幕滾動模式 */
.subtitle-mode.scroll-mode {
    position: relative;
    overflow: hidden;
    height: var(--subtitle-scroll-height, 300px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.subtitle-mode.scroll-mode > div {
    animation: subtitleSlideIn 0.5s ease-out;
}

@keyframes subtitleSlideIn {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes subtitleSlideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-50px);
        opacity: 0;
    }
}

.subtitle-mode.scroll-mode .subtitle-line-out {
    animation: subtitleSlideOut 0.3s ease-out forwards;
}

/* 小尺寸滑動條 */
.slider.small {
    height: 20px;
    padding: 0;
}

.slider.small::-webkit-slider-thumb {
    height: 16px;
    width: 16px;
}

.slider.small::-moz-range-thumb {
    height: 16px;
    width: 16px;
}

/* 可折疊面板樣式 - 繼承統一樣式系統 */
.collapsible-section {
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-bg-secondary);
}

.section-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--color-bg-secondary);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.section-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.section-header.active {
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
}

.section-icon {
    margin-right: 8px;
    font-size: 12px;
    transition: transform 0.3s ease;
    color: var(--color-text-secondary);
    width: 12px;
    display: inline-block;
}

.section-header.active .section-icon {
    transform: rotate(0deg);
}

.section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding: 0 16px;
}

.section-content.show {
    max-height: 800px;
    padding: 16px;
    transition: max-height 0.3s ease-in, padding 0.3s ease-in;
}

.section-content > div {
    margin-bottom: 16px;
}

.section-content > div:last-child {
    margin-bottom: 0;
}

/* 音頻上傳區域 */
.upload-area {
    border: 2px dashed var(--color-border);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 20px;
}

.upload-area:hover, .upload-area.drag-over {
    border-color: var(--color-brand);
    background: rgba(0, 122, 255, 0.1);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.upload-area p {
    margin-bottom: 4px;
}

.upload-area strong {
    font-weight: 600;
}

/* 音頻播放控制 - 增強版設計 */
.audio-controls {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    display: none;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.audio-controls.active {
    display: block;
    animation: fadeInUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 音檔標題區域 */
.audio-title-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

/* 移除音檔按鈕 */
.remove-audio-btn {
    background: rgba(255, 59, 48, 0.15);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #FF3B30;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.remove-audio-btn:hover {
    background: rgba(255, 59, 48, 0.25);
    border-color: rgba(255, 59, 48, 0.5);
    transform: scale(1.1);
}

.remove-audio-btn:active {
    transform: scale(0.95);
}

.audio-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-brand) 0%, #5856D6 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.audio-title-info {
    flex: 1;
}

.audio-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.audio-subtitle {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin: 0;
}

/* 播放控制區域 */
.playback-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.play-btn {
    background: linear-gradient(135deg, var(--color-brand) 0%, var(--color-brand-dark) 100%);
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all var(--transition-normal) cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.play-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.play-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

.play-btn:hover::before {
    opacity: 1;
}

.play-btn:active {
    transform: scale(1.02);
}

.progress-container {
    flex: 1;
    margin: 0 16px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        transparent 50%, 
        rgba(255, 255, 255, 0.1) 100%);
    border-radius: 3px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-brand) 0%, #5856D6 100%);
    border-radius: 3px;
    width: 0%;
    transition: width 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    box-shadow: 0 0 8px rgba(0, 122, 255, 0.6);
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -6px;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 0 0 2px #007AFF;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.progress-bar:hover .progress-fill::after {
    opacity: 1;
}

.time-display {
    font-size: 13px;
    color: var(--color-text-secondary);
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.time-current {
    color: var(--color-brand);
    font-weight: 600;
}

/* 按鈕樣式 */
.btn {
    background: var(--color-brand);
    color: white;
    border: none;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--transition-fast) ease;
    margin-right: var(--space-sm);
    margin-bottom: var(--space-sm);
    min-height: 44px;  /* iOS/Android 建議最小觸控區域 */
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background: var(--color-brand-dark);
}

.btn:disabled {
    background: var(--color-border);
    cursor: not-allowed;
    transform: none;
}

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

.btn.secondary:hover {
    background: #5A5A5C; /* hover 狀態保持淺一點 */
}

/* 模型選擇器 */
.model-selector {
    margin: 20px 0;
}

.model-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.model-selector select {
    width: 100%;
    height: 36px;  /* 統一高度 */
    background: var(--color-bg-tertiary, #3A3A3C);
    color: var(--color-text-primary, #FFFFFF);
    border: 1px solid var(--color-border, #3A3A3C);
    border-radius: 4px;
    padding: 8px 12px;  /* 統一內距 */
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s;
}

.model-selector select:focus {
    outline: none;
    border-color: var(--color-accent, #0A84FF);
}

/* 錄音頁面的模型選擇器樣式 */
.model-selector-recording {
    padding: 0 0 16px 0;
    margin-bottom: 20px;
}

.model-selector-recording label {
    color: var(--color-brand);
    font-size: 14px;
    margin-bottom: 8px;
    display: block;
    font-weight: 600;
}

.model-selector-recording select {
    width: 100%;
    height: 36px;  /* 統一高度 */
    padding: 8px 12px;  /* 統一內距 */
    background: var(--color-bg-tertiary, #3A3A3C);
    border: 1px solid var(--color-border, #3A3A3C);
    font-size: 14px;
    color: var(--color-text-primary, #FFFFFF);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.model-selector-recording select:hover {
    border-color: var(--color-accent, #0A84FF);
}

.model-selector-recording select:focus {
    outline: none;
    border-color: var(--color-accent, #0A84FF);
}

/* 狀態指示器 */
.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: var(--space-sm);
    background: var(--color-error);
}

.status-indicator.ready {
    background: var(--color-success);
}

.status-indicator.processing {
    background: var(--color-warning);
    animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.error {
    background: var(--color-error);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 轉錄結果樣式 - 參考GUI版本 */
.result-area {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    flex: 1; /* 自動擴展填充剩餘空間 */
    min-height: 0; /* 重要：允許 flex 項目收縮到小於內容高度 */
    overflow-y: auto;
    color: var(--color-text-primary);
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.result-area::-webkit-scrollbar {
    width: 6px;
}

.result-area::-webkit-scrollbar-track {
    background: transparent;
}

.result-area::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.result-area::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-hover);
}

/* 轉錄結果項目 */
.result-item {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease-in-out;
    padding: 12px 16px;
    border-radius: 12px;
    border-left: 4px solid transparent;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.result-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
}

/* 中間結果 (灰色) - 類似GUI版本的interim results */
.result-item.interim {
    color: var(--color-text-secondary);
    border-left-color: var(--color-text-secondary);
    background: rgba(142, 142, 147, 0.1);
    opacity: 0.8;
}

.result-item.interim .result-meta {
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 500;
}

.result-item.interim::before {
    content: "🔘";
    margin-right: 8px;
    opacity: 0.8;
}

/* 最終結果 (藍色) - 類似GUI版本的final results */
.result-item.final {
    color: var(--color-text-primary);
    border-left-color: #007AFF;
    background: rgba(0, 122, 255, 0.1);
    font-weight: 600;
}

.result-item.final .result-meta {
    color: #5AC8FA;
    font-size: 12px;
    font-weight: 500;
}

.result-item.final::before {
    content: "✅";
    margin-right: 8px;
    font-size: 16px;
}

/* 翻譯結果 (紫色/灰色) - 類似GUI版本的translation results */
.result-item.translation {
    color: #B0B0B0;
    border-left-color: #AF52DE;
    background: rgba(175, 82, 222, 0.1);
    margin-left: 28px;
    font-style: italic;
}

.result-item.translation .result-meta {
    color: #AF52DE;
    font-size: 12px;
    font-weight: 500;
}

.result-item.translation::before {
    content: "🌐";
    margin-right: 8px;
    font-size: 16px;
}

/* 結果元信息樣式 */
.result-meta {
    font-size: 11px;
    margin-bottom: 6px;
    opacity: 0.8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 動畫效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Demo信息樣式 */
.demo-message {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 40px 20px;
    border: 2px dashed var(--color-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.demo-message p {
    margin: 8px 0;
    line-height: 1.5;
}

.demo-message strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

/* 響應式設計 */

/* 中等螢幕 (平板/小筆電) - 769px 到 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .header-actions {
        gap: 10px;  /* 進一步減少間距 */
        flex-wrap: wrap;  /* 允許換行 */
    }

    .status-label {
        max-width: 100px;  /* 進一步限制寬度 */
    }

    .status-value {
        max-width: 120px;
    }

    .session-select {
        font-size: 13px;
    }

    .main-container {
        gap: var(--space-md);
        padding: var(--space-md);
    }

    .result-area {
        font-size: 14px;
    }
}

/* 小螢幕 (手機/小平板) - 最大 768px */
@media (max-width: 768px) {
    .main-container {
        grid-template-columns: 1fr;
        height: auto;
        padding: var(--space-md);  /* 減少間距 */
        gap: var(--space-md);
    }

    .left-panel, .right-panel {
        margin-bottom: 20px;
    }

    .result-area {
        min-height: 300px; /* 改為最小高度，允許擴展 */
        padding: 16px;  /* 減少 padding */
        font-size: 15px;  /* 增大字體提升可讀性 */
    }

    .result-item {
        padding: 10px 12px;  /* 減少項目 padding */
    }
}

/* 載入動畫 */
@keyframes loading {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #3A3A3C;
    border-top: 2px solid #007AFF;
    border-radius: 50%;
    animation: loading 1s linear infinite;
    margin-right: 8px;
}

/* 成功/錯誤消息 */
.success-message {
    color: #34C759;
    font-weight: 600;
}

.error-message {
    color: var(--color-error);
    font-weight: 600;
}

/* 隱藏元素 */
.hidden {
    display: none;
}

/* 高亮效果 */
.highlight {
    background: rgba(0, 122, 255, 0.2);
    border-radius: 4px;
    padding: 2px 4px;
}

/* 處理時間指示器 - 已停用 */
/*
.transcription-timing {
    display: inline-flex;
    align-items: center;
    margin-left: 12px;
    font-size: 11px;
    font-family: 'SF Mono', Monaco, monospace;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(142, 142, 147, 0.1);
    color: var(--color-text-secondary);
    transition: all 0.2s ease;
}

.transcription-timing.fast {
    background: rgba(52, 199, 89, 0.1);
    color: #34C759;
}

.transcription-timing.medium {
    background: rgba(255, 159, 10, 0.1);
    color: #FF9F0A;
}

.transcription-timing.slow {
    background: rgba(255, 59, 48, 0.1);
    color: var(--color-error);
}

.transcription-timing::before {
    content: '⚡';
    margin-right: 4px;
    font-size: 10px;
}
*/

.transcription-item {
    display: flex;
    align-items: baseline;
    margin-bottom: 12px;
    padding: 12px 16px;
    background: rgba(58, 58, 60, 0.3);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.transcription-item:hover {
    background: rgba(58, 58, 60, 0.5);
}

.transcription-text {
    flex: 1;
    line-height: 1.5;
}

.transcription-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

/* ===== 詞庫管理樣式 ===== */

/* 詞庫管理區域 - 統一樣式 */
.vocabulary-section {
    margin-bottom: 16px;
    padding: 16px;
    background: var(--color-bg-secondary);  /* 統一背景色 */
    border: 1px solid var(--color-border);
    border-radius: 8px;  /* 統一圓角 */
}

.vocabulary-section label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.btn.small {
    padding: 8px 16px;
    font-size: 12px;
    margin: 0;
}

.vocab-status {
    display: flex;
    align-items: center;
    margin: 8px 0;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.vocab-indicator {
    margin-right: 8px;
    font-size: 16px;
}

.vocab-quick-stats {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

/* 模態對話框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    justify-content: center;
    align-items: center;
}

/* 巢狀對話框層級管理 */
.modal-overlay {
    display: flex;
    position: fixed;
    z-index: 2000; /* 高於主對話框 */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    pointer-events: auto; /* 確保可以接收點擊事件 */
}

.modal-dialog {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    padding: 20px;
    z-index: 2001; /* 確保對話框內容在最上層 */
    position: relative;
    pointer-events: auto; /* 確保內容可以接收點擊事件 */
}

/* 確保巢狀對話框的按鈕能正確接收點擊事件 */
.modal-overlay .modal-dialog .btn,
.modal-overlay .modal-dialog button {
    position: relative;
    z-index: 2002;
    pointer-events: auto;
}

.modal-content {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn var(--transition-normal) ease;
    max-height: 90vh;
    overflow-y: auto;
}

.vocabulary-modal {
    width: 90%;
    max-width: 1000px;
    min-height: 600px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 模態頭部 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 0 24px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: var(--color-text-primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--color-border);
    color: var(--color-text-primary);
}

/* 模態主體 */
.modal-body {
    padding: 0 24px 24px 24px;
}

/* 詞庫統計區域 */
.vocab-stats-section {
    margin-bottom: 24px;
}

.vocab-stats-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-text-primary);
}

.vocab-stats {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.stat-item {
    text-align: center;
    padding: 16px;
    background: var(--color-bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-brand);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.stats-loading {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 20px;
}

/* 詞庫選項卡 */
.vocab-tabs-section {
    margin-bottom: 24px;
}

.vocab-tabs-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-text-primary);
}

.vocab-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.vocab-tab {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.vocab-tab:hover {
    border-color: var(--color-brand);
    background: rgba(0, 122, 255, 0.1);
}

.vocab-tab.active {
    border-color: var(--color-brand);
    background: rgba(0, 122, 255, 0.2);
}

.tab-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text-primary);
}

.tab-description {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.tab-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-brand);
}

/* 詞庫工具欄 */
.vocab-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    gap: 16px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input {
    background: var(--color-border);
    border: 1px solid #48484A;
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--color-text-primary);
    font-size: 14px;
    font-family: inherit;
    width: 200px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-brand);
    background: var(--color-bg-secondary);
}

.search-input::placeholder {
    color: var(--color-text-secondary);
}

.category-filter {
    background: var(--color-border);
    border: 1px solid #48484A;
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--color-text-primary);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    min-width: 150px;
}

.category-filter:focus {
    outline: none;
    border-color: var(--color-brand);
}

/* 詞庫內容區域 */
.vocab-content-section {
    min-height: 300px;
}

.vocab-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--color-text-secondary);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #3A3A3C;
    border-top: 3px solid #007AFF;
    border-radius: 50%;
    animation: loading 1s linear infinite;
    margin-bottom: 16px;
}

.vocab-content {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 16px;
    min-height: 300px;
}

.vocab-empty {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 40px;
    font-size: 16px;
}

/* 詞彙網格 */
.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.phrase-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 60px;
    position: relative;
}

.phrase-card:hover {
    border-color: var(--color-brand);
    background: rgba(0, 122, 255, 0.1);
    transform: translateY(-2px);
}

.phrase-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.phrase-content {
    flex: 1;
    min-width: 0;
}

.phrase-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 4px;
    word-wrap: break-word;
}

.phrase-category {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.phrase-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.phrase-card:hover .phrase-actions {
    opacity: 1;
}

.action-btn {
    background: none;
    border: none;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

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

.edit-btn:hover {
    background: rgba(255, 149, 0, 0.2);
}

.delete-btn:hover {
    background: rgba(255, 59, 48, 0.2);
}

/* 模態底部 */
.modal-footer {
    padding: 24px;
    border-top: 1px solid #3A3A3C;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Toast 通知 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    min-width: 300px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    animation: toastSlideIn 0.3s ease;
}

.toast-success {
    border-left: 4px solid #34C759;
}

.toast-error {
    border-left: 4px solid #FF3B30;
}

.toast-info {
    border-left: 4px solid #007AFF;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-message {
    color: var(--color-text-primary);
    font-size: 14px;
    flex: 1;
}

.toast.fade-out {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* 響應式設計 - 詞庫管理 */
@media (max-width: 768px) {
    .vocabulary-modal {
        width: 95%;
        margin: 20px;
        max-height: 85vh;
    }
    
    .vocab-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .toolbar-left {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input {
        width: 100%;
    }
    
    .vocab-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .vocab-tabs {
        grid-template-columns: 1fr;
    }
}

/* 結果文本內容樣式 */
.result-text {
    font-size: 14px;
    line-height: 1.5;
    margin-top: 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.result-item.final .result-text {
    font-weight: 600;
}

.result-item.translation .result-text {
    font-style: italic;
}

.result-item.interim .result-text {
    opacity: 0.9;
}

/* Status indicator styles */
.status {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
}

.status.ready {
    background: linear-gradient(135deg, #E8F5E8, #D4F0D4);
    color: #2F7D32;
    border: 2px solid #4CAF50;
}

.status.processing {
    background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
    color: #1976D2;
    border: 2px solid #2196F3;
    animation: pulse 2s infinite;
}

.status.warning {
    background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
    color: #F57C00;
    border: 2px solid #FF9800;
    animation: pulse 1.5s infinite;
}

.status.error {
    background: linear-gradient(135deg, #FFEBEE, #FFCDD2);
    color: #D32F2F;
    border: 2px solid #F44336;
}


/* 添加淡入動畫，讓即時轉錄文字更明顯 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 為轉錄結果區域添加即時更新樣式 */
.transcription-result {
    transition: all 0.2s ease;
}

/* 確保滾動條總是顯示 */
#transcriptionResult {
    overflow-y: scroll !important;
    scroll-behavior: smooth;
}

/* 中間結果的樣式 - 同行更新效果 */
.interim-line {
    opacity: 0.7 !important;
    font-style: italic !important;
    transition: all 0.3s ease;
    background-color: transparent;
}

/* 最終結果的樣式 */
.final-result {
    font-weight: bold !important;
    opacity: 1 !important;
    animation: finalizeText 0.3s ease-in;
}

/* 翻譯結果的樣式 */
.translation-result {
    background-color: #f8f9fa !important;
    border-left: 4px solid #FF6B35 !important;
    padding-left: 10px !important;
    margin-left: 20px !important;
    margin-top: 2px !important;
    border-radius: 0 4px 4px 0;
}

/* 最終化動畫 */
@keyframes finalizeText {
    from {
        opacity: 0.7;
        font-style: italic;
        background-color: transparent;
    }
    to {
        opacity: 1;
        font-style: normal;
        background-color: transparent;
    }
}

/* 轉錄結果容器的改進 */
#transcriptionResult {
    overflow-y: auto !important;
    scroll-behavior: smooth !important;
    max-height: 400px;
    padding: 10px;
}

/* 每一行轉錄結果的基本樣式 */
.transcription-line {
    margin-bottom: 2px;
    word-wrap: break-word;
    line-height: 1.4;
}

/* 音量控制樣式 - 增強設計 */
.volume-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 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: #5A5A5E;
}

.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, #3A3A3C 0%, #2C2C2E 100%);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #FFFFFF 0%, #F0F0F0 100%);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 0 0 2px #007AFF,
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.4),
        0 0 0 3px #007AFF,
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

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

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #FFFFFF 0%, #F0F0F0 100%);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #007AFF;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    border-color: #0051D0;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 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 #9966CC !important;
    background-color: rgba(153, 102, 204, 0.05) !important;
    margin-left: 20px !important;
    padding-left: 10px !important;
    border-radius: 0 4px 4px 0;
    transition: all 0.3s ease;
    text-align: left !important;
}

.completed-translation {
    opacity: 1 !important;
    font-style: normal !important;
    border-left: 3px solid #9966CC !important;
    background-color: rgba(153, 102, 204, 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(153, 102, 204, 0.05);
    }
    to {
        opacity: 1;
        background-color: rgba(153, 102, 204, 0.08);
    }
}

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

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

.transcription-translation {
    color: #9966CC;
    font-style: italic;
    margin-left: 20px;
    padding-left: 10px;
    border-left: 3px solid #9966CC;
    background-color: rgba(153, 102, 204, 0.08);
    border-radius: 0 4px 4px 0;
}

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

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

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

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

.tab-btn.active {
    background: #007AFF;
    color: var(--color-text-primary);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

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

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

/* 共用控制區域 */
.shared-controls {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #3A3A3C;
}

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

/* 設備選擇器 */
.device-selector {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;  /* 統一圓角 */
    padding: 16px;
    margin-bottom: 16px;  /* 統一間距 */
}

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

.device-selector label {
    display: block;
    margin-bottom: 8px;  /* 統一間距 */
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.device-selector select {
    width: 100%;
    height: 36px;  /* 統一高度 */
    background: var(--color-bg-tertiary);  /* 統一背景色 */
    border: 1px solid var(--color-border);
    border-radius: 4px;  /* 統一圓角 */
    padding: 8px 12px;  /* 統一內距 */
    color: var(--color-text-primary);
    font-size: 14px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: border-color 0.2s;
}

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

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

/* 錄音控制區域 */
.recording-controls {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;  /* 統一圓角 */
    padding: 16px;  /* 統一內距 */
    margin-bottom: 16px;  /* 統一間距 */
}

/* 錄音狀態 */
.recording-status {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--color-bg-primary);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.status-icon {
    font-size: 32px;
    /* 移除呼吸動畫，保持靜態圖標 */
}

.recording-status.recording .status-icon {
    /* 錄音時也不需要動畫，只改變顏色 */
    color: var(--color-error);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.status-text {
    flex: 1;
}

.status-label {
    display: block;
    font-weight: 600;
    font-size: 16px;
    color: var(--color-text-primary);
    margin-bottom: 4px;
}

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

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

.record-btn {
    flex: 2;
    background: linear-gradient(135deg, #FF3B30 0%, #FF6B6B 100%);
    border: none;
    color: var(--color-text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    min-height: 44px;  /* 確保可觸控 */
}

.record-btn:hover {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF3B30 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 59, 48, 0.3);
}

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

.record-btn.recording {
    background: linear-gradient(135deg, #FF9500 0%, #FFCC02 100%);
}

.record-btn.paused {
    background: linear-gradient(135deg, #34C759 0%, #32D74B 100%);
}

/* 音量監測 */
.volume-monitor {
    margin-bottom: 16px;
}

.volume-monitor label {
    display: block;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 12px;
}

.volume-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 40px;
    background: var(--color-bg-primary);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
}

.volume-bar {
    flex: 1;
    background: var(--color-border-hover);
    border-radius: 2px;
    min-height: 4px;
    transition: all 0.1s ease;
}

.volume-bar.active {
    background: linear-gradient(to top, #34C759 0%, #32D74B 50%, #FFCC02 75%, #FF3B30 100%);
}

.volume-level {
    text-align: center;
    font-size: 12px;
    color: var(--color-text-secondary);
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* ========================================
   統一的左側面板設計系統
   ======================================== */

/* 基礎面板區塊樣式 */
.panel-section {
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-bg-secondary);
}

/* 面板標題樣式 */
.panel-section-header {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 面板內容區樣式 */
.panel-section-content {
    padding: 16px;
}

/* 統一的標籤樣式 */
.panel-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
}

/* 統一的提示文字樣式 */
.panel-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.4;
}

/* 統一的輸入控件組 */
.panel-control-group {
    margin-bottom: 16px;
}
.panel-control-group:last-child {
    margin-bottom: 0;
}

/* 統一的選擇器樣式 */
.panel-select {
    width: 100%;
    height: 36px;
    padding: 8px 12px;
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s;
}
.panel-select:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* 統一的複選框樣式 */
.panel-checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.panel-checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-accent);
}
.panel-checkbox-group label {
    font-size: 14px;
    font-weight: normal;
    color: var(--color-text-primary);
    cursor: pointer;
    margin-bottom: 0;
}

/* 統一的按鈕組樣式 */
.panel-button-group {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* 錄音設置 - 使用統一樣式，此處保留作為兼容 */
.recording-settings {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;  /* 統一為 8px */
    padding: 16px;
    margin-bottom: 16px;  /* 統一為 16px */
}

.recording-settings label {
    display: block;
    margin-bottom: 12px;
    font-size: 14px;  /* 統一標籤字體大小 */
    font-weight: 600;
    color: var(--color-text-primary);
}

.setting-group {
    margin-bottom: 12px;
}

.setting-group label {
    font-size: 14px;  /* 統一標籤字體大小 */
    font-weight: normal;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.setting-group input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #3A3A3C;
    border-radius: 4px;
    background: var(--color-bg-primary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.setting-group input[type="checkbox"]:checked {
    background: #007AFF;
    border-color: var(--color-brand);
}

.setting-group input[type="checkbox"]:checked::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-text-primary);
    font-size: 12px;
    font-weight: bold;
}

.setting-group select {
    width: 100%;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--color-text-primary);
    font-size: 14px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .tab-navigation {
        margin-bottom: 16px;
    }
    
    .tab-btn {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .recording-buttons {
        flex-direction: column;
    }
    
    .recording-status {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .volume-bars {
        height: 32px;
    }
}

/* 翻譯設置 - 調整為統一樣式 */
.translation-settings {
    margin-bottom: 16px;
    padding: 0;
}
.translation-settings label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
}
.toggle-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal !important;
}
.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-accent);
}
.toggle-text {
    color: var(--color-text-primary);
    font-size: 14px;
}
.setting-hint {
    color: var(--color-text-secondary);
    font-size: 12px;
    margin-top: 4px;
    line-height: 1.4;
    display: block;
}

/* 演講資訊樣式 */
.speech-info {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 122, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(0, 122, 255, 0.2);
}

.speech-info h3 {
    margin: 0 0 8px 0;
    color: var(--color-brand);
    font-size: 18px;
}

.speech-info p {
    margin: 0 0 8px 0;
    color: var(--color-text-secondary);
    font-size: 14px;
}

.speech-info > div {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #48484A;
}

.speech-info a {
    color: var(--color-brand);
    text-decoration: none;
}

.speech-info a:hover {
    text-decoration: underline;
}

/* 詞彙網格樣式改進 */
.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    min-height: 200px;
    padding: 8px;
}

.vocab-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-secondary);
    font-size: 16px;
}

/* v2 詞彙容器樣式 */
.vocab-v2-container {
    padding: 16px;
}

/* 同步狀態區域 - 側邊欄版本 (非狀態列) */
.vocab-panel .vocab-sync-status,
.section-content:not(.system-section) .vocab-sync-status,
.vocab-v2-container .vocab-sync-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--color-bg-secondary);
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

/* 側邊欄版本的狀態色彩 */
.vocab-panel .vocab-sync-status.synced,
.section-content .vocab-sync-status.synced,
.vocab-v2-container .vocab-sync-status.synced {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.05);
}

.vocab-panel .vocab-sync-status.error,
.section-content .vocab-sync-status.error,
.vocab-v2-container .vocab-sync-status.error {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

/* 狀態列版本無背景 */
.header-actions .vocab-sync-status.synced,
.header-actions .vocab-sync-status.error,
.header-actions .vocab-sync-status.normal {
    background: transparent !important;
    border: none !important;
}

.sync-indicator {
    font-size: 18px;
    animation: rotate 2s linear infinite;
}

.vocab-sync-status.synced .sync-indicator,
.vocab-sync-status.error .sync-indicator {
    animation: none;
}

.sync-text {
    flex: 1;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.btn-sync {
    background: var(--color-brand);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-sync:hover {
    background: #0056b3;
    transform: scale(1.05);
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.vocab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.vocab-count {
    font-size: 14px;
    color: var(--color-text-secondary);
    font-weight: 600;
}

.btn-add-vocab {
    background: var(--color-brand);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-add-vocab:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

/* 詞彙列表 */
.vocab-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 詞彙項目 */
.vocab-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--color-bg-primary);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.vocab-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 權重等級樣式 */
.vocab-item.boost-level-1 {
    border-left: 4px solid #6c757d;
}

.vocab-item.boost-level-2 {
    border-left: 4px solid #ffc107;
    background: rgba(255, 193, 7, 0.05);
}

.vocab-item.boost-level-3 {
    border-left: 4px solid #ff6b6b;
    background: rgba(255, 107, 107, 0.05);
}

/* 詞彙文字 */
.vocab-phrase {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-right: 16px;
    flex: 1;
}

/* 詞彙元資料 */
.vocab-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-right: 16px;
}

.vocab-meta span {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.vocab-language {
    background: rgba(0, 122, 255, 0.1);
    color: var(--color-brand);
}

.vocab-category {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}

.vocab-boost {
    background: rgba(255, 193, 7, 0.1);
    color: #f39c12;
    font-weight: 600;
}

.vocab-usage {
    background: rgba(156, 39, 176, 0.1);
    color: #9c27b0;
}

/* 詞彙操作按鈕 */
.vocab-actions {
    display: flex;
    gap: 8px;
}

.vocab-actions button {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.vocab-actions button:hover {
    background: var(--color-bg-secondary);
    transform: scale(1.1);
}

.btn-edit:hover {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.btn-delete:hover {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

/* 詞彙錯誤提示 */
.vocab-error {
    text-align: center;
    padding: 40px;
    color: #dc3545;
    font-size: 14px;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 8px;
}

/* 🔌 連線狀態指示器 */
.connection-status-container {
    margin-right: 20px;
}

.connection-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--color-bg-tertiary);
    border-radius: 20px;
    border: 1px solid var(--color-border);
    transition: all var(--transition-fast);
    font-size: 14px;
}

.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.connection-text {
    color: var(--color-text-secondary);
    font-weight: 500;
}

.connection-quality {
    color: var(--color-text-secondary);
    font-size: 12px;
    opacity: 0.8;
}

/* 連線狀態變化 */
.connection-indicator.connected .connection-dot {
    background: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

.connection-indicator.connected .connection-text {
    color: var(--color-success);
}

.connection-indicator.connecting .connection-dot,
.connection-indicator.reconnecting .connection-dot {
    background: var(--color-warning);
    animation: pulse 1.5s infinite;
}

.connection-indicator.connecting .connection-text,
.connection-indicator.reconnecting .connection-text {
    color: var(--color-warning);
}

.connection-indicator.disconnected .connection-dot,
.connection-indicator.error .connection-dot {
    background: var(--color-error);
}

.connection-indicator.disconnected .connection-text,
.connection-indicator.error .connection-text {
    color: var(--color-error);
}

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

/* 使用量指示器 */
#usageIndicator,
.usage-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(52, 199, 89, 0.1);
    border: 1px solid rgba(52, 199, 89, 0.3);
    border-radius: 20px;
    margin-right: 20px;
    transition: all var(--transition-fast);
}

#usageIndicator:hover,
.usage-info:hover {
    background: rgba(52, 199, 89, 0.15);
    border-color: rgba(52, 199, 89, 0.5);
    cursor: pointer;
}

/* 在下拉選單中的使用量資訊 */
.user-dropdown .usage-info {
    margin: 8px 12px;
    padding: 12px;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: default;
}

.usage-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.usage-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.usage-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    line-height: 1.4;
}

.usage-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.usage-value.warning {
    color: var(--color-warning);
}

.usage-value.danger {
    color: var(--color-error);
}

/* 使用量統計網格 */
.usage-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.usage-stat-item {
    background: var(--color-bg-tertiary);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    text-align: center;
}

.stat-label {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.usage-progress-bar {
    width: 100%;
    height: 20px;
    background: var(--color-bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 20px;
}

.usage-progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-success) 0%, var(--color-brand) 100%);
    transition: width 0.3s ease;
}

/* 🎯 操作提示浮動層 */
.operation-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    padding: 12px 24px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 8px;
}

.operation-toast.show {
    opacity: 1;
    visibility: visible;
    animation: slideUp 0.3s ease-out;
}

.operation-toast.success {
    border-color: var(--color-success);
    background: rgba(52, 199, 89, 0.1);
}

.operation-toast.warning {
    border-color: var(--color-warning);
    background: rgba(255, 149, 0, 0.1);
}

.operation-toast.error {
    border-color: var(--color-error);
    background: rgba(255, 59, 48, 0.1);
}

.operation-toast .toast-icon {
    font-size: 18px;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 20px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* 🔄 操作進度指示器 */
.operation-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-bg-secondary);
    z-index: 2001;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast);
}

.operation-progress.show {
    opacity: 1;
    visibility: visible;
}

.operation-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-brand) 0%, var(--color-success) 100%);
    width: 0%;
    transition: width var(--transition-slow);
}

.operation-progress-bar.indeterminate {
    width: 30%;
    animation: indeterminate 1.5s infinite;
}

@keyframes indeterminate {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(400%);
    }
}

/* 處理指示器樣式 */
.processing-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 1000;
}

.processing-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Header 響應式設計優化 - 已整合到主要 header 樣式中 */

/* 次要操作按鈕樣式 - 提高選擇器優先級 */
button.btn.btn-secondary,
.btn.btn-secondary {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--color-text-secondary) !important;
    padding: 12px 20px;
    font-size: 13px;
    backdrop-filter: blur(10px);
    font-weight: 500;
    transition: all var(--transition-fast);
    box-shadow: none;
}

button.btn.btn-secondary:hover,
.btn.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* 中等螢幕 Header 優化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .header {
        padding: 14px 18px;
    }

    .brand-title {
        font-size: 18px;
    }

    .brand-subtitle {
        font-size: 13px;
    }
}

/* 小螢幕響應式 - Header */
@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
    }

    .header-container {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .header-brand {
        justify-content: center;
    }
    
    .header-actions {
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
        padding: 0;
    }
    
    /* 狀態列區塊在小螢幕下的調整 */
    .core-section {
        width: 100%;
        justify-content: center;
        padding: 0 12px;
    }
    
    .system-section {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* 確保詞庫狀態內部不換行 */
    .system-section .vocab-sync-status {
        flex-wrap: nowrap !important;
        white-space: nowrap !important;
    }
    
    .status-separator {
        display: none;  /* 小螢幕隱藏分隔線 */
    }
    
    /* 場次選擇器在小螢幕的調整 */
    .quick-session-switcher {
        width: 100%;
        justify-content: center;
    }
    
    .session-select {
        max-width: 200px;  /* 限制選擇器寬度 */
    }
    
    .brand-subtitle {
        display: none; /* 隱藏副標題節省空間 */
    }
    
    .brand-title {
        font-size: 20px;
    }
}

/* 手機響應式 - Header */
@media (max-width: 480px) {
    .brand-icon {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .brand-title {
        font-size: 18px;
    }
    
    /* 狀態列元素優先級調整 */
    .system-status,
    .connection-indicator {
        display: none;  /* 隱藏次要狀態資訊 */
    }
    
    /* 只保留核心元素 */
    .vocab-sync-status .sync-count {
        display: none;  /* 隱藏場次計數 */
    }
    
    .session-label {
        display: none;  /* 隱藏「場次：」標籤 */
    }
    
    .session-select {
        width: 100%;
        max-width: 150px;
        font-size: 12px;
    }
    
    .auto-switch-indicator {
        font-size: 14px;  /* 縮小圖標 */
    }
    
    .connection-status-container {
        display: none; /* 隱藏連線狀態 */
    }
    
    .logout-btn .logout-text {
        display: none; /* 只顯示圖標 */
    }
    
    .logout-btn {
        padding: 8px 12px;
    }
    
    .user-profile-main {
        padding: 6px 12px;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .user-name {
        font-size: 13px;
    }
    
    .user-role {
        display: none;
    }
}

/* 浮動字幕面板樣式 */
.floating-subtitle-panel {
    position: fixed;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.floating-panel-header {
    background: linear-gradient(135deg, var(--color-bg-primary) 0%, var(--color-bg-secondary) 100%);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
    user-select: none;
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.panel-controls {
    display: flex;
    gap: 8px;
}

.panel-controls button {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition-fast);
    font-size: 14px;
}

.panel-controls button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
}

.floating-panel-content {
    flex: 1;
    background: #000000;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.floating-panel-content.subtitle-mode {
    font-size: var(--subtitle-font-size, 32px);
    color: var(--subtitle-text-color, #ffffff);
}

.floating-panel-content > div {
    text-align: center;
    margin-bottom: 12px;
    max-width: 90%;
}

.floating-panel-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #666 50%);
}

/* 按鈕防重複點擊保護樣式 */
button.processing {
    cursor: not-allowed !important;
    opacity: 0.7;
    position: relative;
}

button.processing::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: button-spin 0.8s linear infinite;
}

@keyframes button-spin {
    to {
        transform: rotate(360deg);
    }
}

/* 全域按鈕最小觸控區域 */
button,
.button,
[role="button"] {
    min-height: 44px;  /* iOS/Android 建議最小觸控區域 */
    min-width: 44px;
}

/* ========================================
   音質檢測系統
   ======================================== */

/* 音質檢測容器 */
.audio-quality-check {
    margin: 8px 12px;
    padding: 12px;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.quality-check-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quality-check-icon {
    font-size: 16px;
}

.quality-check-label {
    font-size: 14px;
    color: var(--color-text-primary);
    flex: 1;
}

.quality-check-btn {
    padding: 4px 12px;
    min-height: unset;  /* 覆蓋全域按鈕規則 */
    min-width: unset;
    font-size: 12px;
    background: var(--color-primary);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
}

.quality-check-btn:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.quality-check-btn:disabled {
    background: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
    opacity: 0.6;
}

/* 檢測結果區域 */
.quality-check-result {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 狀態顯示 */
.quality-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.quality-status.pass {
    color: #34c759;
}

.quality-status.warning {
    color: #ff9500;
}

.quality-status.fail {
    color: #ff3b30;
}

/* 指標列表 */
.quality-metrics {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
}

.quality-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-label {
    color: rgba(255, 255, 255, 0.7);
}

.metric-value {
    font-weight: 600;
    text-align: right;
}

.metric-value.good {
    color: #34c759;
}

.metric-value.warning {
    color: #ff9500;
}

.metric-value.bad {
    color: #ff3b30;
}

/* 建議區塊 */
.quality-suggestions {
    margin-top: 12px;
    padding: 8px;
    background: rgba(255, 152, 0, 0.1);
    border-left: 3px solid #ff9500;
    border-radius: 4px;
    font-size: 12px;
}

.quality-suggestions strong {
    display: block;
    margin-bottom: 4px;
    color: #ff9500;
}

.quality-suggestions ul {
    margin: 4px 0;
    padding-left: 20px;
    color: rgba(255, 255, 255, 0.8);
}

.quality-suggestions li {
    margin: 2px 0;
}

/* 綜合評分 */
.quality-score {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 24px;
    font-weight: 700;
}

.quality-score.pass {
    color: #34c759;
}

.quality-score.warning {
    color: #ff9500;
}

.quality-score.fail {
    color: #ff3b30;
}

/* 進度條 */
.quality-progress {
    margin-top: 8px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.quality-progress-bar {
    height: 100%;
    background: var(--color-primary);
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* 頻段分析 */
.frequency-bands {
    margin-top: 12px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.bands-header {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.bands-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.band-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    font-size: 11px;
    border-left: 3px solid;
}

.band-item.good {
    border-left-color: #34c759;
}

.band-item.fair {
    border-left-color: #ff9500;
}

.band-item.poor {
    border-left-color: #ff3b30;
}

.band-icon {
    font-size: 12px;
    flex-shrink: 0;
}

.band-name {
    flex: 1;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.band-energy {
    color: rgba(255, 255, 255, 0.6);
    font-size: 10px;
    flex-shrink: 0;
}

/* ============================================
   詞庫查看對話框樣式
   ============================================ */

/* 對話框淡入動畫 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 詞彙表格滾動條美化 */
#simpleVocabDialog table {
    scrollbar-width: thin;
    scrollbar-color: rgba(142, 142, 147, 0.5) transparent;
}

#simpleVocabDialog table::-webkit-scrollbar {
    width: 8px;
}

#simpleVocabDialog table::-webkit-scrollbar-track {
    background: transparent;
}

#simpleVocabDialog table::-webkit-scrollbar-thumb {
    background: rgba(142, 142, 147, 0.5);
    border-radius: 4px;
}

#simpleVocabDialog table::-webkit-scrollbar-thumb:hover {
    background: rgba(142, 142, 147, 0.7);
}
