/* MultiTrans - Premium Metallic Theme with Blue Smoke Effect */
/* 基於原版設計重構 - 深色金屬質感風格 */

/* ========== 基礎變數 ========== */
:root {
    /* 漸層色系 - Metallic Style */
    --gradient-primary: linear-gradient(145deg, #3a4556 0%, #252d38 100%);
    --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-dark: linear-gradient(145deg, #0d1117 0%, #161b22 50%, #0d1117 100%);
    --gradient-card: linear-gradient(145deg, #1a1f27 0%, #12161c 100%);

    /* Metallic Dark Palette */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: linear-gradient(145deg, rgba(26, 31, 39, 0.9) 0%, rgba(18, 22, 28, 0.95) 100%);
    --bg-card-hover: rgba(42, 48, 60, 0.9);
    --bg-input: rgba(10, 14, 22, 0.8);

    /* Metallic Highlights */
    --metal-light: #4a5568;
    --metal-shine: #718096;
    --metal-edge: rgba(255, 255, 255, 0.08);

    /* White & Gray Scale */
    --text-primary: #f0f4f8;
    --text-secondary: #a0aec0;
    --text-muted: #718096;

    /* Blue Smoke */
    --smoke-blue: rgba(100, 150, 200, 0.15);
    --smoke-blue-light: rgba(120, 180, 220, 0.08);
    --smoke-cyan: rgba(80, 200, 220, 0.1);

    --accent-blue: #5c6bc0;
    --accent-purple: #7c4dff;
    --accent-pink: #f48fb1;
    --accent-cyan: #00e5ff;
    --accent-green: #69f0ae;

    --border-subtle: rgba(74, 85, 104, 0.3);
    --border-glow: rgba(100, 150, 200, 0.4);

    /* 陰影 */
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(100, 150, 200, 0.15);
    --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.2), 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-metal: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -1px 0 rgba(0, 0, 0, 0.3), 0 4px 20px rgba(0, 0, 0, 0.5);

    /* 模糊 */
    --blur-card: blur(20px);
}

/* ========== 全域重置 ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.7;
    /* Metal texture with right-center highlight spreading to center */
    background:
        /* Primary metallic shine - from right center, spreading left */
        radial-gradient(ellipse 80% 80% at 100% 50%, rgba(130, 160, 200, 0.25) 0%, rgba(110, 140, 180, 0.15) 20%, rgba(90, 120, 160, 0.08) 40%, transparent 60%),
        /* Secondary glow for depth */
        radial-gradient(ellipse 60% 70% at 95% 45%, rgba(150, 180, 220, 0.18) 0%, rgba(120, 150, 190, 0.08) 30%, transparent 50%),
        /* Subtle inner spread */
        radial-gradient(ellipse 50% 60% at 80% 55%, rgba(140, 170, 210, 0.1) 0%, transparent 45%),
        /* Base gradient */
        var(--gradient-dark);
    background-attachment: fixed;
    overflow-x: hidden;
}

/* Brushed Metal Texture Overlay - More Visible */
body::before {
    content: '';
    position: fixed;
    top: -20px;
    left: -20px;
    width: calc(100% + 40px);
    height: calc(100% + 40px);
    pointer-events: none;
    /* Horizontal brushed metal lines */
    background:
        repeating-linear-gradient(90deg,
            transparent 0px,
            rgba(255, 255, 255, 0.015) 1px,
            transparent 2px,
            transparent 3px),
        repeating-linear-gradient(90deg,
            transparent 0px,
            rgba(200, 220, 240, 0.02) 0.5px,
            transparent 1px,
            transparent 2px);
    z-index: 0;
    animation: metalDrift 30s ease-in-out infinite;
}

/* Slow, organic drifting motion for metal texture */
@keyframes metalDrift {
    0% {
        transform: translate(0, 0);
    }

    15% {
        transform: translate(-10px, 8px);
    }

    30% {
        transform: translate(5px, 15px);
    }

    45% {
        transform: translate(12px, 3px);
    }

    60% {
        transform: translate(8px, -10px);
    }

    75% {
        transform: translate(-5px, -8px);
    }

    90% {
        transform: translate(-12px, 5px);
    }

    100% {
        transform: translate(0, 0);
    }
}

/* Blue Smoke Animation Layer */
body::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 50% at 20% 100%, rgba(70, 130, 180, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 90%, rgba(100, 160, 200, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 100% 60% at 50% 110%, rgba(80, 140, 190, 0.08) 0%, transparent 70%);
    animation: smokeFlow 15s ease-in-out infinite;
    z-index: 0;
}

@keyframes smokeFlow {

    0%,
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    33% {
        transform: translateY(-20px) scale(1.05);
        opacity: 0.8;
    }

    66% {
        transform: translateY(-10px) scale(0.98);
        opacity: 0.9;
    }
}

/* ========== Version Badge ========== */
.version-badge {
    position: fixed;
    top: 4.5rem;
    left: 1rem;
    background: var(--gradient-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 0.4rem;
    z-index: 1000;
    box-shadow: var(--shadow-soft);
    opacity: 0.8;
}

/* ========== 容器 ========== */
.container {
    position: relative;
    z-index: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ========== 標題區 ========== */
header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 1.5rem 0;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    /* Animated Tech Gradient - White/Gray/Misty Blue */
    background: linear-gradient(90deg,
            #ffffff 0%,
            #a8c0d8 20%,
            #7ba3c4 40%,
            #c8d8e8 60%,
            #a8c0d8 80%,
            #ffffff 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleShine 10s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(120, 160, 200, 0.3));
    margin-bottom: 0.5rem;
}

@keyframes titleShine {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* ========== 卡片基礎 ========== */
.control-panel,
.recordings-panel,
.transcript-panel,
.translation-section {
    background: var(--bg-card);
    backdrop-filter: var(--blur-card);
    -webkit-backdrop-filter: var(--blur-card);
    border: 2px solid var(--border-subtle);
    border-radius: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Animated Glow Border Effect on Hover */
.control-panel:hover,
.recordings-panel:hover,
.transcript-panel:hover,
.translation-section:hover {
    border-color: rgba(100, 180, 220, 0.6);
    box-shadow:
        var(--shadow-card),
        0 0 20px rgba(100, 180, 220, 0.3),
        0 0 40px rgba(80, 150, 200, 0.2),
        inset 0 0 30px rgba(100, 180, 220, 0.05);
    transform: translateY(-2px);
    animation: borderGlow 2s ease-in-out infinite;
}

/* Breathing Glow Animation */
@keyframes borderGlow {

    0%,
    100% {
        border-color: rgba(100, 180, 220, 0.5);
        box-shadow:
            var(--shadow-card),
            0 0 15px rgba(100, 180, 220, 0.25),
            0 0 30px rgba(80, 150, 200, 0.15);
    }

    50% {
        border-color: rgba(120, 200, 240, 0.7);
        box-shadow:
            var(--shadow-card),
            0 0 25px rgba(100, 180, 220, 0.4),
            0 0 50px rgba(80, 150, 200, 0.25),
            inset 0 0 40px rgba(100, 180, 220, 0.08);
    }
}

/* 卡片標題 */
.recordings-panel h2,
.transcript-panel h2,
.translation-section h2 {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* ========== 控制面板 ========== */
.control-panel {
    padding: 1.75rem;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
}

/* ========== 按鈕系統 - Premium Metallic Style ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

/* Metallic shine sweep effect */
.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.15),
            transparent);
    transition: left 0.6s ease;
}

.btn:hover::before {
    left: 100%;
}

/* Primary Button - Metallic Gray */
.btn-primary {
    background: linear-gradient(145deg, #3a4556 0%, #252d38 100%);
    color: var(--text-primary);
    border: 1px solid var(--metal-light);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 8px 25px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(100, 150, 200, 0.15);
    border-color: var(--metal-shine);
}

/* Danger Button - Metallic Dark Red */
.btn-danger {
    background: linear-gradient(145deg, #c42f4f 0%, #9a2540 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 68, 102, 0.5);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(145deg, #ff4466 0%, #cc3355 100%);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow:
        0 8px 25px rgba(255, 68, 102, 0.3),
        0 0 20px rgba(255, 68, 102, 0.2);
}

/* Secondary Button - Metallic Subtle */
.btn-secondary {
    background: linear-gradient(145deg, #2a3040 0%, #1e242d 100%);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(145deg, #3a4556 0%, #2a3040 100%);
    border-color: var(--metal-light);
    color: var(--text-primary);
}

/* Accent Button - Metallic Blue/Purple for Share */
.btn-accent {
    background: linear-gradient(145deg, #3a4566 0%, #2a3550 100%);
    color: #88b4ff;
    border: 1px solid rgba(100, 150, 255, 0.3);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-accent:hover:not(:disabled) {
    background: linear-gradient(145deg, #4a5576 0%, #3a4560 100%);
    border-color: rgba(100, 180, 255, 0.5);
    color: #aaccff;
    box-shadow:
        0 8px 25px rgba(100, 150, 255, 0.2),
        0 0 20px rgba(100, 150, 255, 0.15);
    transform: translateY(-2px);
}

/* ========== Share Info Display ========== */
.share-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    background: rgba(100, 150, 255, 0.1);
    border: 1px solid rgba(100, 150, 255, 0.3);
    border-radius: 0.5rem;
}

.share-info.hidden {
    display: none;
}

.share-link {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent-blue);
    word-break: break-all;
}

.share-info .btn-copy-link,
.share-info .btn-stop-share {
    flex-shrink: 0;
}


.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Active recording state - pulsing red button */
.btn.recording {
    background: linear-gradient(135deg, #ff1744 0%, #d50000 100%);
    box-shadow: 0 4px 20px rgba(255, 23, 68, 0.5);
    animation: recordingPulse 1.5s ease-in-out infinite;
}

.btn.recording:hover {
    box-shadow: 0 6px 25px rgba(255, 23, 68, 0.6);
}

@keyframes recordingPulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(255, 23, 68, 0.5);
    }

    50% {
        box-shadow: 0 4px 30px rgba(255, 23, 68, 0.8);
    }
}


.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: var(--text-primary);
}

/* ========== 選項/勾選框 ========== */
.options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.option-group {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(92, 107, 192, 0.1);
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s;
    font-size: 0.9rem;
}

.option-group:hover {
    background: rgba(92, 107, 192, 0.15);
    border-color: var(--accent-blue);
}

.option-group input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--accent-purple);
}

/* Transcribe Mode Toggle - Metallic Style */
.transcribe-mode-toggle {
    background: linear-gradient(145deg, #2a3040 0%, #1e242d 100%);
    border: 1px solid var(--border-subtle);
    padding: 0.5rem 0.75rem;
}

.transcribe-mode-toggle span {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-right: 0.5rem;
}

.transcribe-mode-toggle select {
    background: linear-gradient(145deg, #3a4556 0%, #252d38 100%);
    border: 1px solid var(--metal-light);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0aec0' d='M3 4.5L6 8l3-3.5H3z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 6px rgba(0, 0, 0, 0.2);
}

.transcribe-mode-toggle select:hover {
    border-color: var(--accent-blue);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 4px 12px rgba(100, 150, 200, 0.15);
}

.transcribe-mode-toggle select:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.2);
}

.transcribe-mode-toggle select option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0.5rem;
}

.mode-select {
    padding: 0.6rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s;
}

.mode-select:hover {
    border-color: var(--accent-blue);
}

.mode-select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.15);
}

