:root {
    --bg-body: #09090b; --bg-sidebar: #121215; --bg-card: #1c1c1f; --bg-input: #27272a;
    --bg-dock: rgba(18, 18, 21, 0.90); --border: #2e2e33; --primary: #3b82f6; 
    --primary-dim: rgba(59, 130, 246, 0.15); --success: #10b981; --danger: #ef4444; --warning: #f59e0b;
    --text-main: #f4f4f5; --text-muted: #a1a1aa; --shadow-dock: 0 20px 40px -10px rgba(0,0,0,0.6);
    --font-ui: 'Inter', sans-serif; --font-mono: 'JetBrains Mono', monospace;
    --sidebar-w: 280px; --dock-h: 80px;
}
[data-theme="light"] {
    --bg-body: #f8fafc; --bg-sidebar: #ffffff; --bg-card: #ffffff; --bg-input: #f1f5f9;
    --bg-dock: rgba(255, 255, 255, 0.90); --border: #e2e8f0; --text-main: #0f172a; --text-muted: #64748b;
}

* { box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg-body); color: var(--text-main); font-family: var(--font-ui); height: 100dvh; overflow: hidden; font-size: 13px; line-height: 1.5; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.app-layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr var(--sidebar-w); height: 100%; width: 100%; }

/* Sidebars */
.sidebar { background: var(--bg-sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 20; transition: transform 0.3s ease; }
.sidebar.right { border-right: none; border-left: 1px solid var(--border); }
.sidebar-header { height: 60px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 32px; height: 32px; background: var(--primary); color: #fff; border-radius: 8px; display: grid; place-items: center; font-size: 16px; }
.brand-text h1 { margin: 0; font-size: 14px; font-weight: 700; }
.brand-text span { font-size: 10px; color: var(--text-muted); display: block; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 24px 20px; scrollbar-width: thin; }

/* Prompt Templates */
.template-selector { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.tpl-btn { flex: 1; background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted); padding: 4px 8px; font-size: 11px; border-radius: 6px; cursor: pointer; transition: 0.2s; white-space: nowrap; }
.tpl-btn:hover, .tpl-btn.active { background: var(--primary-dim); color: var(--primary); border-color: var(--primary); }

/* Inputs */
.panel-section { margin-bottom: 32px; }
.section-title { font-size: 10px; font-weight: 700; color: var(--text-muted); margin-bottom: 12px; }
.input-group { position: relative; margin-bottom: 12px; }
.input-group i { position: absolute; left: 12px; top: 11px; color: var(--text-muted); font-size: 13px; pointer-events: none; }
select, textarea { width: 100%; background: var(--bg-input); border: 1px solid var(--border); color: var(--text-main); border-radius: 8px; padding: 10px 10px 10px 36px; font-family: inherit; font-size: 13px; transition: 0.2s; }
select:focus, textarea:focus { border-color: var(--primary); }
textarea { min-height: 80px; resize: vertical; padding-top: 10px; }

/* Toggles & Ranges */
.switch-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.toggle { position: relative; width: 36px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background-color: var(--border); transition: .3s; border-radius: 20px; cursor: pointer; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(16px); }
.range-group { margin-bottom: 20px; }
.range-header { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 11px; color: var(--text-muted); }
input[type=range] { width: 100%; height: 4px; background: var(--border); border-radius: 2px; accent-color: var(--primary); cursor: pointer; }

/* Stage */
.stage { display: flex; flex-direction: column; background: var(--bg-body); position: relative; height: 100dvh; overflow: hidden; }
.stage-header { height: 60px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); background: var(--bg-body); z-index: 10; }
.header-title { font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--text-main); }
.header-actions { display: flex; gap: 8px; align-items: center; }
.action-btn { background: transparent; border: 1px solid var(--border); color: var(--text-muted); padding: 6px 12px; border-radius: 6px; font-size: 12px; cursor: pointer; transition: 0.2s; }
.action-btn:hover, .action-btn.active { background: var(--bg-input); color: var(--text-main); border-color: var(--text-muted); }
.action-btn.danger:hover { background: rgba(239, 68, 68, 0.1); color: var(--danger); border-color: var(--danger); }
.sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }

