/* ==========================================================================
   Clinical Trials Manager — Frontend Styles
   ========================================================================== */

.ct-wrapper {
	--ct-heading: #0d397c;
	--ct-button: #058bdd;
	--ct-button-text: #ffffff;
	--ct-body-text: #7a7a7a;
	--ct-border: #e7ebf0;

	max-width: 1200px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--ct-body-text);
	box-sizing: border-box;
}

.ct-wrapper *,
.ct-wrapper *::before,
.ct-wrapper *::after {
	box-sizing: inherit;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* --------------------------------------------------------------------
   Search Filter Row
   -------------------------------------------------------------------- */

.ct-search-form {
	margin-bottom: 32px;
}

.ct-search-row {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 12px;
	background: #f5f8fb;
	border: 1px solid var(--ct-border);
	border-radius: 10px;
	padding: 18px;
}

.ct-field {
	display: flex;
	flex-direction: column;
}

.ct-field-title {
	flex: 2 1 260px;
}

.ct-field-category {
	flex: 1 1 200px;
}

.ct-field-submit {
	flex: 0 0 auto;
	display: flex;
}

.ct-field input[type="text"],
.ct-field select {
	width: 100%;
	height: 44px;
	padding: 0 14px;
	font-size: 14px;
	color: var(--ct-body-text);
	background: #ffffff;
	border: 1px solid var(--ct-border);
	border-radius: 6px;
	outline: none;
	transition: border-color 0.15s ease;
}

.ct-field input[type="text"]:focus,
.ct-field select:focus {
	border-color: var(--ct-button);
}

#ct-search-form .ct-search-btn {
	height: 44px!important;
	padding: 0 26px!important;
	white-space: nowrap;
	font-size: 14px!important;
	font-weight: 600!important;
	color: var(--ct-button-text)!important;
	background: var(--ct-button)!important;
	border: none;
	border-radius: 6px!important;
	cursor: pointer;
	transition: opacity 0.15s ease, transform 0.1s ease;
}

.ct-search-btn:hover {
	opacity: 0.9;
}

.ct-search-btn:active {
	transform: translateY(1px);
}

/* --------------------------------------------------------------------
   Results List
   -------------------------------------------------------------------- */

.ct-results-list.ct-loading {
	opacity: 0.5;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

.ct-no-results {
	padding: 30px;
	text-align: center;
	color: var(--ct-body-text);
	background: #f5f8fb;
	border-radius: 8px;
}

.ct-list-item {
	display: flex;
	gap: 24px;
	background: #ffffff;
	border: 1px solid var(--ct-border);
	border-radius: 10px;
	padding: 18px;
	margin-bottom: 22px;
	box-shadow: 0 1px 3px rgba(13, 57, 124, 0.04);
	transition: box-shadow 0.15s ease;
}

.ct-list-item:hover {
	box-shadow: 0 4px 14px rgba(13, 57, 124, 0.08);
}

.ct-list-item-image {
	flex: 0 0 30%;
	max-width: 30%;
	border-radius: 8px;
	overflow: hidden;
	background: #f0f3f7;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 140px;
	position: relative;
}

.ct-list-item-image img {
	width: 100%;
	height: 100%;
	min-height: 140px;
	object-fit: cover;
	display: block;
}

.ct-no-image {
	width: 100%;
	height: 140px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #c3ccd6;
	font-size: 32px;
}

.ct-list-item-content {
	flex: 0 0 65%;
	max-width: 65%;
	/* Without this, flex children refuse to shrink below their content's
	   natural width, which is what pushed the excerpt text past the edge
	   of the card instead of wrapping. */
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.ct-item-title {
	margin: 0 0 8px;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.3;
	overflow-wrap: break-word;
	word-break: break-word;
}

.ct-item-title a {
	color: var(--ct-heading);
	text-decoration: none;
}

.ct-item-title a:hover {
	text-decoration: underline;
}

.ct-item-category {
	display: inline-block;
    margin-bottom: 12px;
    padding: 3px 12px;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    background: rgb(5 139 221 / 75%);
    border-radius: 999px;
    width: fit-content;
    position: absolute;
    top: 10px;
    left: 10px;
}

.ct-item-excerpt {
	margin-bottom: 14px;
	font-size: 14px;
	line-height: 1.7;
	color: var(--ct-body-text);
	overflow-wrap: break-word;
	word-break: break-word;
}

.ct-excerpt-content > *:first-child {
	margin-top: 0;
}

.ct-excerpt-content > *:last-child {
	margin-bottom: 0;
}

.ct-excerpt-content p {
	margin: 0 0 10px;
	font-size: 14px;
    color: #000;
}

.ct-excerpt-content strong,
.ct-excerpt-content b {
	color: var(--ct-heading);
	font-weight: 700;
}

.ct-excerpt-content a {
	color: var(--ct-button);
}

.ct-excerpt-content ul,
.ct-excerpt-content ol {
	margin: 0 0 10px;
	padding-left: 20px;
}

/* Truncates the *rendered* HTML to ~4 lines without ever cutting a tag
   in half — "Read more" simply removes this class. */
.ct-excerpt-content.ct-clamped {
	display: -webkit-box;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ct-read-more,
.ct-read-less {
	display: inline-block;
	margin-top: 2px;
	font-size: 13px;
	font-weight: 600;
	color: var(--ct-button);
	text-decoration: none;
	cursor: pointer;
}

.ct-read-more:hover,
.ct-read-less:hover {
	text-decoration: underline;
}

.ct-join-btn {
	align-self: flex-start;
	margin-top: auto;
	padding: 10px 22px;
	font-size: 14px;
	font-weight: 600;
	color: var(--ct-button-text);
	background: var(--ct-button);
	border-radius: 6px;
	text-decoration: none;
	transition: opacity 0.15s ease;
}

.ct-join-btn:hover {
	opacity: 0.9;
	color: var(--ct-button-text);
}

/* --------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------- */

.ct-pagination {
	margin-top: 10px;
}

.ct-pagination-list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ct-pagination-list a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	font-size: 14px;
	font-weight: 600;
	color: var(--ct-heading);
	background: #ffffff;
	border: 1px solid var(--ct-border);
	border-radius: 6px;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease;
}

.ct-pagination-list a:hover {
	background: #eef4fb;
}

.ct-pagination-list a.active {
	color: var(--ct-button-text);
	background: var(--ct-button);
	border-color: var(--ct-button);
}

/* --------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------- */

@media (max-width: 900px) {
	.ct-list-item-image,
	.ct-list-item-content {
		flex-basis: 100%;
		max-width: 100%;
	}

	.ct-list-item {
		flex-direction: column;
	}

	.ct-list-item-image {
		min-height: 180px;
	}
}

@media (max-width: 768px) {
	.ct-search-row {
		flex-direction: column;
		align-items: stretch;
	}

	.ct-field-title,
	.ct-field-category,
	.ct-field-submit {
		flex: 1 1 100%;
	}

	.ct-search-btn {
		width: 100%;
	}
}

@media (max-width: 480px) {
	.ct-item-title {
		font-size: 18px;
	}

	.ct-list-item {
		padding: 14px;
		gap: 14px;
	}
}