.mode-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* ========== 狀態指示器 ========== */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.status.idle {
    background: rgba(92, 107, 192, 0.15);
    color: var(--text-secondary);
}

.status.capturing {
    background: rgba(255, 193, 7, 0.15);
    color: #ffd54f;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.2);
}

.status.active,
.status.transcribing {
    background: rgba(105, 240, 174, 0.15);
    color: var(--accent-green);
    animation: statusPulse 1.5s ease-in-out infinite;
}

.status.recording {
    background: rgba(255, 82, 82, 0.15);
    color: #ff8a80;
    animation: statusPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 82, 82, 0.3);
}

.status.error {
    background: rgba(255, 82, 82, 0.15);
    color: #ff8a80;
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.vad-indicator {
    margin-right: 0.25rem;
    transition: all 0.3s;
}

.vad-indicator.active {
    animation: vadPulse 0.5s ease-in-out infinite;
}

@keyframes vadPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* ========== 頁尾 ========== */
footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

footer a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--accent-purple);
}

/* ========== 捲軸樣式 ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* ========== 區段標題列 ========== */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(90deg, rgba(124, 77, 255, 0.1) 0%, transparent 100%);
    border-bottom: 1px solid var(--border-subtle);
}

.section-header-actions {
    display: flex;
    gap: 0.5rem;
}