/* Transcript Area */
.transcript-container { display: flex; flex-direction: column; flex: 1; width: 100%; min-height: 0; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; padding: 24px; padding-bottom: 160px; }
.speaker-row { display: flex; gap: 16px; margin-bottom: 24px; width: 100%; max-width: 900px; margin-left: auto; margin-right: auto; flex-shrink: 0; animation: slideUp 0.3s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.avatar-box { width: 42px; height: 42px; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; position: relative; cursor: pointer; transition: transform 0.2s; box-shadow: var(--shadow-card); }
.avatar-box:hover { transform: scale(1.05); }
.emo-tag { position: absolute; bottom: -6px; right: -6px; font-size: 14px; background: var(--bg-body); border-radius: 50%; padding: 2px; }
.msg-content { flex: 1; min-width: 0; }
.msg-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.spk-label { font-weight: 700; font-size: 13px; cursor: pointer; }
.time-label { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); opacity: 0.7; }

/* --- BUBBLE & WORDS (CORE FEATURES) --- */
.bubble { background: var(--bg-card); padding: 12px 16px; border-radius: 4px 16px 16px 16px; color: var(--text-main); line-height: 1.7; font-size: 14px; border: 1px solid var(--border); border-left: 3px solid transparent; transition: 0.3s; }
.bubble.hallucination { opacity: 0.5; border-style: dashed; }

/* Word Spans */
.w { border-radius: 3px; padding: 0 1px; transition: all 0.15s ease; cursor: default; }

/* KARAOKE MODE */
.transcript-container.karaoke-mode .w.active-word { 
    background: var(--primary); color: #fff; box-shadow: 0 0 10px var(--primary); 
    transform: scale(1.1); display: inline-block; 
}

/* HEATMAP MODE */
.transcript-container.heatmap-mode .w[data-conf="low"] { color: var(--danger); text-decoration: underline wavy var(--danger); }
.transcript-container.heatmap-mode .w[data-conf="mid"] { color: var(--warning); }
/* Hover details */
.w:hover { background: var(--bg-input); position: relative; }
.w:hover:after {
    content: attr(data-prob); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    background: #000; color: #fff; padding: 2px 6px; font-size: 10px; border-radius: 4px; pointer-events: none;
    font-family: var(--font-mono); white-space: nowrap; margin-bottom: 4px;
}

/* Features Row */
.features-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; opacity: 0.8; }
.mini-player { background: var(--bg-input); padding: 4px 10px; border-radius: 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); }
.player-btn { background: none; border: none; color: var(--text-main); cursor: pointer; font-size: 11px; padding: 2px 4px; transition: 0.2s; }
.player-btn:hover { color: var(--primary); }
.wave-vis { display: flex; gap: 2px; align-items: center; height: 12px; }
.wave-line { width: 2px; background: var(--text-muted); border-radius: 1px; }
.prosody-item { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-muted); }
.bar-track { width: 40px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 2px; }

/* Dock */
.dock-wrapper { position: fixed; bottom: 30px; left: 0; right: 0; display: flex; justify-content: center; pointer-events: none; z-index: 50; padding: 0 20px; padding-bottom: env(safe-area-inset-bottom); }
.dock { width: 100%; max-width: 640px; height: var(--dock-h); pointer-events: auto; background: var(--bg-dock); backdrop-filter: blur(24px); border: 1px solid rgba(255,255,255,0.08); border-radius: 24px; box-shadow: var(--shadow-dock); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: relative; overflow: hidden; }
#audioVisualizer { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.2; pointer-events: none; z-index: 0; }
.dock-left, .dock-right { display: flex; gap: 12px; z-index: 2; flex: 1; }
.dock-right { justify-content: flex-end; }
.dock-left { justify-content: flex-start; }
.dock-center { position: relative; z-index: 2; display: flex; justify-content: center; flex-direction: column; align-items: center; flex: 0 0 auto; }

.record-fab { width: 68px; height: 68px; border-radius: 50%; background: var(--text-main); color: var(--bg-body); font-size: 24px; border: none; cursor: pointer; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(0,0,0,0.15); transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; }
.record-fab:hover { transform: scale(1.05); }
.record-fab.recording { background: var(--danger); color: white; border-radius: 24px; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }

.timer-pill { position: absolute; top: -48px; background: var(--bg-dock); border: 1px solid var(--danger); color: var(--danger); padding: 6px 12px; border-radius: 20px; font-family: var(--font-mono); font-size: 13px; font-weight: 700; opacity: 0; transition: 0.3s; transform: translateY(10px) scale(0.9); box-shadow: 0 4px 12px rgba(0,0,0,0.3); pointer-events: none; }
.record-fab.recording + .timer-pill, .timer-pill.active { opacity: 1; transform: translateY(0) scale(1); }

