/* ── Chat View ── */

/* Genel .content-area kurali padding: 8px 20px (20px yan bosluk). Chat eskiden
   bunu padding:0 ile silip ekran kenarina dayaniyordu ("yanlardan uzuyor").
   Navbar-alti bosluk diger tum sayfalardaki gibi 8px (Takip Edilenler referansi);
   yan 20px korunur, alt 0 (full-height). chat-container yuksekligi de 8px kisilir. */
.content-area.chat-active {
	padding: 8px 20px 0;
}

.chat-container {
	max-width: 100%;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	/* Parent .content-area icerik yuksekligi = calc(100vh - 50px) eksi 8px ust padding
	   (navbar-alti standart bosluk). Birebir esitlenmezse dikey scrollbar/tasma olur. */
	height: calc(100vh - 58px);
	width: 100%;
}

/* ── Header ── */

.chat-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background: #15171c;
	border-bottom: 1px solid rgba(255,255,255,0.06);
	flex-shrink: 0;
	position: sticky;
	top: 0;
	z-index: 10;
}

/* Sol/sag bolge esit esner (flex:1); orta bolge (sekmeler) tam ortada kalir */
.chat-header-side {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	overflow: hidden;
}
.chat-header-left {
	justify-content: flex-start;
}
.chat-header-right {
	justify-content: flex-end;
}

/* Orta bolge: Chat/Timeline sekmeleri yan yana */
.chat-header-tabs {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 4px;
	white-space: nowrap;
}

.chat-header-back {
	color: #7a8290;
	cursor: pointer;
	font-size: 13px;
	transition: color 0.15s;
	white-space: nowrap;
}
.chat-header-back:hover {
	color: #2a9fd6;
}

.chat-header-title {
	min-width: 0;
	font-size: 14px;
	font-weight: 600;
	color: #e1e4e8;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.chat-header-meta {
	font-size: 11px;
	color: #6b7280;
	white-space: nowrap;
}

.chat-header-date {
	font-size: 11px;
	color: #555b66;
	white-space: nowrap;
}

/* ── Messages area ── */

.chat-messages-area {
	flex: 1;
	overflow-y: auto;
	padding: 16px 0 44px 16px;
}

/* ── Time separator ── */

.chat-time-sep {
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 20px 0 14px;
}
.chat-time-sep-pill {
	background: rgba(255,255,255,0.05);
	color: #6b7280;
	font-size: 10px;
	font-weight: 500;
	padding: 3px 12px;
	border-radius: 10px;
	letter-spacing: 0.3px;
}

/* ── Message row ── */

.chat-message {
	display: flex !important;
	align-items: flex-start;
	margin-bottom: 3px;
}
.chat-message.left {
	justify-content: flex-start;
	padding-right: 24px;
}
.chat-message.right {
	justify-content: flex-end;
	padding-left: 24px;
}

/* ── Message group first (has avatar + name) ── */

.chat-message.group-first {
	margin-top: 10px;
}

/* ── Bubble wrap ── */

.chat-bubble-wrap {
	max-width: 85%;
	min-width: 100px;
	cursor: pointer;
}

/* ── Meta (speaker name + time) ── */

.chat-meta {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 2px;
	padding: 0 2px;
}
.chat-meta-name {
	font-size: 11px;
	font-weight: 600;
}
.chat-meta-time {
	font-size: 10px;
	color: #4b5563;
}
.chat-message.right .chat-meta {
	justify-content: flex-end;
}

