/* Perfect Documents — public list ([perfect_documents_list]) */

.pd-list {
	--pdl-accent: #1d4ed8;
	--pdl-text: #1f2937;
	--pdl-muted: #6b7280;
	--pdl-border: #e5e7eb;
	--pdl-bg: #ffffff;
	--pdl-bg-soft: #f9fafb;
	--pdl-radius: 10px;
	--pdl-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

	color: var(--pdl-text);
	font-family: var(--pdl-font);
	font-size: 15px;
	line-height: 1.5;
	margin: 30px auto;
}

.pd-list input,
.pd-list select,
.pd-list button,
.pd-list .pd-list__label,
.pd-list .ts-control,
.pd-list .ts-dropdown {
	font-family: var(--pdl-font);
}

.pd-list *,
.pd-list *::before,
.pd-list *::after {
	box-sizing: border-box;
}

/* Archive context header (mode="current" on a taxonomy archive). -------- */

.pd-list-archivehead {
	margin: 30px auto 18px;
}

.pd-list-archivehead__eyebrow {
	margin: 0 0 2px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #1d4ed8;
}

.pd-list-archivehead__title {
	margin: 0;
	font-size: 26px;
	line-height: 1.2;
	font-weight: 800;
	color: #1f2937;
}

.pd-list-archivehead__date {
	margin: 4px 0 0;
	font-size: 15px;
	color: #6b7280;
}

/* Toolbar + filter fields ---------------------------------------------- */

.pd-list__toolbar {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	margin-bottom: 12px;
}

.pd-list__filters {
	flex: 1;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 10px;
}

.pd-list__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.pd-list__label {
	font-size: 18px;
	font-weight: 600;
	letter-spacing: 0;
	color: var(--pdl-text);
}

/* Screen-reader-only: keep an accessible name even when visually hidden. */
.pd-list__sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.pd-list .pd-list__select,
.pd-list .pd-list__select:hover,
.pd-list .pd-list__select:focus {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid var(--pdl-border);
	border-radius: 8px;
	background: var(--pdl-bg);
	font: inherit;
	font-size: 14px;
	color: var(--pdl-text);
	box-shadow: none;
	transition: border-color 0.18s ease;
}

.pd-list .pd-list__select:hover {
	border-color: #cbd5e1;
}

.pd-list .pd-list__select:focus {
	outline: 2px solid var(--pdl-accent);
	outline-offset: 1px;
	border-color: var(--pdl-accent);
}

/* Tom Select — same pill-badge look as the upload form's tag field. */
.pd-list .ts-wrapper {
	min-width: 0;
}

.pd-list .ts-control {
	border: 1px solid var(--pdl-border);
	border-radius: 8px;
	padding: 6px 10px;
	font-size: 14px;
	min-height: 41px;
	background: var(--pdl-bg);
	box-shadow: none;
	transition: border-color 0.18s ease;
}

.pd-list .ts-wrapper:hover .ts-control {
	border-color: #cbd5e1;
}

/* Stable focus: outline instead of an inset shadow that nudges the box,
   and min-height/line-height pinned so clicking in never resizes it. */
.pd-list .ts-wrapper.focus .ts-control {
	outline: 2px solid var(--pdl-accent);
	outline-offset: 1px;
	border-color: var(--pdl-accent);
	box-shadow: none;
}

.pd-list .ts-control input {
	font-size: 14px;
	color: var(--pdl-text);
}

.pd-list .ts-wrapper.multi .ts-control > .item {
	display: inline-flex;
	align-items: center;
	background: #eff4ff;
	color: var(--pdl-accent);
	border: 0;
	border-radius: 999px;
	padding: 3px 6px 3px 11px;
	margin: 2px 6px 2px 0;
	font-size: 13px;
	font-weight: 600;
}

.pd-list .ts-wrapper.multi .ts-control > .item .remove {
	border-left: 0;
	margin-left: 4px;
	padding: 0 6px;
	color: var(--pdl-accent);
	border-radius: 999px;
	font-size: 14px;
	line-height: 1.4;
	transition: color 0.18s ease, background 0.18s ease;
}

.pd-list .ts-wrapper.multi .ts-control > .item .remove:hover {
	background: rgba(29, 78, 216, 0.12);
	color: #b91c1c;
}