/* ========== 錄音清單 ========== */
.recordings-panel h2 {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(90deg, rgba(124, 77, 255, 0.1) 0%, transparent 100%);
    border-bottom: 1px solid var(--border-subtle);
}

.recordings-list {
    padding: 1rem 1.5rem;
}

.empty-hint {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 2rem 1rem;
}

.recording-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: rgba(92, 107, 192, 0.08);
    border: 1px solid transparent;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    transition: all 0.25s;
}

.recording-item:hover {
    background: rgba(92, 107, 192, 0.15);
    border-color: var(--border-subtle);
}

.recording-info {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.recording-time {
    color: var(--text-primary);
    font-weight: 500;
}

.recording-size {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.recording-actions {
    display: flex;
    gap: 0.5rem;
}

/* ========== 轉錄面板 ========== */
.transcript-output {
    padding: 1.5rem;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    background: rgba(0, 0, 0, 0.3);
}

.transcript-line {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: rgba(92, 107, 192, 0.05);
    border-left: 3px solid var(--accent-purple);
    border-radius: 0 0.5rem 0.5rem 0;
    transition: all 0.2s;
}

.transcript-line:hover {
    background: rgba(92, 107, 192, 0.1);
}

/* 時間戳樣式 */
.transcript-line .timestamp {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 0.75rem;
    opacity: 0.8;
}

/* 交替底色 */
.transcript-line.line-bg-a {
    background: rgba(139, 92, 246, 0.12);
}

.transcript-line.line-bg-b {
    background: rgba(180, 130, 70, 0.15);
}

.transcript-line.line-bg-c {
    background: rgba(16, 185, 129, 0.12);
}

/* AI 梳理後的內容 */
.transcript-line.organized {
    border-left-color: var(--accent-green);
    background: rgba(105, 240, 174, 0.08);
}

/* 翻譯內容 */
.transcript-translation {
    margin-top: 0.5rem;
    padding-left: 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-left: 2px solid var(--accent-cyan);
}

/* 筆記樣式 */
.transcript-line.note {
    border-left-color: #ffd54f;
    background: rgba(255, 213, 79, 0.1);
}

/* ========== 梳理面板 ========== */
.organized-panel {
    border-color: rgba(105, 240, 174, 0.3);
}

.organized-panel h2 {
    color: var(--accent-green);
}

/* ========== 關鍵字區域 ========== */
.keyword-section {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.2);
}

.keyword-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.keyword-header label {
    font-weight: 600;
    color: var(--text-secondary);
}

.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.keyword-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.8rem;
    background: var(--gradient-primary);
    color: white;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.keyword-tag .count {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.1rem 0.4rem;
    border-radius: 1rem;
}

.keyword-tag .remove {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.keyword-tag .remove:hover {
    opacity: 1;
}

/* ========== 翻譯區塊 ========== */
.translation-section {
    padding: 0;
}

.translation-section .section-header-row {
    padding: 1rem 1.5rem;
}

#translationPanels {
    padding: 1rem 1.5rem;
}

.translation-panel {
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.translation-panel-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 0.75rem;
}

.translation-col {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.translation-col .col-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.translation-col select,
.lang-select,
.source-select {
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    min-width: 140px;
}

.translation-col select:hover,
.lang-select:hover,
.source-select:hover {
    border-color: var(--accent-blue);
}

.translation-actions {
    margin-left: auto;
}

.translation-actions .action-buttons {
    display: flex;
    gap: 0.5rem;
}

.translation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.translation-output {
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.7;
}

.translation-panel-content {
    min-height: 80px;
    max-height: 250px;
    overflow-y: auto;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.translation-line {
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0.375rem;
}

.translation-line .timestamp {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-right: 0.5rem;
}

/* Translation line alternating colors */
.translation-line.line-bg-a {
    background: rgba(102, 126, 234, 0.15);
    border-left: 3px solid rgba(102, 126, 234, 0.6);
}

.translation-line.line-bg-b {
    background: rgba(124, 77, 255, 0.15);
    border-left: 3px solid rgba(124, 77, 255, 0.6);
}

.translation-line.line-bg-c {
    background: rgba(244, 143, 177, 0.15);
    border-left: 3px solid rgba(244, 143, 177, 0.6);
}

/* ========== 波形顯示 ========== */
.waveform-container {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.75rem;
}

#waveformCanvas {
    width: 100%;
    height: 100px;
    border-radius: 0.5rem;
}

.volume-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

.volume-meter {
    flex: 1;
    height: 8px;
    background: rgba(92, 107, 192, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.volume-bar {
    height: 100%;
    width: 0%;
    background: var(--gradient-primary);
    transition: width 0.1s;
}

#volumeText {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    min-width: 60px;
}

/* ========== 錄音區塊 ========== */
.recordings-panel {
    background: var(--bg-card);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.recordings-panel h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.recordings-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.recording-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    border: 1px solid var(--border-subtle);
}

.recording-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.recording-time {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.recording-size {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.recording-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: var(--warning);
    color: black;
    border-radius: 0.25rem;
    font-weight: 600;
}

.recording-actions {
    display: flex;
    gap: 0.5rem;
}


/* ========== 右上角語言選擇器 ========== */
.language-selector {
    position: fixed;
    top: 1rem;
    right: 5rem;
    z-index: 1001;
}

.language-selector select {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239fa8da' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.language-selector select:hover {
    border-color: var(--accent-blue);
    background-color: var(--bg-card-hover);
}

.language-selector select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.15);
}

.language-selector select option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* ========== 左側歷史側邊欄 ========== */
.sidebar-toggle-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
}

.sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    background: var(--bg-card);
    backdrop-filter: var(--blur-card);
    border-right: 1px solid var(--border-subtle);
    z-index: 1100;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-soft);
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.folder-status {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    list-style: none;
}

