/* NE Design System -- modules/comparar.css -- (#142) */
/* Head-to-head driver comparison page */

/* ==========================================================================
   Hero
   ========================================================================== */

.ne-h2h-hero {
	position: relative;
	padding: var(--ne-space-10) var(--ne-space-5) var(--ne-space-8);
	text-align: center;
	overflow: hidden;
}

.ne-h2h-hero__bg {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.ne-h2h-hero__gradient {
	position: absolute;
	inset: 0;
	background: radial-gradient(ellipse at 50% 0%, rgba(139, 127, 232, 0.15) 0%, transparent 70%);
}

.ne-h2h-hero__content {
	position: relative;
	z-index: 1;
	max-width: 600px;
	margin: 0 auto;
}

.ne-h2h-hero__eyebrow {
	font-family: var(--ne-font-mono);
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	color: var(--ne-accent);
	margin-bottom: var(--ne-space-3);
}

.ne-h2h-hero__title {
	font-family: var(--ne-font-display);
	font-size: clamp(2rem, 5vw, 3rem);
	font-weight: 800;
	line-height: 1.1;
	color: var(--ne-text);
	margin-bottom: var(--ne-space-3);
}

.ne-h2h-hero__subtitle {
	font-size: 1.05rem;
	color: var(--ne-text-muted);
	line-height: 1.6;
	max-width: 480px;
	margin: 0 auto;
}

/* ==========================================================================
   Login prompt
   ========================================================================== */

.ne-h2h-login-prompt {
	text-align: center;
	padding: var(--ne-space-7) var(--ne-space-5);
}

.ne-h2h-login-prompt p {
	margin-bottom: var(--ne-space-4);
	color: var(--ne-text-muted);
}

/* ==========================================================================
   Driver selectors
   ========================================================================== */

.ne-h2h-selectors {
	display: flex;
	gap: var(--ne-space-4);
	align-items: flex-start;
	margin-bottom: var(--ne-space-6);
}

.ne-h2h-selector {
	flex: 1;
	min-width: 0;
}

.ne-h2h-selector__label {
	display: block;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--ne-text-muted);
	margin-bottom: var(--ne-space-2);
}

.ne-h2h-selector__input-wrap {
	position: relative;
}

.ne-h2h-selector__input {
	width: 100%;
	box-sizing: border-box;
}

/* VS divider */
.ne-h2h-vs {
	display: flex;
	align-items: center;
	justify-content: center;
	padding-top: var(--ne-space-5);
	font-family: var(--ne-font-serif);
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--ne-text-muted);
	flex-shrink: 0;
	min-width: 48px;
}

/* ==========================================================================
   Search results dropdown
   ========================================================================== */