.pd-list .ts-dropdown {
	border: 1px solid var(--pdl-border);
	border-radius: 8px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
	font-size: 14px;
	z-index: 100000;
}

.pd-list .ts-dropdown .option,
.pd-list .ts-dropdown .no-results {
	padding: 9px 12px;
}

.pd-list .ts-dropdown .active {
	background: var(--pdl-bg-soft);
	color: var(--pdl-accent);
}

/* Mobile filter toggle — hidden on desktop. */
.pd-list .pd-list__filtertoggle {
	display: none;
	position: relative;
	gap: 8px;
}

.pd-list__togglecount {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--pdl-accent);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
}

/* Full-width typing search, its own row under the filters. */
.pd-list__searchrow {
	margin-bottom: 12px;
}

.pd-list .pd-list__search,
.pd-list .pd-list__search:hover,
.pd-list .pd-list__search:focus {
	width: 100%;
	padding: 11px 14px;
	border: 1px solid var(--pdl-border);
	border-radius: 8px;
	background: var(--pdl-bg);
	font: inherit;
	font-size: 15px;
	color: var(--pdl-text);
	box-shadow: none;
	transition: border-color 0.18s ease;
}

.pd-list .pd-list__search:hover {
	border-color: #cbd5e1;
}

.pd-list .pd-list__search:focus {
	outline: 2px solid var(--pdl-accent);
	outline-offset: 1px;
	border-color: var(--pdl-accent);
}

/* Active filter chips ---------------------------------------------------- */

.pd-list__chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

.pd-list .pd-list__chip,
.pd-list .pd-list__chip:hover,
.pd-list .pd-list__chip:focus {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 1px solid var(--pdl-accent);
	border-radius: 999px;
	background: #eff4ff;
	color: var(--pdl-accent);
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: normal;
	text-transform: none;
	padding: 4px 12px;
	cursor: pointer;
	box-shadow: none;
	transition: background 0.18s ease, color 0.18s ease;
}

.pd-list .pd-list__chip:hover {
	background: var(--pdl-accent);
	color: #fff;
}

.pd-list .pd-list__chip:focus-visible {
	outline: 2px solid var(--pdl-accent);
	outline-offset: 2px;
}

.pd-list__chip-x {
	font-size: 15px;
	line-height: 1;
}

.pd-list .pd-list__clearall,
.pd-list .pd-list__clearall:hover,
.pd-list .pd-list__clearall:focus {
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	background: transparent;
	color: var(--pdl-muted);
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: underline;
	cursor: pointer;
	box-shadow: none;
	padding: 4px 6px;
	transition: color 0.18s ease;
}

.pd-list .pd-list__clearall:hover {
	color: #b91c1c;
}

/* Meta row: live result count + sorting ---------------------------------- */

.pd-list__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 14px;
}

.pd-list__count {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--pdl-muted);
}

.pd-list__meta[hidden] {
	display: none;
}

/* Total count parked at the bottom (mobile). Empty on desktop. */
.pd-list__bottommeta:empty {
	display: none;
}

.pd-list__bottommeta {
	margin-top: 14px;
	text-align: center;
}

.pd-list__bottommeta .pd-list__count {
	font-weight: 600;
}

.pd-list__orderfield {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.pd-list .pd-list__select--order {
	width: auto;
	min-width: 170px;
}

/* Sections ---------------------------------------------------------------- */

.pd-list__content[aria-busy='true'] {
	pointer-events: none;
}

.pd-list__section {
	border: 1px solid var(--pdl-border);
	border-radius: var(--pdl-radius);
	background: var(--pdl-bg);
	margin-bottom: 22px;
	overflow: hidden;
	/* Soft elevation on the WHOLE section (header + every doc row), not
	   just the header. */
	box-shadow: 0 0 25px rgba(0, 0, 0, 0.08);
}

.pd-list__sectionhead {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	background: var(--pdl-bg-soft);
	border-bottom: 1px solid var(--pdl-border);
}

.pd-list .pd-list__sectiontitle {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	color: var(--pdl-text);
	line-height: 1.4;
}

.pd-list .pd-list__sectionlink {
	color: inherit;
	text-decoration: none;
	transition: color 0.18s ease;
}

.pd-list a.pd-list__sectionlink:hover,
.pd-list a.pd-list__sectionlink:focus {
	color: var(--pdl-accent);
}

.pd-list__count-pill {
	flex-shrink: 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--pdl-muted);
	background: var(--pdl-bg);
	border: 1px solid var(--pdl-border);
	border-radius: 999px;
	padding: 3px 10px;
}

