/**
 * HG Automotive — buyer favourites: card/single toggle control, account
 * nav links, and the Saved Vehicles grid.
 *
 * Uses existing design tokens/components only — no new colour system.
 *
 * @package HG_Automotive
 * @since 0.12.0
 */

/* Shared toggle button used by both favourites and comparison. */
.hg-auto-buyer-form {
	display: inline-flex;
	margin: 0;
}

.hg-auto-buyer-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	min-height: 2.5rem;
	padding: 0.5rem 0.9rem;
	border: 1px solid var(--hg-auto-color-border);
	border-radius: var(--hg-auto-radius);
	background: var(--hg-auto-color-surface-elevated);
	color: var(--hg-auto-color-ink);
	font: inherit;
	font-weight: 600;
	font-size: 0.875rem;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.hg-auto-buyer-action.is-loading {
	opacity: 0.72;
	cursor: wait;
}

.hg-auto-buyer-action:hover,
.hg-auto-buyer-action:focus-visible {
	border-color: var(--hg-auto-color-accent);
	color: var(--hg-auto-color-accent);
}

.hg-auto-buyer-action[disabled],
.hg-auto-buyer-action[aria-disabled="true"] {
	opacity: 0.6;
	cursor: not-allowed;
}

.hg-auto-buyer-action--favourite.is-active {
	background: var(--hg-auto-color-accent);
	border-color: var(--hg-auto-color-accent);
	color: #fff;
}

.hg-auto-buyer-action--favourite.is-active:hover,
.hg-auto-buyer-action--favourite.is-active:focus-visible {
	background: var(--hg-auto-color-accent-hover);
	border-color: var(--hg-auto-color-accent-hover);
	color: #fff;
}

/* Icon-only buyer actions (vehicle single header) — chrome-free; header CSS owns chrome. */
.hg-auto-buyer-action--icon {
	position: relative;
	width: auto;
	min-width: 0;
	min-height: 0;
	padding: 0;
	gap: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
}

.hg-auto-buyer-action__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 1.125rem;
	height: 1.125rem;
}

.hg-auto-buyer-action__icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.hg-auto-buyer-action--favourite .hg-auto-buyer-action__icon svg {
	fill: none;
}

.hg-auto-buyer-action--favourite.is-active .hg-auto-buyer-action__icon svg {
	fill: currentColor;
}

.hg-auto-buyer-action--icon .hg-auto-buyer-action__label {
	position: absolute;
	top: calc(100% + 0.4rem);
	left: 50%;
	z-index: 6;
	width: max-content;
	max-width: 12rem;
	padding: 0.35rem 0.55rem;
	border-radius: 0.35rem;
	background: var(--hg-auto-color-ink, #12171e);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transform: translateX(-50%) translateY(0.15rem);
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.hg-auto-buyer-action--icon:hover .hg-auto-buyer-action__label,
.hg-auto-buyer-action--icon:focus-visible .hg-auto-buyer-action__label,
.hg-auto-buyer-action--icon[aria-expanded="true"] .hg-auto-buyer-action__label {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* Compact actions row placed on vehicle cards. */
.hg-auto-vehicle-card__buyer-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--hg-auto-space-2);
	padding-top: var(--hg-auto-space-1);
}

/* Vehicle single actions row (kept separate from price/enquiry). */
.hg-auto-vs-header__buyer-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--hg-auto-space-3);
	margin-top: var(--hg-auto-space-4);
}

/* Header buyer account nav. */
.hg-auto-buyer-nav__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--hg-auto-space-4);
	list-style: none;
	margin: 0;
	padding: 0;
}

.hg-auto-buyer-nav__link {
	color: var(--hg-auto-color-ink);
	text-decoration: none;
	font-weight: 600;
	font-size: 0.875rem;
	white-space: nowrap;
}

.hg-auto-buyer-nav__link:hover,
.hg-auto-buyer-nav__link:focus-visible {
	color: var(--hg-auto-color-accent);
}

.hg-auto-buyer-nav__link--compare {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
}

/* Sits between the primary nav and the mobile toggle in the header. */
.hg-auto-header__inner .hg-auto-buyer-nav {
	margin-left: auto;
}

@media (max-width: 599px) {
	.hg-auto-header__inner {
		flex-wrap: wrap;
		row-gap: var(--hg-auto-space-2);
	}

	.hg-auto-header__inner .hg-auto-buyer-nav {
		margin-left: 0;
		order: 3;
		flex-basis: 100%;
	}

	.hg-auto-header__inner .hg-auto-buyer-nav__list {
		gap: var(--hg-auto-space-3);
	}
}

/* Saved Vehicles grid. */
.hg-auto-favourites__count {
	margin: 0 0 var(--hg-auto-space-4);
	color: var(--hg-auto-color-steel);
	font-size: 0.9375rem;
}

.hg-auto-favourites__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--hg-auto-space-5);
	margin-bottom: var(--hg-auto-space-6);
}

@media (min-width: 640px) {
	.hg-auto-favourites__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.hg-auto-favourites__grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

.hg-auto-favourite-card {
	display: flex;
	flex-direction: column;
	background: var(--hg-auto-color-surface-elevated);
	border: 1px solid var(--hg-auto-color-border);
	border-radius: var(--hg-auto-radius);
	overflow: hidden;
	box-shadow: var(--hg-auto-shadow);
}

.hg-auto-favourite-card__media {
	display: block;
	background: #e8edf2;
}

.hg-auto-favourite-card__media img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.hg-auto-favourite-card__body {
	display: flex;
	flex-direction: column;
	gap: var(--hg-auto-space-2);
	padding: var(--hg-auto-space-4);
	flex: 1 1 auto;
}

.hg-auto-favourite-card__title {
	margin: 0;
	font-family: var(--hg-auto-font-display);
	font-size: 1.0625rem;
	line-height: 1.3;
}

.hg-auto-favourite-card__title a {
	color: var(--hg-auto-color-ink);
	text-decoration: none;
}

.hg-auto-favourite-card__title a:hover,
.hg-auto-favourite-card__title a:focus-visible {
	color: var(--hg-auto-color-accent);
}

.hg-auto-favourite-card__price {
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.3rem;
	font-weight: 700;
	color: var(--hg-auto-color-ink);
}

.hg-auto-favourite-card__price .hg-auto-price-amounts {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.35rem 0.55rem;
}

.hg-auto-favourite-card__price-sale {
	color: var(--hg-auto-color-ink);
}

.hg-auto-favourite-card__price-regular {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--hg-auto-color-muted);
}

.hg-auto-favourite-card__meta {
	margin: 0;
	color: var(--hg-auto-color-muted);
	font-size: 0.8125rem;
}

.hg-auto-favourite-card__status {
	align-self: flex-start;
}

.hg-auto-favourite-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--hg-auto-space-2);
	margin-top: auto;
	padding-top: var(--hg-auto-space-2);
}

.hg-auto-favourite-card--unavailable {
	opacity: 0.85;
}

/* Pagination (mirrors dashboard pagination pattern). */
.hg-auto-buyer-pagination__list {
	display: flex;
	align-items: center;
	gap: var(--hg-auto-space-4);
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 0.9375rem;
}

.hg-auto-buyer-pagination__list a {
	font-weight: 600;
	text-decoration: none;
}

.hg-auto-buyer-pagination__list a:hover,
.hg-auto-buyer-pagination__list a:focus-visible {
	text-decoration: underline;
}

.hg-auto-buyer-pagination__status {
	color: var(--hg-auto-color-muted);
}

/* Live region for the JS-enhanced toggle announcements (visually hidden). */
.hg-auto-buyer-live-region {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
