/**
 * Cablebabe Finder Styles
 *
 * All Cable Finder-specific CSS. Consumes theme.json tokens directly
 * (--wp--preset--*, --wp--custom--*).
 *
 * Uses cf- prefix for all class names (finder plugin namespace).
 *
 * @package CablebabeFinder
 * @since 1.0.0
 * @since 1.0.0-beta.6 Rewrote to consume theme.json presets directly; gp-compat shim removed.
 *                     Removed non-conformant box-shadow on .cf-result-card--best
 *                     (design system rule: no shadows; elevation via hairline borders only).
 *                     Status colours (warn/danger/info/neutral/caution) now reference
 *                     theme.json settings.custom.status.*.
 * @since 1.0.0-beta.7 CTA alignment to design system:
 *                     - .cf-result-card__cta flipped from ghost/outline to primary filled
 *                       (matches design-system/preview/result-card.html .cta rule).
 *                     - "Find My Cable" submit button now uses wp-element-button class
 *                       (in cf-template.php) so theme.json elements.button styling applies.
 */

/* ==========================================================================
   Cable Finder Form
   ========================================================================== */

.cf-cable-finder__devices {
	display: flex;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--40);
	margin-bottom: var(--wp--preset--spacing--50);
}

.cf-cable-finder__device {
	flex: 1;
}

.cf-cable-finder__arrow {
	display: flex;
	align-items: center;
	padding-top: var(--wp--preset--spacing--60);
	font-size: 1.5rem;
	color: var(--wp--preset--color--accent);
}

.cf-cable-finder__label {
	display: block;
	margin-bottom: var(--wp--preset--spacing--20);
	font-weight: 500;
	color: var(--wp--preset--color--contrast);
}

.cf-cable-finder__help {
	margin: var(--wp--preset--spacing--20) 0 0;
	font-size: 0.85em;
	color: var(--wp--preset--color--contrast-soft);
}

/* Filter row */
.cf-cable-finder__filters {
	display: flex;
	gap: var(--wp--preset--spacing--20);
	margin-bottom: var(--wp--preset--spacing--20);
}

.cf-cable-finder__filter {
	flex: 1;
	min-width: 0;
}

/* Native filter selects (Device Type, Brand) — styled to match the
   Tom Select device dropdowns below them. appearance: none strips the
   native chevron, so we paint our own as a background-image. */
.cf-cable-finder__filter select {
	width: 100%;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	padding: 0.5rem 2rem 0.5rem 0.65rem;
	font-family: inherit;
	font-size: inherit;
	line-height: 1.4;
	color: var(--wp--preset--color--contrast);
	background-color: var(--wp--preset--color--surface);
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%23575760' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='1,1.5 6,6.5 11,1.5'/></svg>");
	background-repeat: no-repeat;
	background-position: right 0.65rem center;
	background-size: 0.7rem auto;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 4px;
	cursor: pointer;
}

.cf-cable-finder__filter select:focus {
	outline: none;
	border-color: var(--wp--preset--color--accent);
	box-shadow: 0 0 0 1px var(--wp--preset--color--accent); /* focus ring — matches .ts-control */
}

/* Submit button */
.cf-cable-finder__submit {
	text-align: center;
	margin-top: var(--wp--preset--spacing--50);
}

.cf-cable-finder__button.is-loading {
	opacity: 0.7;
	cursor: wait;
}

/* ==========================================================================
   Results — Base Styles
   ========================================================================== */

.cf-cable-finder__results {
	margin-top: var(--wp--preset--spacing--60);
}

.cf-result {
	padding: var(--wp--preset--spacing--50);
	border-radius: 4px;
	border-left: 4px solid var(--wp--preset--color--accent);
	background: var(--wp--preset--color--base);
}

.cf-result--success {
	border-left-color: var(--wp--preset--color--accent-green);
}

.cf-result--no-match {
	border-left-color: var(--wp--custom--status--warn--border);
}

.cf-result--error,
.cf-result--warning {
	border-left-color: var(--wp--custom--status--danger--border);
}

.cf-result__header {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--30);
	margin-bottom: var(--wp--preset--spacing--40);
}

.cf-result__icon {
	font-size: 1.5rem;
}

.cf-result__title {
	margin: 0;
}

/* ==========================================================================
   Result Cards — one per real cable match
   ========================================================================== */