/* Rows --------------------------------------------------------------------- */

.pd-list__rows,
.pd-list__children {
	list-style: none;
	margin: 0;
	padding: 0;
}

.pd-list__row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 16px;
	margin: 0;
}

/* Whole-row click target (JS opens the file in a new tab) — give it the
   pointer + a soft hover so the row reads as clickable everywhere, not just
   on the title link. */
.pd-list__row--clickable {
	cursor: pointer;
	transition: background 0.15s ease;
}

.pd-list__row--clickable:hover {
	background: var(--pdl-bg-soft);
}

.pd-list__rows > .pd-list__row + .pd-list__row,
.pd-list__rows > .pd-list__branch + .pd-list__row {
	border-top: 1px solid var(--pdl-border);
}

.pd-list .pd-list__title,
.pd-list a.pd-list__title {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 16px;
	font-weight: 500;
	color: var(--pdl-text);
	text-decoration: none;
	transition: color 0.18s ease;
}

.pd-list a.pd-list__title:hover,
.pd-list a.pd-list__title:focus {
	color: var(--pdl-accent);
}

.pd-list a.pd-list__title:focus-visible {
	outline: 2px solid var(--pdl-accent);
	outline-offset: 2px;
	border-radius: 4px;
}

.pd-list__rowmeta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.pd-list__size {
	font-size: 12px;
	color: var(--pdl-muted);
	white-space: nowrap;
}

.pd-list__badge {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border-radius: 5px;
	padding: 2px 7px;
}

.pd-list__badge--ext {
	background: var(--pdl-bg-soft);
	border: 1px solid var(--pdl-border);
	color: var(--pdl-muted);
}

.pd-list__badge--type {
	background: #eff4ff;
	color: var(--pdl-accent);
	text-transform: none;
	letter-spacing: 0;
	font-size: 13px;
}

/* Attachment tree — rounded ELBOW connectors: the trunk runs down and
   CURVES into each child; at the last child the line ends in the curve
   instead of running on. */

.pd-list__branch {
	margin: 0;
	padding: 0 0 6px 34px;
	border-top: 0;
}

.pd-list__children .pd-list__row {
	position: relative;
	padding: 7px 16px 7px 26px;
}

.pd-list__children .pd-list__row::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	width: 16px;
	height: 50%;
	border-left: 2px solid var(--pdl-border);
	border-bottom: 2px solid var(--pdl-border);
	border-bottom-left-radius: 10px;
}

.pd-list__children .pd-list__row:first-child::before {
	top: -5px;
	height: calc(50% + 5px);
}

.pd-list__children .pd-list__row:not(:last-child)::after {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	border-left: 2px solid var(--pdl-border);
}

/* Pagination — centered. ------------------------------------------------- */

.pd-list__pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: 18px;
}