.history-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: rgba(92, 107, 192, 0.08);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:hover {
    background: rgba(92, 107, 192, 0.15);
}

.history-item.active {
    background: rgba(124, 77, 255, 0.2);
    border-left: 3px solid var(--accent-purple);
}

/* Warning style for folder status */
.folder-status.warning {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border-left: 3px solid #ffc107;
}

/* History item details */
.history-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-date {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.history-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.history-item:hover .history-actions {
    opacity: 1;
}

/* ========== 右側 AI 聊天面板 ========== */
.chat-toggle-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-toggle-btn .btn-icon-circle {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
    z-index: 2;
    transition: all 0.3s;
}

.chat-toggle-btn .btn-text-label {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-left: none;
    border-radius: 0 0.75rem 0.75rem 0;
    padding: 0.6rem 1rem 0.6rem 0.75rem;
    margin-left: -8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
}

.chat-toggle-btn:hover {
    transform: translateY(-3px);
}

.chat-toggle-btn:hover .btn-icon-circle {
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.chat-toggle-btn:hover .btn-text-label {
    border-color: var(--accent-blue);
    background: var(--bg-card-hover);
}

.chat-sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 380px;
    min-width: 320px;
    max-width: 600px;
    height: 100vh;
    background: var(--bg-card);
    backdrop-filter: var(--blur-card);
    border-left: 1px solid var(--border-subtle);
    z-index: 1100;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-soft);
}