.cf-result__cables {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.cf-result-card {
	background: var(--wp--preset--color--surface);
	border-radius: 4px;
	padding: 1.25rem;
	border: 1px solid var(--wp--preset--color--border);
}

/* Best-match emphasis: 2px accent-green border + faint green tint.
   Per design system: no shadow — elevation is hairline-only. */
.cf-result-card--best {
	border: 2px solid var(--wp--preset--color--accent-green);
	background: rgba(34, 133, 75, 0.04); /* accent-green @ 4% — flagged as an allowed tint */
}

/* Header row — entire row is a clickable <a> linking to cable page */
.cf-result-card__header {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);
	margin-bottom: var(--wp--preset--spacing--40);
	padding: 0.6rem var(--wp--preset--spacing--30);
	border-radius: 4px;
	text-decoration: none;
	color: inherit;
	transition: background var(--wp--custom--motion--dur-fast) var(--wp--custom--motion--ease);
}

.cf-result-card__header:hover {
	background: var(--wp--preset--color--base);
	color: inherit;
	text-decoration: none;
}

.cf-result-card__title {
	margin: 0;
	font-size: 1.1em;
	color: var(--wp--preset--color--accent);
}

/* CTA button at the end of the header row — primary filled per design system */
.cf-result-card__cta {
	margin-left: auto;
	padding: 0.5rem 0.875rem;
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--surface);
	border-radius: 4px;
	font-size: 0.7rem;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	white-space: nowrap;
	transition: background var(--wp--custom--motion--dur-fast) var(--wp--custom--motion--ease);
}

.cf-result-card__header:hover .cf-result-card__cta {
	background: var(--wp--preset--color--accent-hover);
}

/* ==========================================================================
   Connection Diagram
   ========================================================================== */

.cf-connection-diagram {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin: var(--wp--preset--spacing--40) 0;
	padding: var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--base);
	border-radius: 4px;
	font-size: 0.9em;
	flex-wrap: wrap;
	justify-content: center;
}

.cf-connection-diagram__device {
	font-weight: 500;
	color: var(--wp--preset--color--contrast);
}

.cf-connection-diagram__port {
	padding: 0.2rem var(--wp--preset--spacing--20);
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 3px;
	font-family: monospace;
	font-size: 0.9em;
}

.cf-connection-diagram__cable {
	color: var(--wp--preset--color--contrast-soft);
}


/* ==========================================================================
   Effective Specs Display
   ========================================================================== */

.cf-effective-specs {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);
	margin: var(--wp--preset--spacing--30) 0;
	padding: 0;
	font-size: 0.85em;
}

.cf-effective-specs__item {
	color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--base);
	padding: 0.3rem 0.65rem;
	border-radius: 4px;
}

.cf-effective-specs__item strong {
	color: var(--wp--preset--color--contrast-soft);
	font-weight: 400;
	margin-right: 0.15em;
}

/* ==========================================================================
   Warnings — use theme.json status tokens (settings.custom.status.*)
   ========================================================================== */

.cf-warnings {
	margin: var(--wp--preset--spacing--30) 0;
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
}

.cf-warning {
	font-size: 0.9em;
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
	border-radius: 4px;
	background: var(--wp--custom--status--warn--bg);
	color: var(--wp--custom--status--warn--fg);
	border-left: 3px solid var(--wp--custom--status--warn--border);
}

.cf-warning--dangerous_cable,
.cf-warning--usb2_charging_only,
.cf-warning--severity-critical {
	background: var(--wp--custom--status--danger--bg);
	color: var(--wp--custom--status--danger--fg);
	border-left-color: var(--wp--custom--status--danger--border);
}

.cf-warning--directional_cable,
.cf-warning--severity-info {
	background: var(--wp--custom--status--info--bg);
	color: var(--wp--custom--status--info--fg);
	border-left-color: var(--wp--custom--status--info--border);
}

.cf-warning--bandwidth_limited {
	background: var(--wp--custom--status--neutral--bg);
	color: var(--wp--custom--status--neutral--fg);
	border-left-color: var(--wp--custom--status--neutral--border);
}

.cf-warning--proprietary_connector,
.cf-warning--severity-warning {
	background: var(--wp--custom--status--caution--bg);
	color: var(--wp--custom--status--caution--fg);
	border-left-color: var(--wp--custom--status--caution--border);
}

.cf-warning__title {
	display: block;
	margin-bottom: var(--wp--preset--spacing--10);
}

/* ==========================================================================
   Affiliate Links — Tiered
   ========================================================================== */

.cf-affiliate-links {
	margin-top: var(--wp--preset--spacing--40);
	padding-top: var(--wp--preset--spacing--40);
	border-top: 1px solid var(--wp--preset--color--border);
}

