/* ==========================================================================
   Rich Hospital "İçindekiler" (TOC) - marka rengi: #17449e
   Minimal, sticky, scroll ile aktif başlığı vurgulayan panel.
   ========================================================================== */

:root {
	--rich-brand: #17449e;
	--rich-brand-dark: #0f3178;
	--rich-brand-soft: rgba(23, 68, 158, 0.08);
	--rich-text: #1c2433;
	--rich-text-muted: #6b7280;
	--rich-border: #e4e8ef;
	--rich-bg: #ffffff;
}

.richhospital-toc {
	--toc-width: 260px;
	font-family: inherit;
	box-sizing: border-box;
}
.richhospital-toc * {
	box-sizing: border-box;
}

/* ---- Masaüstü: sağda sabit, ince, minimal panel ---- */
.richhospital-toc-panel {
	position: fixed;
	top: 50%;
	right: 24px;
	transform: translateY(-50%);
	width: var(--toc-width);
	max-height: 70vh;
	background: var(--rich-bg);
	border: 1px solid var(--rich-border);
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(16, 30, 60, 0.09);
	z-index: 99998;
	overflow: hidden;
	display: none;
	flex-direction: column;
	transition: opacity 0.25s ease, transform 0.25s ease;
}
.richhospital-toc.is-ready .richhospital-toc-panel {
	display: flex;
}

.richhospital-toc-header {
	display: none; /* Masaüstünde gizli; mobilde bottom-sheet başlığı olarak görünür. */
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px;
	border-bottom: 1px solid var(--rich-border);
	flex: 0 0 auto;
}
.richhospital-toc-header-title {
	font-size: 13px;
	font-weight: 600;
	color: var(--rich-text);
}
.richhospital-toc-close {
	background: none;
	border: none;
	font-size: 20px;
	line-height: 1;
	color: var(--rich-text-muted);
	cursor: pointer;
	padding: 2px 4px;
}
.richhospital-toc-close:hover {
	color: var(--rich-brand);
}

.richhospital-toc-nav {
	padding: 14px 6px 14px 0;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	touch-action: pan-y;
	flex: 1 1 auto;
	min-height: 0;
	/* Panel içindeki kaydırmanın kendi bağımsız katmanında çalışmasını sağlar. */
	will-change: scroll-position;
}
.richhospital-toc-nav::-webkit-scrollbar {
	width: 4px;
}
.richhospital-toc-nav::-webkit-scrollbar-thumb {
	background: var(--rich-border);
	border-radius: 4px;
}

#richhospital-toc-list {
	list-style: none;
	margin: 0;
	padding: 0 0 0 14px;
	border-left: 2px solid var(--rich-border);
	touch-action: pan-y;
}

.richhospital-toc-item {
	margin: 0;
	touch-action: pan-y;
}
.richhospital-toc-item.level-3 .richhospital-toc-link {
	padding-left: 26px;
	font-size: 12.5px;
}