.pd-list .pd-list__btn,
.pd-list .pd-list__btn:focus,
.pd-list .pd-list__btn:hover,
.pd-list .pd-list__btn:active {
	appearance: none;
	-webkit-appearance: none;
	border: 1px solid var(--pdl-border);
	border-radius: 8px;
	background: var(--pdl-bg);
	padding: 8px 16px;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: normal;
	text-transform: none;
	color: var(--pdl-text);
	cursor: pointer;
	box-shadow: none;
	transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.pd-list .pd-list__btn:hover {
	border-color: var(--pdl-accent);
	color: var(--pdl-accent);
}

.pd-list .pd-list__btn:focus-visible {
	outline: 2px solid var(--pdl-accent);
	outline-offset: 2px;
}

.pd-list .pd-list__btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.pd-list .pd-list__btn--primary,
.pd-list .pd-list__btn--primary:hover,
.pd-list .pd-list__btn--primary:focus {
	background: var(--pdl-accent);
	border-color: var(--pdl-accent);
	color: #fff;
}

.pd-list .pd-list__btn--primary:hover {
	background: #1e3a8a;
}

.pd-list__pageinfo {
	font-size: 13px;
	color: var(--pdl-muted);
}

.pd-list__empty {
	padding: 24px;
	text-align: center;
	color: var(--pdl-muted);
	border: 1px dashed var(--pdl-border);
	border-radius: var(--pdl-radius);
	background: var(--pdl-bg-soft);
}

/* Skeleton loader -------------------------------------------------------- */

.pd-list__skelbar {
	display: inline-block;
	height: 14px;
	border-radius: 6px;
	background: linear-gradient(90deg, #eef1f4 25%, #f7f8fa 50%, #eef1f4 75%);
	background-size: 200% 100%;
	animation: pd-list-shimmer 1.2s ease-in-out infinite;
}

.pd-list__sectionhead .pd-list__skelbar {
	height: 16px;
}

@keyframes pd-list-shimmer {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

/* Mobile offcanvas drawer -------------------------------------------------- */

.pd-list__drawer {
	position: fixed;
	inset: 0;
	z-index: 100000;
}

.pd-list__draweroverlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.pd-list__drawerpanel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(360px, 92vw);
	background: var(--pdl-bg);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.2s ease;
	box-shadow: -8px 0 24px rgba(15, 23, 42, 0.15);
}

.pd-list__drawer.is-open .pd-list__draweroverlay {
	opacity: 1;
}

.pd-list__drawer.is-open .pd-list__drawerpanel {
	transform: translateX(0);
}

.pd-list__drawerhead {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 14px 16px;
	border-bottom: 1px solid var(--pdl-border);
}

.pd-list__drawertitle {
	font-size: 16px;
	font-weight: 700;
}

.pd-list .pd-list__drawerclose,
.pd-list .pd-list__drawerclose:hover,
.pd-list .pd-list__drawerclose:focus {
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	background: transparent;
	box-shadow: none;
	font-size: 26px;
	line-height: 1;
	padding: 2px 8px;
	color: var(--pdl-muted);
	cursor: pointer;
	transition: color 0.18s ease;
}

.pd-list .pd-list__drawerclose:hover {
	color: var(--pdl-text);
}

.pd-list .pd-list__drawerclose:focus-visible {
	outline: 2px solid var(--pdl-accent);
	outline-offset: 2px;
}

.pd-list__drawerbody {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
}

.pd-list__drawerbody .pd-list__filters {
	grid-template-columns: 1fr;
}

.pd-list__drawerfoot {
	padding: 12px 16px;
	border-top: 1px solid var(--pdl-border);
}

.pd-list__drawerfoot .pd-list__btn--primary {
	width: 100%;
}

/* Responsive --------------------------------------------------------------- */

@media (max-width: 782px) {
	.pd-list .pd-list__filtertoggle {
		display: inline-flex;
		align-items: center;
		flex-shrink: 0;
	}

	/* Toolbar = [Szűrők] [Rendezés] on one row; sort fills the rest. */
	.pd-list__toolbar {
		align-items: center;
	}

	.pd-list__toolbar .pd-list__orderfield {
		flex: 1;
		min-width: 0;
	}

	/* On mobile the sort label is visually hidden but STAYS in the
	   accessibility tree (display:none would strip the select's name). */
	.pd-list__toolbar .pd-list__orderfield .pd-list__label {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
		border: 0;
	}

	.pd-list .pd-list__select--order {
		width: 100%;
		min-width: 0;
	}

	.pd-list__row {
		flex-wrap: wrap;
		row-gap: 4px;
	}

	.pd-list .pd-list__title {
		flex-basis: 100%;
		order: 2;
		white-space: normal;
	}

	.pd-list__badge--type {
		order: 1;
	}

	.pd-list__rowmeta {
		order: 3;
		margin-left: auto;
	}
}

/* Accessibility: respect reduced-motion preferences. ----------------------- */

@media (prefers-reduced-motion: reduce) {
	.pd-list__skelbar {
		animation: none;
	}

	.pd-list__draweroverlay,
	.pd-list__drawerpanel,
	.pd-list * {
		transition: none !important;
	}
}
