/**
 * Smart PDF Documents - Frontend Styles
 * Vanilla CSS, harici bağımlılık yok.
 */

.spd-panel {
	--spd-width: 320px;
	--spd-bg: #1e293b;
	--spd-fg: #ffffff;
	--spd-radius: 10px;
	--spd-duration: 300ms;
	--spd-trigger: 56px;
	--spd-accent: #f2711c;
	--spd-header-start: #3a3a3a;
	--spd-header-end: #545454;

	position: fixed;
	top: 150px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	max-height: calc(100vh - 180px);
	display: flex;
	flex-direction: column;
}

.spd-panel *,
.spd-panel *::before,
.spd-panel *::after {
	box-sizing: border-box;
}

.spd-panel--right {
	right: 16px;
	align-items: flex-end;
}

.spd-panel--left {
	left: 16px;
	align-items: flex-start;
}

/* Kapalı durumda üstte duran gri PDF rozeti (referans görseldeki üst kare) */
.spd-badge-cell {
	flex: 0 0 auto;
	width: var(--spd-trigger);
	height: var(--spd-trigger);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #f1f2f3;
	border: 1px solid #e1e3e6;
	border-radius: 10px;
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
	margin-bottom: 4px;
}

.spd-badge-cell svg {
	display: block;
	width: 28px;
	height: 28px;
}

.spd-panel.is-open .spd-badge-cell {
	display: none;
}

/* Panel body: kapalıyken yüksekliği sıfırlanır, açıkken aşağı doğru genişler */
.spd-body {
	width: var(--spd-width);
	max-width: calc(100vw - 32px);
	max-height: 0;
	background: #ffffff;
	color: #1f2937;
	box-shadow: 0 20px 45px rgba(15, 23, 42, 0.28);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	border-radius: var(--spd-radius);
	transition: max-height var(--spd-duration) ease, opacity var(--spd-duration) ease, margin var(--spd-duration) ease;
}

.spd-panel.is-open .spd-body {
	max-height: min(600px, calc(100vh - 220px));
	opacity: 1;
	margin-bottom: 4px;
}

/* Header: katlanmış köşeli PDF rozeti + kalın büyük harf başlık, koyu geçişli zemin */
.spd-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 20px;
	background: linear-gradient(135deg, var(--spd-header-start) 0%, var(--spd-header-end) 100%);
	border-bottom: none;
	border-radius: var(--spd-radius) var(--spd-radius) 0 0;
	flex: 0 0 auto;
}

.spd-header-badge {
	flex: 0 0 auto;
	display: inline-flex;
	line-height: 0;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.spd-header-badge svg {
	display: block;
	width: 30px;
	height: 30px;
}

.spd-title {
	margin: 0;
	font-size: 18px;
	font-weight: 800;
	letter-spacing: 0.04em;
	color: #ffffff;
	text-transform: uppercase;
}

/* Search */
.spd-search-wrap {
	padding: 12px 16px;
	flex: 0 0 auto;
	border-bottom: 1px solid #eef1f4;
	background: #fff;
}

.spd-search-input {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid #d7dce2;
	border-radius: 6px;
	font-size: 14px;
}

.spd-search-input:focus-visible {
	outline: 2px solid var(--spd-bg);
	outline-offset: 1px;
}

/* Results */
.spd-results {
	flex: 1 1 auto;
	overflow-y: auto;
	background: #fff;
}

.spd-category-toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #f8fafc;
	border: none;
	border-bottom: 1px solid #eef1f4;
	padding: 10px 18px;
	font-size: 12.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #475569;
	cursor: pointer;
}

.spd-category-toggle:hover,
.spd-category-toggle:focus-visible {
	background: #eef2f7;
	outline: none;
}

.spd-category-count {
	font-weight: 400;
	color: #94a3b8;
}

.spd-items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.spd-items[hidden] {
	display: none;
}

.spd-item {
	border-bottom: 1px solid #eef1f4;
	border-left: 3px solid transparent;
}

.spd-item:last-child {
	border-bottom: none;
}

.spd-item-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	text-decoration: none;
	color: #334155;
	font-size: 14.5px;
	font-weight: 500;
	line-height: 1.35;
	transition: background 150ms ease, color 150ms ease;
}

.spd-item-link:hover,
.spd-item-link:focus-visible {
	background: #fff7ed;
	color: #1f2937;
	font-weight: 700;
	text-decoration: none;
	outline: none;
}

.spd-item:has(.spd-item-link:hover),
.spd-item:has(.spd-item-link:focus-visible) {
	border-left-color: var(--spd-accent);
}

.spd-item-bullet {
	flex: 0 0 auto;
	width: 9px;
	height: 9px;
	background: #9aa3af;
	border-radius: 2px;
	transition: background 150ms ease, border-radius 150ms ease;
}

.spd-item-link:hover .spd-item-bullet,
.spd-item-link:focus-visible .spd-item-bullet {
	background: var(--spd-accent);
	border-radius: 50%;
}

.spd-item-title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.spd-no-results {
	padding: 24px 18px;
	text-align: center;
	color: #6b7280;
	font-size: 13px;
}

.spd-empty {
	color: #6b7280;
	font-size: 14px;
}

/* Aç/kapa düğmesi: koyu kare üzerinde çift ok — kapalıyken aşağı, açıkken yukarı bakar
   (referans görseldeki gibi rozetin hemen altında duran sabit kontrol). */
.spd-toggle {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--spd-trigger);
	height: 42px;
	border: none;
	border-radius: 10px;
	background: #232529;
	color: #ffffff;
	cursor: pointer;
	padding: 0;
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
	transition: background 150ms ease;
}

.spd-toggle:hover,
.spd-toggle:focus-visible {
	background: #34363b;
	outline: none;
}

.spd-toggle-icon {
	display: inline-flex;
	transform: rotate(90deg);
	transition: transform var(--spd-duration) ease;
}

.spd-panel.is-open .spd-toggle-icon {
	transform: rotate(-90deg);
}

/* Responsive - Mobile */
@media (max-width: 782px) {
	.spd-panel {
		top: 90px;
		right: 10px;
		left: auto;
		max-height: calc(100vh - 110px);
	}

	.spd-panel--left {
		left: auto;
		right: 10px;
	}

	.spd-body {
		width: calc(100vw - 20px);
		max-width: calc(100vw - 20px);
	}

	.spd-panel.is-open .spd-body {
		max-height: calc(100vh - 250px);
	}

	.spd-badge-cell,
	.spd-toggle {
		width: 46px;
	}

	.spd-toggle {
		height: 38px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.spd-body,
	.spd-toggle-icon {
		transition: none;
	}
}