.richhospital-toc-link {
	position: relative;
	display: block;
	padding: 6px 12px;
	margin-left: -2px;
	font-size: 13.5px;
	line-height: 1.4;
	color: var(--rich-text-muted);
	text-decoration: none;
	border-left: 2px solid transparent;
	/* Parmak bir başlığın üzerindeyken de dikey kaydırma çalışsın diye
	   (touch-action miras alınmaz, her elemanda ayrıca tanımlanmalı). */
	touch-action: pan-y;
	-webkit-tap-highlight-color: transparent;
	-webkit-user-select: none;
	user-select: none;
	transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.richhospital-toc-link:hover {
	color: var(--rich-brand-dark);
	background: var(--rich-brand-soft);
}
.richhospital-toc-item.is-active > .richhospital-toc-link {
	color: var(--rich-brand-dark);
	font-weight: 600;
	border-left-color: var(--rich-brand);
	background: var(--rich-brand-soft);
}

/* ---- Masaüstünde toggle butonu gizli ---- */
.richhospital-toc-toggle {
	display: none;
}

/* ==========================================================================
   Masaüstünde panel, içerik başlamadan görünüp sayfanın üst görsel alanıyla
   çakışmasın diye başlangıçta gizli tutulur; JS uygun noktada
   "rich-toc-scrolled" sınıfını ekler.
   ========================================================================== */
@media screen and (min-width: 993px) {
	.richhospital-toc-panel {
		opacity: 0;
		pointer-events: none;
		transform: translateY(-50%) translateX(14px);
	}
	.richhospital-toc.rich-toc-scrolled .richhospital-toc-panel {
		opacity: 0.94;
		pointer-events: auto;
		transform: translateY(-50%) translateX(0);
	}
	.richhospital-toc.rich-toc-scrolled .richhospital-toc-panel:hover,
	.richhospital-toc.rich-toc-scrolled .richhospital-toc-panel:focus-within {
		opacity: 1;
	}
}

/* Tablet/dizüstü: panel biraz daralır. */
@media screen and (max-width: 1400px) {
	.richhospital-toc-panel {
		right: 16px;
		width: 220px;
	}
}

/* ==========================================================================
   Mobilde TOC paneli açıkken, sayfanın altındaki sabit buton çubuğu
   (E-Sonuç / Randevu Al / WhatsApp) geçici olarak gizlenir; panel kapanınca
   tekrar görünür. Böylece çubuk paneli ezmez, panel de çubuğu yukarı itmez.
   ========================================================================== */
body.richhospital-toc-open .floating-buttons {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

/* ==========================================================================
   İçerik/metin bölümü bittiğinde TOC tamamen gizlenir (hem masaüstü panel
   hem mobil açma butonu).
   ========================================================================== */
.richhospital-toc.rich-toc-hidden .richhospital-toc-panel,
.richhospital-toc.rich-toc-hidden .richhospital-toc-toggle {
	opacity: 0 !important;
	pointer-events: none !important;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

/* ==========================================================================
   Mobil ve tablet (<= 992px): sağ kenarda küçük bir açma butonu; tıklanınca
   alttan açılan panel (bottom sheet).

   Buton önce "İçindekiler" yazısıyla belirir, 2.5 sn sonra küçük bir ikon
   düğmesine dönüşür. Geçiş, boyut animasyonu yerine "sön → boyutu görünmezken
   değiştir → tekrar belir" (crossfade) yöntemiyle yapılır; böylece mobilde
   takılma/kasma olmaz.
   ========================================================================== */
@media screen and (max-width: 992px) {

	@keyframes rich-toc-pop-in {
		0% {
			opacity: 0;
			transform: translateY(-50%) translateX(18px) translateZ(0);
		}
		100% {
			opacity: 1;
			transform: translateY(-50%) translateX(0) translateZ(0);
		}
	}

	.richhospital-toc-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 6px;
		position: fixed;
		right: 0;
		top: 66%;
		transform: translateY(-50%) translateZ(0);
		z-index: 99999;
		background: var(--rich-brand);
		color: #fff;
		border: none;
		border-radius: 999px 0 0 999px;
		padding: 8px 12px;
		box-shadow: -2px 4px 14px rgba(23, 68, 158, 0.32);
		cursor: pointer;
		width: 130px;
		height: 34px;
		overflow: hidden;
		white-space: nowrap;
		opacity: 1;
		animation: rich-toc-pop-in 0.45s ease-out both;
		/* Sadece opacity ve transform animasyonlu (compositor dostu). */
		transition:
			opacity 0.26s ease,
			transform 0.26s ease,
			background 0.3s ease;
	}

	/* Geçiş anı: element sönerken hafifçe sağa kayar; boyut değişimi bu sırada,
	   göz görmezken gerçekleşir. */
	.richhospital-toc-toggle.is-swapping {
		opacity: 0;
		transform: translateY(-50%) translateX(14px) translateZ(0);
	}

	.richhospital-toc-toggle-icon {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		gap: 3px;
		flex: 0 0 auto;
	}
	.richhospital-toc-toggle-icon span {
		display: block;
		width: 13px;
		height: 2px;
		background: #fff;
		border-radius: 1px;
	}

	.richhospital-toc-toggle-label {
		font-size: 12px;
		font-weight: 600;
		white-space: nowrap;
	}

	/* ---- Küçültülmüş (ikon-only) hal ---- */
	.richhospital-toc-toggle.is-collapsed {
		flex-direction: column;
		gap: 0;
		width: 18px;
		height: 44px;
		padding: 0;
		background: rgba(23, 68, 158, 0.42);
		opacity: 0.7;
		box-shadow: -1px 2px 6px rgba(23, 68, 158, 0.12);
	}
	.richhospital-toc-toggle.is-collapsed.is-swapping {
		opacity: 0;
	}
	.richhospital-toc-toggle.is-collapsed .richhospital-toc-toggle-icon {
		flex-direction: row;
		gap: 2px;
		margin: 0;
	}
	.richhospital-toc-toggle.is-collapsed .richhospital-toc-toggle-icon span {
		width: 2px;
		height: 8px;
	}
	.richhospital-toc-toggle.is-collapsed .richhospital-toc-toggle-icon span:nth-child(2) {
		height: 12px;
	}
	.richhospital-toc-toggle.is-collapsed:active,
	.richhospital-toc-toggle.is-collapsed:focus-visible {
		opacity: 1;
		background: var(--rich-brand);
		box-shadow: -2px 4px 14px rgba(23, 68, 158, 0.32);
	}
	.richhospital-toc-toggle.is-collapsed .richhospital-toc-toggle-label {
		display: none;
	}

	.richhospital-toc-panel {
		position: fixed;
		top: auto;
		right: 0;
		left: 0;
		bottom: 0;
		transform: translateY(100%);
		width: 100%;
		max-height: 65vh;
		border-radius: 16px 16px 0 0;
		display: flex;
		opacity: 1;
		z-index: 999990;
		transition: transform 0.25s ease;
	}
	.richhospital-toc.is-open .richhospital-toc-panel {
		transform: translateY(0);
	}
	.richhospital-toc-header {
		display: flex;
	}
	#richhospital-toc-list {
		padding-left: 16px;
	}
}