/* Accordion & Overlays */
.accordion-header { width: 100%; text-align: left; background: var(--bg-input); border: 1px solid var(--border); padding: 10px 12px; font-size: 11px; font-weight: 700; color: var(--text-muted); border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; transition: 0.2s; }
.accordion-header:hover { background: var(--border); color: var(--text-main); }
.accordion-content { display: none; padding: 0 4px; animation: slideDown 0.3s ease; }
.accordion-content.active { display: block; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 45; opacity: 0; pointer-events: none; transition: 0.3s; backdrop-filter: blur(4px); }
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }

/* Metrics & Misc */
.empty-placeholder { text-align: center; margin-top: 20vh; color: var(--text-muted); opacity: 0.7; }
.placeholder-icon { font-size: 32px; color: var(--primary); margin-bottom: 16px; }
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.metric-box { background: var(--bg-input); padding: 12px; border-radius: 10px; border: 1px solid var(--border); }
.m-label { font-size: 10px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.m-val { font-family: var(--font-mono); font-size: 14px; font-weight: 600; }
.json-panel pre { background: #000; padding: 12px; border-radius: 8px; font-family: var(--font-mono); font-size: 10px; color: #10b981; overflow: auto; border: 1px solid var(--border); height: 200px; }
.metric-hero { text-align: center; padding: 24px; background: linear-gradient(135deg, var(--bg-input), var(--bg-card)); border-radius: 12px; border: 1px solid var(--border); margin-bottom: 16px; }
.m-value-lg { font-size: 32px; font-weight: 800; color: var(--primary); letter-spacing: -1px; }

/* Mobile */
.mobile-nav { display: none; }
.mobile-only { display: none !important; }
@media (max-width: 768px) {
    .app-layout { display: block; }
    .desktop-only { display: none !important; }
    .mobile-only { display: block !important; }
    .mobile-nav { display: flex; justify-content: space-between; align-items: center; padding: 0 16px; height: 56px; background: var(--bg-body); border-bottom: 1px solid var(--border); position: fixed; top: 0; left: 0; right: 0; z-index: 40; }
    .nav-btn { background: none; border: none; font-size: 18px; color: var(--text-main); }
    .sidebar { position: fixed; inset: 0; width: 85%; transform: translateX(-100%); transition: transform 0.3s; z-index: 100; border: none; }
    .sidebar.right { transform: translateX(100%); left: auto; right: 0; }
    .sidebar.active { transform: translateX(0); box-shadow: 0 0 50px rgba(0,0,0,0.8); }
    .stage { padding-top: 56px; }
    .transcript-container { padding: 16px; padding-bottom: 120px; }
    .dock-wrapper { bottom: 16px; padding: 0 16px; }
    .dock { width: 100%; height: 68px; padding: 0 16px; border-radius: 20px; }
    .record-fab { width: 52px; height: 52px; font-size: 20px; box-shadow: none; }
}

/* Record Button Animasyonu Güçlendirildi */
.record-fab.recording { 
    background: var(--danger); 
    color: white; 
    border-radius: 24px; 
    animation: pulse 1s infinite cubic-bezier(0.66, 0, 0, 1); 
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
}

@keyframes pulse { 
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); transform: scale(1); } 
    70% { box-shadow: 0 0 0 20px rgba(239, 68, 68, 0); transform: scale(1.1); } 
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); transform: scale(1); } 
}

/* Audio Visualizer daha belirgin */
#audioVisualizer { 
    position: absolute; inset: 0; width: 100%; height: 100%; 
    opacity: 0.6; /* 0.2'den artırıldı */
    pointer-events: none; z-index: 0; 
}

/* Highlight Language Selector */
.input-group.highlight-border {
    border: 1px solid var(--primary-dim);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.05);
}

/* DOCK BUTTONS - AKTİF DURUM (YENİ) */
.dock-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* VAD Butonu Aktifleşince (Yeşil Yanıp Sönme) */
.dock-btn.active {
    background: rgba(16, 185, 129, 0.15); /* Yeşil Transparan */
    color: #10b981;
    border-color: #10b981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.dock-btn.active .active-dot {
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: blink 1.5s infinite;
}

@keyframes blink { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }

/* Dosya Yükleme Butonu Hover */
.dock-btn:hover {
    transform: translateY(-2px);
    background: var(--bg-input);
    color: var(--text-main);
}

/* KELİME DÜZELTMESİ (Word Spacing Fix) */
/* Tokenlar arası boşlukları CSS ile yönetmek yerine JS ile birleştireceğiz */
.w {
    display: inline; /* inline-block yerine inline */
    margin: 0;
    padding: 0;
}