.ne-h2h-selector__results {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 100;
	background: var(--ne-surface);
	border: 1px solid var(--ne-border-s);
	border-radius: var(--ne-radius);
	max-height: 280px;
	overflow-y: auto;
	display: none;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.ne-h2h-selector__results.is-open {
	display: block;
}

.ne-h2h-result {
	display: flex;
	align-items: center;
	gap: var(--ne-space-3);
	padding: var(--ne-space-3) var(--ne-space-4);
	cursor: pointer;
	transition: background var(--ne-duration) var(--ne-ease);
}

.ne-h2h-result:hover {
	background: var(--ne-overlay);
}

.ne-h2h-result__avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.ne-h2h-result__info {
	flex: 1;
	min-width: 0;
}

.ne-h2h-result__name {
	display: block;
	font-weight: 600;
	font-size: 0.875rem;
	color: var(--ne-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ne-h2h-result__meta {
	display: flex;
	gap: var(--ne-space-2);
	align-items: center;
	font-size: 0.75rem;
	color: var(--ne-text-muted);
}

.ne-h2h-result__no-results {
	padding: var(--ne-space-4);
	text-align: center;
	color: var(--ne-text-subtle);
	font-size: 0.8125rem;
}

/* ==========================================================================
   Selected driver card
   ========================================================================== */

.ne-h2h-selector__card {
	display: flex;
	align-items: center;
	gap: var(--ne-space-3);
	padding: var(--ne-space-3) var(--ne-space-4);
	background: var(--ne-surface);
	border: 1px solid var(--ne-border-s);
	border-radius: var(--ne-radius);
}

.ne-h2h-selector__avatar {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.ne-h2h-selector__info {
	flex: 1;
	min-width: 0;
}

.ne-h2h-selector__name {
	display: block;
	font-weight: 700;
	font-size: 1rem;
	color: var(--ne-text);
}

.ne-h2h-selector__meta {
	display: block;
	font-size: 0.75rem;
	color: var(--ne-text-muted);
}

.ne-h2h-selector__remove {
	background: none;
	border: none;
	color: var(--ne-text-muted);
	font-size: 1.25rem;
	cursor: pointer;
	padding: var(--ne-space-1) var(--ne-space-2);
	line-height: 1;
	border-radius: var(--ne-radius);
	transition: color var(--ne-duration) var(--ne-ease),
	            background var(--ne-duration) var(--ne-ease);
}

.ne-h2h-selector__remove:hover {
	color: var(--ne-red);
	background: var(--ne-overlay);
}

/* ==========================================================================
   Loading indicator
   ========================================================================== */

.ne-h2h-loading {
	text-align: center;
	padding: var(--ne-space-6) 0;
	color: var(--ne-text-muted);
	font-size: 0.875rem;
}

.ne-h2h-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid var(--ne-border-s);
	border-top-color: var(--ne-accent);
	border-radius: 50%;
	animation: spin 0.6s linear infinite;
	vertical-align: middle;
	margin-right: var(--ne-space-2);
}

/* ==========================================================================
   H2H Record bar
   ========================================================================== */

.ne-h2h-record {
	margin-bottom: var(--ne-space-5);
}

.ne-h2h-record__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: var(--ne-space-3);
}

.ne-h2h-record__driver {
	font-weight: 700;
	font-size: 0.875rem;
	color: var(--ne-text);
}

.ne-h2h-record__score {
	font-family: var(--ne-font-mono);
	font-weight: 700;
	font-size: 1.25rem;
	color: var(--ne-text);
	text-align: center;
}

.ne-h2h-record__ties {
	font-size: 0.75rem;
	color: var(--ne-text-muted);
}

.ne-h2h-record__bar {
	display: flex;
	height: 8px;
	border-radius: 4px;
	overflow: hidden;
	background: var(--ne-overlay);
	margin-bottom: var(--ne-space-2);
}

.ne-h2h-record__bar-d1 {
	background: var(--ne-accent);
	transition: width 0.5s ease;
}

.ne-h2h-record__bar-d2 {
	background: var(--ne-green);
	transition: width 0.5s ease;
}

.ne-h2h-record__pcts {
	display: flex;
	justify-content: space-between;
	font-size: 0.75rem;
	font-family: var(--ne-font-mono);
	color: var(--ne-text-muted);
}

/* ==========================================================================
   Stats grid
   ========================================================================== */

.ne-h2h-stats {
	margin-bottom: var(--ne-space-5);
}

.ne-h2h-stats__title {
	text-align: center;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--ne-text-muted);
	margin-bottom: var(--ne-space-4);
}

.ne-h2h-stats__row {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	padding: var(--ne-space-2) 0;
	border-bottom: 1px solid var(--ne-border);
}

.ne-h2h-stats__row:last-child {
	border-bottom: none;
}

.ne-h2h-stats__val {
	font-family: var(--ne-font-mono);
	font-weight: 600;
	font-size: 0.9375rem;
	color: var(--ne-text);
	padding: 0 var(--ne-space-3);
}

.ne-h2h-stats__val--left {
	text-align: right;
}

.ne-h2h-stats__val--right {
	text-align: left;
}

.ne-h2h-stats__val.is-better {
	color: var(--ne-accent);
}

.ne-h2h-stats__label {
	text-align: center;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--ne-text-subtle);
	white-space: nowrap;
	padding: 0 var(--ne-space-2);
	min-width: 100px;
}

/* ==========================================================================
   ELO Chart
   ========================================================================== */

.ne-h2h-chart-wrap {
	margin-bottom: var(--ne-space-5);
}

.ne-h2h-chart {
	position: relative;
	height: 350px;
}

/* ==========================================================================
   Shared races table
   ========================================================================== */

.ne-h2h-shared {
	margin-bottom: var(--ne-space-5);
}

.ne-h2h-shared .ne-table {
	font-size: 0.8125rem;
}

.ne-h2h-shared .ne-table th {
	font-size: 0.6875rem;
}

.ne-h2h-shared__d1-col,
.ne-h2h-shared__d2-col {
	text-align: center;
	white-space: nowrap;
}

.ne-h2h-shared__winner {
	color: var(--ne-accent);
	font-weight: 700;
}

.ne-h2h-shared__dnf {
	color: var(--ne-red);
	font-weight: 600;
}

.ne-h2h-shared__event-link {
	color: var(--ne-text);
	text-decoration: none;
}

.ne-h2h-shared__event-link:hover {
	color: var(--ne-accent);
}

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

@media (max-width: 767px) {
	.ne-h2h-selectors {
		flex-direction: column;
	}

	.ne-h2h-vs {
		padding: var(--ne-space-2) 0;
		font-size: 1.25rem;
	}

	.ne-h2h-chart {
		height: 250px;
	}

	.ne-h2h-stats__label {
		min-width: 70px;
		font-size: 0.625rem;
	}

	.ne-h2h-stats__val {
		font-size: 0.8125rem;
	}

	.ne-h2h-record__header {
		flex-direction: column;
		gap: var(--ne-space-2);
		text-align: center;
	}

	/* Hide event column on mobile for shared races */
	.ne-h2h-shared .ne-table th:nth-child(3),
	.ne-h2h-shared .ne-table td:nth-child(3) {
		display: none;
	}

	/* Larger touch target for remove button */
	.ne-h2h-selector__remove {
		min-width: 44px;
		min-height: 44px;
	}
}
