/**
 * Help Center — plugin-specific frontend overrides.
 *
 * The main help-theme stylesheets (fontiran/libs/common/home/client_default/
 * article/category) are loaded via <link> tags in templates/header-help.php.
 * This file is enqueued afterwards (via HelpCenter\Frontend on Help Center
 * pages) and holds plugin-only tweaks — notably the native search form which
 * replaces the AJAX Search Lite widget used by the source theme.
 *
 * @package HelpCenter
 */

/* ---------- Header search form (native, replaces AJAX Search Lite) ---------- */
.csh-header-search {
	position: relative;
	display: flex;
	justify-content: center;
	margin: 16px 0 8px;
}

.csh-search-form {
	position: relative;
	display: flex;
	align-items: stretch;
	width: 100%;
	max-width: 640px;
	border: 1px solid #e6e9ee;
	border-radius: 10px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.csh-search-form-icon {
	position: absolute;
	top: 50%;
	right: 14px;
	transform: translateY(-50%);
	color: #9aa3b2;
	pointer-events: none;
}

.csh-search-form-input {
	flex: 1 1 auto;
	border: 0;
	padding: 12px 42px 12px 16px;
	font-size: 14px;
	background: transparent;
	outline: none;
	color: #1a1f36;
}

.csh-search-form-submit {
	flex: 0 0 auto;
	border: 0;
	cursor: pointer;
	padding: 0 22px;
	font-size: 14px;
	color: #fff;
	background-color: #0080c0; /* csh theme color */
	transition: background-color .2s ease;
}

.csh-search-form-submit:hover {
	background-color: #006697;
}

.csh-search-form-input::placeholder {
	color: #9aa3b2;
}

/* ---------- Live search results dropdown ---------- */
.csh-search-results {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	margin: 0 auto;
	max-width: 640px;
	background: #fff;
	border: 1px solid #e6e9ee;
	border-radius: 10px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
	overflow: hidden;
	z-index: 50;
}

.csh-search-results[hidden] {
	display: none;
}

.csh-search-results-list {
	list-style: none;
	margin: 0;
	padding: 6px;
	max-height: 360px;
	overflow-y: auto;
}

.csh-search-result {
	display: block;
	padding: 10px 12px;
	border-radius: 8px;
	text-decoration: none;
	color: #1a1f36;
	transition: background-color .15s ease;
}

.csh-search-result:hover,
.csh-search-result:focus {
	background-color: #f2f6fa;
}

.csh-search-result-title {
	display: block;
	font-weight: 600;
	line-height: 1.5;
}

.csh-search-result-excerpt {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	color: #6b7280;
	line-height: 1.5;
}

.csh-search-results-empty {
	padding: 14px 16px;
	color: #6b7280;
	text-align: center;
}

.csh-search-results-more {
	display: block;
	padding: 10px 12px;
	text-align: center;
	text-decoration: none;
	color: #0080c0;
	border-top: 1px solid #f0f2f5;
	background: #fafbfc;
}

.csh-search-results-more:hover {
	background: #f2f6fa;
}

/* ---------- Header title: keep on a single line ----------
 * The title carries .csh-text-wrap (overflow-wrap: break-word), which lets it
 * wrap to two lines. Force a single line; the source theme's responsive
 * font-size reduction already handles narrow screens. */
header .csh-wrapper .csh-header-title {
	white-space: nowrap;
	overflow-wrap: normal;
	word-wrap: normal;
}

/* ---------- Category card titles: single line ----------
 * The source theme clamps these to 2 lines (-webkit-line-clamp:2 via
 * .csh-text-ellipsis-multiline-lines-2), which makes short titles look
 * broken across two lines. Clamp to one line instead. */
.csh-category-item h6.csh-text-ellipsis-multiline {
	-webkit-line-clamp: 1;
	line-clamp: 1;
}

/* ---------- Category list (wp_list_categories sidebar) ----------
 * Spacing between list items (Bootstrap list styling is no longer present once
 * the active theme's assets are stripped from Help Center pages). */
.cat-item {
	margin-bottom: 10px;
}


/* ---------- Search-results pagination ----------
 * Self-contained prev/status/next nav for the help search-results page: the
 * help asset bundle ships neither Bootstrap (.pagination) nor the FontAwesome
 * chevrons that pp_pagination_nav() relies on. */
.csh-search-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	margin: 28px 0 8px;
}

.csh-search-pagination a,
.csh-search-pagination-status {
	display: inline-block;
	padding: 8px 18px;
	border: 1px solid #e6e9ee;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.csh-search-pagination a {
	color: #0080c0; /* csh theme color */
	text-decoration: none;
}