.chat-sidebar.open {
    right: 0;
}

/* Edge Controls on left side of panel */
.chat-edge-controls {
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 10;
}

.edge-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.edge-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    transform: scale(1.1);
}

#btnResizeChat {
    cursor: ew-resize;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(90deg, rgba(124, 77, 255, 0.1) 0%, transparent 100%);
}

.title-toggle {
    font-weight: 600;
    color: var(--text-primary);
}

.mode-toggle {
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    padding: 0.25rem;
}

.mode-btn {
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.mode-btn:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.mode-btn.active {
    background: var(--gradient-primary);
    color: white;
}

.mode-hint {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-subtle);
}

.ai-mode-controls {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.ai-mode-controls.hidden {
    display: none;
}

.source-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.source-selector label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.source-selector select {
    flex: 1;
    padding: 0.4rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.preset-prompts {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Note Content Area */
.note-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.note-content.hidden {
    display: none;
}

.note-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 213, 79, 0.1);
    border-left: 3px solid #ffd54f;
    border-radius: 0 0.5rem 0.5rem 0;
    font-size: 0.9rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.chat-messages.hidden {
    display: none;
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    animation: fadeInUp 0.3s ease;
}

.chat-message:last-child {
    margin-bottom: 0;
}

.chat-message .avatar {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.chat-message .message {
    background: rgba(92, 107, 192, 0.1);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    max-width: 85%;
    line-height: 1.5;
    font-size: 0.9rem;
    border: 1px solid var(--border-subtle);
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message.user .message {
    background: var(--gradient-primary);
    color: white;
    border: none;
}

.chat-message.loading .message {
    color: var(--text-muted);
    font-style: italic;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.2);
}

.chat-input-area textarea {
    width: 100%;
    min-height: 60px;
    max-height: 120px;
    resize: vertical;
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.5;
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: var(--accent-purple);
}

.chat-input-area textarea::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== 響應式設計 ========== */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .sidebar {
        width: 100%;
        left: -100%;
    }

    .chat-sidebar {
        width: 100%;
        right: -100%;
    }

    .sidebar-toggle-btn,
    .chat-toggle-btn {
        top: 0.5rem;
    }
}

/* ========== 分隔線 ========== */
.divider-vertical {
    width: 1px;
    height: 24px;
    background: var(--border-subtle);
    margin: 0 0.5rem;
}

/* ========== 控制面板下拉選單 ========== */
.control-select {
    padding: 0.6rem 2rem 0.6rem 1rem;
    /* Extra padding for arrow */
    background: rgba(92, 107, 192, 0.1);
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='%239fa8da'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%239fa8da' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
}

.control-select:hover {
    background-color: rgba(92, 107, 192, 0.15);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.control-select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.15);
}

.control-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: rgba(0, 0, 0, 0.1);
}

