/* Document Portal — front-end styles. Prefixed .dp- to avoid theme clashes. */

/* Colour defaults. These are overridden per-site from the Appearance
   settings via an inline :root{} block, so admins can pick their own. */
:root {
	--dp-accent: #2a7ae2;
	--dp-accent-hover: #1c63c0;
	--dp-title: inherit; /* Document title text; inherits theme colour by default. */
	--dp-title-hover: var( --dp-title ); /* Title on hover; matches normal title unless set. */
	--dp-row-hover: #f4f8ff;
	--dp-badge: #d93025;
	--dp-border: #e4e4e4;
}

.dp-portal {
	max-width: 720px;
	margin-left: auto;
	margin-right: auto;
}

/* --- Toolbar: search + category filters --- */

.dp-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 16px;
}

.dp-search {
	position: relative;
	flex: 1 1 240px;
}

.dp-search-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 13px;
	line-height: 1;
	opacity: .55;
	pointer-events: none;
}

/* Scoped to .dp-portal so the left padding wins over theme input styles. */
.dp-portal .dp-search-input {
	width: 100%;
	box-sizing: border-box;
	padding: 9px 14px 9px 42px;
	border: 1px solid #ccc;
	border-radius: 6px;
	font-size: .95em;
	line-height: 1.3;
}

.dp-portal .dp-search-input:focus {
	border-color: var( --dp-accent );
	outline: none;
	box-shadow: 0 0 0 2px rgba( 0, 0, 0, .06 );
}

.dp-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.dp-filter-btn {
	padding: 6px 14px;
	border: 1px solid #ccc;
	border-radius: 999px;
	background: #fff;
	color: #333;
	font-size: .82em;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}

.dp-filter-btn:hover {
	border-color: var( --dp-accent );
}

.dp-filter-btn.is-active {
	background: var( --dp-accent );
	border-color: var( --dp-accent );
	color: #fff;
}

/* --- Document list --- */

.dp-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var( --dp-border );
	border-radius: 8px;
	overflow: hidden;
}

.dp-item {
	margin: 0;
	padding: 0;
	border-top: 1px solid #eee;
}

.dp-item:first-child {
	border-top: 0;
}

.dp-item-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 11px 16px;
	text-decoration: none;
	color: inherit;
	transition: background-color .12s ease;
}

.dp-item-link:hover,
.dp-item-link:focus {
	background: var( --dp-row-hover );
}

.dp-item-link:hover .dp-item-title,
.dp-item-link:focus .dp-item-title {
	color: var( --dp-title-hover );
}

.dp-icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 5px;
	background: var( --dp-badge );
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .5px;
}

.dp-item-body {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
	line-height: 1.3;
}

.dp-item-title {
	font-weight: 600;
	font-size: .97em;
	color: var( --dp-title );
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.dp-item-desc {
	font-size: .84em;
	color: #666;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.dp-item-meta {
	flex: 0 0 auto;
	font-size: .8em;
	color: #999;
	white-space: nowrap;
}

.dp-download {
	flex: 0 0 auto;
	font-size: 16px;
	color: var( --dp-accent );
	opacity: .65;
}

.dp-list-title {
	margin: 0 0 12px;
	text-align: center;
	color: var( --dp-title );
}

.dp-empty,
.dp-notice,
.dp-no-results {
	color: #777;
	font-style: italic;
	font-size: .9em;
	padding: 10px 2px;
	text-align: center;
}

.dp-logout {
	text-align: right;
	font-size: .82em;
	margin: 0 0 8px;
}

/* --- Pagination --- */

.dp-pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 5px;
	margin-top: 16px;
}

.dp-page-btn {
	min-width: 34px;
	padding: 6px 10px;
	border: 1px solid #ddd;
	border-radius: 6px;
	background: #fff;
	color: #333;
	font-size: .85em;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}

.dp-page-btn:hover:not( :disabled ) {
	border-color: var( --dp-accent );
}

.dp-page-btn.is-active {
	background: var( --dp-accent );
	border-color: var( --dp-accent );
	color: #fff;
	cursor: default;
}

.dp-page-btn:disabled {
	opacity: .4;
	cursor: default;
}

/* On narrow screens, drop the meta below the title so rows stay tidy. */
@media ( max-width: 480px ) {
	.dp-item-link {
		flex-wrap: wrap;
	}
	.dp-item-meta {
		flex-basis: 100%;
		padding-left: 46px;
	}
	.dp-item-title,
	.dp-item-desc {
		white-space: normal;
	}
	.dp-toolbar {
		justify-content: flex-start;
	}
}

/* --- Members password gate --- */

.dp-gate {
	max-width: 420px;
	margin: 0 auto;
	padding: 24px 22px;
	border: 1px solid #cfcfcf;
	border-radius: 10px;
	background: #fff;
	color: #333;
	text-align: center;
}

.dp-gate-title {
	margin: 0 0 8px;
	color: #222;
}

.dp-gate-intro {
	margin: 0 0 16px;
	color: #555;
}

.dp-gate-error {
	margin: 0 0 14px;
	padding: 9px 12px;
	border-radius: 6px;
	background: #fdecea;
	color: #b32d2e;
	font-size: .9em;
}

.dp-gate-form {
	display: flex;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
}

.dp-gate-form input[type="password"] {
	flex: 1 1 200px;
	padding: 9px 12px;
	border: 1px solid #cfcfcf;
	border-radius: 6px;
	background: #fff;
	color: #222;
	font-size: 1em;
}

.dp-gate-button {
	padding: 9px 22px;
	border: 0;
	border-radius: 6px;
	background: var( --dp-accent );
	color: #fff;
	font-size: 1em;
	font-weight: 600;
	cursor: pointer;
}

.dp-gate-button:hover {
	background: var( --dp-accent-hover );
}

/* --- Dark-theme niceties --- */

@media ( prefers-color-scheme: dark ) {
	.dp-list { border-color: #333; }
	.dp-item { border-top-color: #2a2a2a; }
	.dp-item-link:hover,
	.dp-item-link:focus { background: #1d2733; }
	.dp-item-desc { color: #aaa; }
	.dp-search-input,
	.dp-filter-btn,
	.dp-page-btn {
		background: #1e1e1e;
		border-color: #333;
		color: #eee;
	}
	/* The members login box stays a light, readable card in dark mode too. */
}