.chat-meta-name.color-0 { color: #60a5fa; }
.chat-meta-name.color-1 { color: #4ade80; }
.chat-meta-name.color-2 { color: #fbbf24; }
.chat-meta-name.color-3 { color: #f87171; }
.chat-meta-name.color-4 { color: #22d3ee; }
.chat-meta-name.color-5 { color: #fb923c; }

/* ── Bubble ── */

.chat-bubble {
	padding: 8px 12px;
	border-radius: 12px;
	font-size: 13px;
	line-height: 1.5;
	color: #e1e4e8;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

/* Left bubbles */
.chat-message.left .chat-bubble {
	background: #1e2028;
	border-top-left-radius: 4px;
}
.chat-message.left .chat-bubble.continued {
	border-top-left-radius: 4px;
	border-bottom-left-radius: 4px;
}
.chat-message.left .chat-bubble.group-last {
	border-bottom-left-radius: 12px;
}

/* Right bubbles */
.chat-message.right .chat-bubble {
	background: #1a3a4a;
	border-top-right-radius: 4px;
}
.chat-message.right .chat-bubble.continued {
	border-top-right-radius: 4px;
	border-bottom-right-radius: 4px;
}
.chat-message.right .chat-bubble.group-last {
	border-bottom-right-radius: 12px;
}

/* ── Bubble color accents (subtle top-border on first msg in group) ── */

.chat-bubble.color-0 { border-top: 2px solid rgba(59,130,246,0.3); }
.chat-bubble.color-1 { border-top: 2px solid rgba(34,197,94,0.3); }
.chat-bubble.color-2 { border-top: 2px solid rgba(245,158,11,0.3); }
.chat-bubble.color-3 { border-top: 2px solid rgba(239,68,68,0.3); }
.chat-bubble.color-4 { border-top: 2px solid rgba(6,182,212,0.3); }
.chat-bubble.color-5 { border-top: 2px solid rgba(232,112,64,0.3); }

.chat-bubble.continued {
	border-top: none;
}

/* ── Inline time (bottom-right in bubble) ── */

.chat-bubble-time {
	float: right;
	font-size: 9px;
	color: #4b5563;
	margin: 4px 0 -2px 10px;
	white-space: nowrap;
}

/* ── Empty state ── */

.chat-empty {
	text-align: center;
	color: #555b66;
	padding: 64px 16px;
	font-size: 14px;
}
.chat-empty .glyphicon {
	font-size: 36px;
	display: block;
	margin-bottom: 14px;
	color: #333a44;
}

/* ── Tabs (header ici) ── */

/* Chat/Timeline sekmeleri header'in orta bolgesinde. Kompakt; aktif sekme alt
   cizgiyle isaretlenir. */
.chat-tab {
	display: inline-block;
	padding: 4px 12px;
	font-size: 12px;
	font-weight: 500;
	color: #6b7280;
	cursor: pointer;
	border-bottom: 2px solid transparent;
	transition: color 0.15s, border-color 0.15s;
}
.chat-tab:hover {
	color: #e1e4e8;
}
.chat-tab.active {
	color: #2a9fd6;
	border-bottom-color: #2a9fd6;
}

/* ── Analysis Nav Bar (compact, single line) ── */

.chat-analysis-nav {
	/* Ayri satir: kendi bar arkaplani/border'i. Ortalama Wt setContentAlignment ile
	   (text-align:center); badge'ler inline-flex oldugundan ortalanir ve sayi artinca
	   alt satira sararken ortali kalir. Label yoksa C++ tarafinda gizlenir. */
	display: block;
	background: #15171c;
	border-bottom: 1px solid rgba(255,255,255,0.06);
	flex-shrink: 0;
	margin: 0;
	padding: 4px 16px;
}

.analysis-nav-btn {
	font-size: 12px !important;
	padding: 2px 10px !important;
	border-radius: 12px !important;
	border: 1px solid rgba(255,255,255,0.12) !important;
}

.analysis-nav-btn.score-green  { background: rgba(34,197,94,0.15) !important; color: #4ade80 !important; }
.analysis-nav-btn.score-yellow { background: rgba(234,179,8,0.15) !important; color: #facc15 !important; }
.analysis-nav-btn.score-orange { background: rgba(249,115,22,0.15) !important; color: #fb923c !important; }
.analysis-nav-btn.score-red    { background: rgba(239,68,68,0.15) !important; color: #f87171 !important; }

/* ── Timeline area ── */

.chat-timeline-area {
	flex: 1;
	overflow-y: auto;
	padding: 8px 16px 44px;
}

/* ── Timeline row ── */

.tl-row {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 6px 8px;
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.12s;
}
.tl-row:hover {
	background: rgba(42,159,214,0.08);
}

.tl-time {
	flex-shrink: 0;
	width: 90px;
	font-size: 11px;
	color: #6b7280;
	font-family: monospace;
	padding-top: 2px;
}

.tl-speaker {
	flex-shrink: 0;
	width: 100px;
}

.tl-text {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	font-size: 13px;
	color: #d1d5db;
	line-height: 1.5;
	word-wrap: break-word;
}

/* Analiz badge'leri: metnin ALTINDA ayri bir satirda (yaninda degil) */
.tl-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 4px;
}

/* ── Body row (minimap + messages) ── */

.chat-body-row {
	display: flex;
	flex: 1;
	min-height: 0;
	overflow: hidden;
}

/* ── Minimap ── */

.chat-minimap {
	width: 40px;
	flex-shrink: 0;
	overflow: hidden;
	position: relative;
	background: rgba(0,0,0,0.2);
	border-right: 1px solid rgba(255,255,255,0.06);
	cursor: pointer;
	display: flex;
	flex-direction: column;
}

.mm-block {
	position: absolute;
	left: 0;
	right: 0;
	min-height: 2px;
}
.mm-block.color-0 { background: rgba(96,165,250,0.25); }
.mm-block.color-1 { background: rgba(74,222,128,0.25); }
.mm-block.color-2 { background: rgba(251,191,36,0.25); }
.mm-block.color-3 { background: rgba(248,113,113,0.25); }
.mm-block.color-4 { background: rgba(34,211,238,0.25); }
.mm-block.color-5 { background: rgba(251,146,60,0.25); }

/* Zaman ayirici minimap blogu: renk/dot yok, yalnizca ince ayrac cizgisi */
.mm-block.mm-sep {
	background: transparent;
	border-top: 1px solid rgba(255,255,255,0.08);
}

.mm-dot {
	position: absolute;
	right: 4px;
	top: 50%;
	transform: translateY(-50%);
	width: 7px;
	height: 7px;
	border-radius: 50%;
	cursor: pointer;
}
.mm-dot:hover {
	transform: translateY(-50%) scale(1.45);
}
.mm-dot.hl-topic    { background: #3b82f6; }
.mm-dot.hl-person   { background: #22c55e; }
.mm-dot.hl-attitude { background: #f59e0b; }

.mm-viewport {
	position: absolute;
	left: 0;
	right: 0;
	background: rgba(255,255,255,0.08);
	border: 1px solid rgba(255,255,255,0.15);
	pointer-events: none;
	transition: top 0.1s;
}

/* ── Timeline row highlights ── (sol kenarlik yok; hafif arkaplan tonu) */

.tl-row.hl-topic    { background: rgba(59,130,246,0.10); }
.tl-row.hl-person   { background: rgba(34,197,94,0.10); }
.tl-row.hl-attitude { background: rgba(245,158,11,0.10); }

/* ── Evidence highlight ── (kategori renkli: dot rengiyle birebir uyum)
   Solid blok yerine dusuk opaklik zemin + kategori renginde alt cizgi;
   metin rengi korunur, okunabilir kalir, goz yormaz. */

mark.hl-ev {
	background: transparent;
	color: inherit;
	border-radius: 2px;
	padding: 0 1px;
	box-decoration-break: clone;
	-webkit-box-decoration-break: clone;
}
mark.hl-ev.hl-topic {
	background: rgba(59,130,246,0.18);
	border-bottom: 2px solid #3b82f6;
}
mark.hl-ev.hl-person {
	background: rgba(34,197,94,0.18);
	border-bottom: 2px solid #22c55e;
}
mark.hl-ev.hl-attitude {
	background: rgba(245,158,11,0.18);
	border-bottom: 2px solid #f59e0b;
}

/* ── Score badge ── */

.hl-badge {
	font-size: 10px;
	padding: 1px 6px;
	border-radius: 8px;
	margin-top: 2px;
	display: inline-block;
}
.hl-badge.hl-topic    { background: rgba(59,130,246,0.15); color: #60a5fa; }
.hl-badge.hl-person   { background: rgba(34,197,94,0.15);  color: #4ade80; }
.hl-badge.hl-attitude { background: rgba(245,158,11,0.15); color: #fbbf24; }

/* ── Analysis nav badge'leri (kart + buton) ── */

.analysis-nav-card {
	display: inline-flex; /* inline -> text-align:center ile ortalanir ve sarar */
	align-items: center;
	gap: 4px;
	margin: 2px 3px;	  /* yatay aralik + sarinca dikey aralik */
	padding: 0;
	border: none;
	background: transparent;
	vertical-align: middle;
}

.analysis-nav-btn {
	font-size: 12px !important;
	padding: 2px 10px !important;
	border-radius: 12px !important;
	border: 1px solid rgba(255,255,255,0.12) !important;
	white-space: nowrap;
}

.analysis-nav-btn.score-green  { background: rgba(34,197,94,0.15) !important; color: #4ade80 !important; }
.analysis-nav-btn.score-yellow { background: rgba(234,179,8,0.15) !important; color: #facc15 !important; }
.analysis-nav-btn.score-orange { background: rgba(249,115,22,0.15) !important; color: #fb923c !important; }
.analysis-nav-btn.score-red    { background: rgba(239,68,68,0.15) !important; color: #f87171 !important; }

/* Kategori renkli nav badge'leri (dot/highlight ile ayni dil) */
.analysis-nav-btn.hl-topic    { background: rgba(59,130,246,0.15) !important; color: #60a5fa !important; }
.analysis-nav-btn.hl-person   { background: rgba(34,197,94,0.15)  !important; color: #4ade80 !important; }
.analysis-nav-btn.hl-attitude { background: rgba(245,158,11,0.15) !important; color: #fbbf24 !important; }

/* Her kategoriye ayri renk paleti (cat-c0..c9). C++ her topic_name'e sirayla
   bir index atar; renkler birbirinden ayrik, mor/lila yok, koyu tema dostu. */
.analysis-nav-btn.cat-c0 { background: rgba(59,130,246,0.15) !important; color: #60a5fa !important; }
.analysis-nav-btn.cat-c1 { background: rgba(34,197,94,0.15)  !important; color: #4ade80 !important; }
.analysis-nav-btn.cat-c2 { background: rgba(245,158,11,0.15) !important; color: #fbbf24 !important; }
.analysis-nav-btn.cat-c3 { background: rgba(239,68,68,0.15)  !important; color: #f87171 !important; }
.analysis-nav-btn.cat-c4 { background: rgba(34,211,238,0.15) !important; color: #22d3ee !important; }
.analysis-nav-btn.cat-c5 { background: rgba(249,115,22,0.15) !important; color: #fb923c !important; }
.analysis-nav-btn.cat-c6 { background: rgba(163,230,53,0.15) !important; color: #a3e635 !important; }
.analysis-nav-btn.cat-c7 { background: rgba(45,212,191,0.15) !important; color: #2dd4bf !important; }
.analysis-nav-btn.cat-c8 { background: rgba(244,114,182,0.15)!important; color: #f472b6 !important; }
.analysis-nav-btn.cat-c9 { background: rgba(234,179,8,0.15)  !important; color: #facc15 !important; }

/* Metin ici highlight'lar da ayni per-topic paleti kullanir (nav badge ile ayni
   renk dili). C++ tarafinda topic_color_index() her topic_name'e bir cat-c index
   verir; boylece cogu etiket "attitude" olsa bile her ayri konu ayri renge duser
   ve "her sey sari" tekduzeligi kalkar. Mark / badge / timeline satiri / dot. */
mark.hl-ev.cat-c0 { background: rgba(59,130,246,0.18); border-bottom: 2px solid #3b82f6; }
mark.hl-ev.cat-c1 { background: rgba(34,197,94,0.18);  border-bottom: 2px solid #22c55e; }
mark.hl-ev.cat-c2 { background: rgba(245,158,11,0.18); border-bottom: 2px solid #f59e0b; }
mark.hl-ev.cat-c3 { background: rgba(239,68,68,0.18);  border-bottom: 2px solid #ef4444; }
mark.hl-ev.cat-c4 { background: rgba(34,211,238,0.18); border-bottom: 2px solid #22d3ee; }
mark.hl-ev.cat-c5 { background: rgba(249,115,22,0.18); border-bottom: 2px solid #f97316; }
mark.hl-ev.cat-c6 { background: rgba(163,230,53,0.18); border-bottom: 2px solid #a3e635; }
mark.hl-ev.cat-c7 { background: rgba(45,212,191,0.18); border-bottom: 2px solid #2dd4bf; }
mark.hl-ev.cat-c8 { background: rgba(244,114,182,0.18);border-bottom: 2px solid #f472b6; }
mark.hl-ev.cat-c9 { background: rgba(234,179,8,0.18);  border-bottom: 2px solid #eab308; }

.hl-badge.cat-c0 { background: rgba(59,130,246,0.15); color: #60a5fa; }
.hl-badge.cat-c1 { background: rgba(34,197,94,0.15);  color: #4ade80; }
.hl-badge.cat-c2 { background: rgba(245,158,11,0.15); color: #fbbf24; }
.hl-badge.cat-c3 { background: rgba(239,68,68,0.15);  color: #f87171; }
.hl-badge.cat-c4 { background: rgba(34,211,238,0.15); color: #22d3ee; }
.hl-badge.cat-c5 { background: rgba(249,115,22,0.15); color: #fb923c; }
.hl-badge.cat-c6 { background: rgba(163,230,53,0.15); color: #a3e635; }
.hl-badge.cat-c7 { background: rgba(45,212,191,0.15); color: #2dd4bf; }
.hl-badge.cat-c8 { background: rgba(244,114,182,0.15);color: #f472b6; }
.hl-badge.cat-c9 { background: rgba(234,179,8,0.15);  color: #facc15; }

.tl-row.cat-c0 { background: rgba(59,130,246,0.10); }
.tl-row.cat-c1 { background: rgba(34,197,94,0.10); }
.tl-row.cat-c2 { background: rgba(245,158,11,0.10); }
.tl-row.cat-c3 { background: rgba(239,68,68,0.10); }
.tl-row.cat-c4 { background: rgba(34,211,238,0.10); }
.tl-row.cat-c5 { background: rgba(249,115,22,0.10); }
.tl-row.cat-c6 { background: rgba(163,230,53,0.10); }
.tl-row.cat-c7 { background: rgba(45,212,191,0.10); }
.tl-row.cat-c8 { background: rgba(244,114,182,0.10); }
.tl-row.cat-c9 { background: rgba(234,179,8,0.10); }

.mm-dot.cat-c0 { background: #3b82f6; }
.mm-dot.cat-c1 { background: #22c55e; }
.mm-dot.cat-c2 { background: #f59e0b; }
.mm-dot.cat-c3 { background: #ef4444; }
.mm-dot.cat-c4 { background: #22d3ee; }
.mm-dot.cat-c5 { background: #f97316; }
.mm-dot.cat-c6 { background: #a3e635; }
.mm-dot.cat-c7 { background: #2dd4bf; }
.mm-dot.cat-c8 { background: #f472b6; }
.mm-dot.cat-c9 { background: #eab308; }

/* Cakisma: birden fazla konu ayni metni kapliyor. Her konunun rengi C++ tarafinca
   uretilen inline background-image gradient'leri ile AYRI bir alt cizgi olarak ust
   uste cizilir (aralik/konum/yukseklik inline gelir). Burada yalnizca notr zemin
   ve tek-renk border'in kapatilmasi var — renkler tamamen inline'dan gelir. */
mark.hl-ev.hl-multi {
	border-bottom: none;
	background-color: rgba(148, 163, 184, 0.12);
}

/* ── Scrollbar (both areas) ── */

.chat-messages-area::-webkit-scrollbar,
.chat-timeline-area::-webkit-scrollbar {
	width: 5px;
}
.chat-messages-area::-webkit-scrollbar-track,
.chat-timeline-area::-webkit-scrollbar-track {
	background: transparent;
}
.chat-messages-area::-webkit-scrollbar-thumb,
.chat-timeline-area::-webkit-scrollbar-thumb {
	background: rgba(255,255,255,0.08);
	border-radius: 3px;
}
.chat-messages-area::-webkit-scrollbar-thumb:hover,
.chat-timeline-area::-webkit-scrollbar-thumb:hover {
	background: rgba(255,255,255,0.14);
}

/* ── Mobil (≤760px) ── */
/* Genel .content-area mobilde padding: 10px 10px 92px 10px (alt sabit nav payi).
   chat-active onu eziyordu; burada yan boslugu koruyup chat'i alt navin altinda
   kalmayacak sekilde kisaltiyoruz. Mobilde ust navbar gizli oldugu icin
   yukseklikten yalnizca alt nav payi (~92px) dusulur. */
@media (max-width: 760px) {
	.content-area.chat-active {
		padding: 0 10px !important;
	}

	.chat-container {
		height: calc(100vh - 92px);
	}
}

/* ── Segment seçim/export toolbar'ı (chat + timeline ortak) ──
   Yerleşim/boyut WHBoxLayout ile C++ tarafında yapılır; burası yalnız renk/tema. */
.chat-export-bar {
	background: #15171c;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	flex-shrink: 0;
}
.chat-export-selall {
	font-size: 12px;
	color: #cbd5e1;
}
.chat-export-count {
	font-size: 12px;
	color: #9ca3af;
}

/* Seçim kutucukları — accent rengi tema mavisi */
.tl-select-cb,
.chat-select-cb {
	accent-color: #2a9fd6;
	flex-shrink: 0;
}
.tl-select-cb {
	margin-top: 3px;
}
.chat-select-cb {
	margin: 4px 6px 0 0;
}

/* İndirme dialog'undaki tam-genişlik indirme butonları */
.export-dl-btn {
	display: block;
	width: 100%;
	text-align: left;
}
.export-dl-btn:hover {
	background: rgba(42, 159, 214, 0.12);
}