.control-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 10px;
}

/* ========== Debug Timeline (Temporary) ========== */
.debug-timeline-section {
    background: rgba(20, 25, 45, 0.9);
    border: 1px solid rgba(255, 100, 100, 0.3);
}

.debug-timeline-section h2 {
    color: #ff6b6b;
}

.debug-timeline-canvas-wrap {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}

#debugTimelineCanvas {
    display: block;
    min-width: 100%;
    height: 80px;
}

.debug-transcript-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.debug-transcript-item {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.5rem;
    padding: 0.75rem;
    border-left: 3px solid var(--accent-blue);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.debug-transcript-item .debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    color: var(--accent-cyan);
}

.debug-transcript-item .debug-header .segment-id {
    font-weight: 600;
    color: #ff6b6b;
}

.debug-transcript-item .debug-header .time-info {
    color: var(--text-secondary);
}

.debug-transcript-item .debug-result {
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.debug-transcript-item .debug-result.error {
    color: #ff6b6b;
}

.debug-transcript-item .debug-result.pending {
    color: var(--text-muted);
    font-style: italic;
}

/* ========== API Key Button & Modal ========== */
.btn-api-key {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.25s;
}

.btn-api-key:hover {
    background: rgba(100, 150, 200, 0.15);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.btn-api-key.has-key {
    background: rgba(105, 240, 174, 0.15);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

/* Modal Overlay */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.modal.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal Content */
.modal-content {
    background: var(--bg-card);
    backdrop-filter: var(--blur-card);
    border: 2px solid var(--border-subtle);
    border-radius: 1.25rem;
    width: 90%;
    max-width: 450px;
    box-shadow: var(--shadow-card), 0 0 60px rgba(100, 150, 200, 0.2);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.modal-body .input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.modal-body .input-group input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    transition: all 0.25s;
}

.modal-body .input-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(92, 107, 192, 0.15);
}

.api-key-status {
    font-size: 0.85rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    text-align: center;
}

.api-key-status.success {
    color: var(--accent-green);
    background: rgba(105, 240, 174, 0.1);
}

.api-key-status.error {
    color: #ff8a80;
    background: rgba(255, 82, 82, 0.1);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
}