.cf-affiliate-links__title {
	margin: 0 0 var(--wp--preset--spacing--30);
	font-size: 0.9em;
	font-weight: 500;
}

.cf-affiliate-links__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);
}

.cf-affiliate-link {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--40);
	text-decoration: none;
	border-radius: 4px;
	font-size: 0.9em;
	transition: background var(--wp--custom--motion--dur-base) var(--wp--custom--motion--ease),
	            transform var(--wp--custom--motion--dur-fast) var(--wp--custom--motion--ease);
}

.cf-affiliate-link:hover {
	transform: translateY(-1px);
}

/* Budget Pick tier */
.cf-affiliate-link--value {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--contrast);
	border: 1px solid var(--wp--preset--color--border);
}

.cf-affiliate-link--value:hover {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

/* Our Pick tier */
.cf-affiliate-link--recommended {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--surface);
}

.cf-affiliate-link--recommended:hover {
	background: var(--wp--preset--color--accent-hover);
	color: var(--wp--preset--color--surface);
}

/* Performance Pick tier — darkest tier, uses contrast token */
.cf-affiliate-link--premium {
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--surface);
}

.cf-affiliate-link--premium:hover {
	background: #444; /* intentional lift-off-contrast for premium hover; not a token */
	color: var(--wp--preset--color--surface);
}

.cf-affiliate-link__tier {
	font-weight: 600;
	font-size: 0.85em;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.cf-affiliate-link__price {
	opacity: 0.85;
	font-size: 0.9em;
}

/* ==========================================================================
   Badges — passive labels/tags (not buttons)
   ========================================================================== */

.cf-badge {
	display: inline-block;
	padding: 0.15em 0.5em;
	font-size: 0.7em;
	font-weight: 500;
	border-radius: 9999px;
	letter-spacing: 0.02em;
	pointer-events: none;
}

.cf-badge--best {
	/* accent-green tinted — rgbas match #22854b by construction */
	background: rgba(34, 133, 75, 0.1);
	color: var(--wp--preset--color--accent-green);
	border: 1px solid rgba(34, 133, 75, 0.3);
}

.cf-badge--alt {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast-soft);
	border: 1px solid var(--wp--preset--color--border);
}

.cf-badge--protocol {
	/* Protocol-blue tinted — not using --accent-blue because the tint hue differs slightly */
	background: rgba(21, 101, 192, 0.08);
	color: #1565C0;
	border: 1px solid rgba(21, 101, 192, 0.2);
}

/* ==========================================================================
   Failed Requirements
   ========================================================================== */

.cf-failed-requirements {
	margin-top: var(--wp--preset--spacing--40);
}

.cf-failed-requirement {
	padding: var(--wp--preset--spacing--30);
	margin-bottom: var(--wp--preset--spacing--20);
	background: var(--wp--preset--color--base);
	border-radius: 4px;
}

.cf-failed-info__note {
	font-size: 0.85em;
	color: var(--wp--preset--color--contrast-soft);
	margin-top: var(--wp--preset--spacing--40);
	font-style: italic;
}


/* ==========================================================================
   Tom Select overrides — colour matching + model subtitle
   ========================================================================== */

.ts-wrapper.single .ts-control {
	border-color: var(--wp--preset--color--border);
	border-radius: 4px;
}

.ts-wrapper.single .ts-control:focus,
.ts-wrapper.single.focus .ts-control {
	border-color: var(--wp--preset--color--accent);
	box-shadow: 0 0 0 1px var(--wp--preset--color--accent); /* focus ring — not decorative */
}

.ts-dropdown .active {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

.cf-ts-option {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	padding: 0.15rem 0;
}

.cf-ts-option__name {
	font-weight: 500;
}

.cf-ts-option__model {
	font-size: 0.8em;
	color: var(--wp--preset--color--contrast-soft);
	font-family: monospace;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 600px) {
	.cf-cable-finder__devices {
		flex-direction: column;
	}

	.cf-cable-finder__arrow {
		padding: var(--wp--preset--spacing--20) 0;
		justify-content: center;
		transform: rotate(90deg);
	}

	.cf-connection-diagram {
		flex-direction: column;
		text-align: center;
	}

	.cf-connection-diagram__cable {
		display: none;
	}

	.cf-result-card__cta {
		margin-left: 0;
		flex-basis: 100%;
		text-align: center;
	}

	.cf-effective-specs {
		flex-direction: column;
		gap: 0.35rem;
	}

	.cf-affiliate-links__list {
		flex-direction: column;
	}

	.cf-affiliate-link {
		justify-content: center;
	}
}