.csh-search-pagination a:hover,
.csh-search-pagination a:focus {
	border-color: #0080c0;
}

/* ---------- Code blocks (wp-block-code) in help articles ----------
 * Scoped to the article-content wrapper so nothing outside the Help
 * Center is affected. frontend.js wraps each block in .help-code (the
 * non-scrolling anchor for the chip + copy button), splits the code into
 * .help-code-line spans and sets data-help-code. The block itself is
 * forced LTR (code reads left-to-right even on the RTL help pages) and
 * scrolls horizontally instead of wrapping, so lines stay intact. Line
 * numbers live on each line's ::before and are position:sticky — they
 * stay pinned at the left edge while the code scrolls under them. */
.csh-article-content-text .help-code {
	position: relative;
	margin: 20px 0;
}

.csh-article-content-text pre.wp-block-code {
	direction: ltr;
	text-align: left;
	background: #f6f8fa;
	border: 1px solid #e6e9ee;
	border-radius: 8px;
	margin: 0;
	/* top padding reserves the strip the floating chip + copy button sit in */
	padding: 42px 14px 14px 14px;
	overflow-x: auto;
	overflow-y: hidden;
	font-family: "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
	font-size: 13px;
	line-height: 1.75;
	color: #263238;
	tab-size: 4;
	counter-reset: helpcodeline;
	-webkit-overflow-scrolling: touch;
}

/* no-JS fallback: block not enhanced yet needs no reserved top strip */
.csh-article-content-text pre.wp-block-code:not( [data-help-code] ) {
	padding-top: 14px;
}

.csh-article-content-text pre.wp-block-code code {
	display: block;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	font: inherit;
	color: inherit;
	white-space: pre;
}

.help-code-line {
	display: block;
}

.help-code-line::before {
	counter-increment: helpcodeline;
	content: counter( helpcodeline );
	display: inline-block;
	/* fixed width keeps the code edge aligned for any count up to 999 */
	min-width: 2em;
	/* the gutter: pinned at the left edge, number right-aligned, then
	 * breathing room before the code — all opaque to hide scrolled text */
	padding-left: 14px;
	padding-right: 1.5em;
	text-align: right;
	color: #9aa3b2;
	user-select: none;
	position: sticky;
	left: 0;
	background: #f6f8fa;
}

/* single-line blocks carry no line number */
.help-code-single .help-code-line::before {
	content: none;
}

/* language chip (from the code element's language- class / lang attr) */
.help-code-lang {
	position: absolute;
	top: 13px;
	left: 15px;
	font-size: 11px;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: #9aa3b2;
	user-select: none;
}

/* copy button */
.help-code-copy {
	position: absolute;
	top: 7px;
	right: 8px;
	padding: 5px 14px;
	border: 1px solid #e6e9ee;
	border-radius: 6px;
	background: #fff;
	color: #5f6b7a;
	font-family: inherit;
	font-size: 12px;
	line-height: 1.5;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba( 0, 0, 0, .05 );
	transition: color .15s ease, border-color .15s ease;
}

.help-code-copy:hover,
.help-code-copy:focus-visible {
	color: #0080c0; /* csh theme color */
	border-color: #0080c0;
}

.help-code-copy:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px rgba( 0, 128, 192, .25 );
}

.help-code-copy.is-copied {
	color: #1a7f37;
	border-color: #1a7f37;
}

/* inline code inside help paragraphs (not part of a code block) */
.csh-article-content-text :not( pre ) > code {
	background: #f2f4f7;
	border: 1px solid #e6e9ee;
	border-radius: 4px;
	padding: 1px 6px;
	font-size: .9em;
	font-family: "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
	color: #263238;
}

/* ---------- Back-link arrow: optical alignment ----------
 * The theme draws the arrow as an inline-block ::before with
 * vertical-align:text-top and no margin-top; nudge it down 5px so it
 * centers against the label. The theme's -item variant (category badge)
 * has higher specificity and keeps its own -5px offset. */
nav .csh-navigation-back:before {
	margin-top: 5px;
}

/* ---------- Header search icon position ----------
 * The theme pins the .csh-header-search ::before icon 44px from the
 * right edge on RTL pages; pull it to 15px. Help pages are always RTL
 * (header-help.php hardcodes dir="rtl"), so only this variant applies. */
html[dir=rtl] header .csh-wrapper .csh-header-search:before {
	right: 15px;
	left: auto;
}
