/**
 * Al-Hadaf — Match Hub components
 * Styles for match details: info, events timeline, lineups pitch, stats, h2h.
 *
 * @package Alhadaf
 */

.kora-hub-wrap {
	--kh-ink: #0f172a;
	--kh-muted: #64748b;
	--kh-line: #e2e8f0;
	--kh-line-soft: #eef2f7;
	--kh-surface: #ffffff;
	--kh-surface-2: #f8fafc;
	--kh-accent: #e63946;
	--kh-green: #16a34a;
	--kh-radius: 16px;

	direction: rtl;
	font-family: inherit;
	color: var(--kh-ink);
	background: var(--kh-surface);
	border: 1px solid var(--kh-line);
	border-radius: var(--kh-radius);
	overflow: hidden;
}

.kora-hub-wrap *,
.kora-hub-wrap *::before,
.kora-hub-wrap *::after {
	box-sizing: border-box;
}

/* Tabs ------------------------------------------------------------------ */

.kh-nav-bar {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	padding: 10px;
	background: var(--kh-surface-2);
	border-bottom: 1px solid var(--kh-line);
	scrollbar-width: none;
}

.kh-nav-bar::-webkit-scrollbar {
	display: none;
}

.kh-btn {
	flex: 0 0 auto;
	padding: 9px 14px;
	border: 1px solid transparent;
	border-radius: 10px;
	background: transparent;
	color: var(--kh-muted);
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 700;
	white-space: nowrap;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.kh-btn:hover {
	background: #fff;
	color: var(--kh-ink);
}

.kh-btn.active {
	background: var(--kh-accent);
	color: #fff;
	box-shadow: 0 6px 14px rgba(230, 57, 70, 0.22);
}

.kh-pane {
	display: none;
	padding: 18px;
}

.kh-pane.active {
	display: block;
}

/* Info ------------------------------------------------------------------ */

.kh-info-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 12px;
}

.kh-info-box {
	display: grid;
	gap: 4px;
	padding: 14px 16px;
	background: var(--kh-surface-2);
	border: 1px solid var(--kh-line-soft);
	border-radius: 12px;
}

.kh-badge-title {
	font-size: 11px;
	font-weight: 700;
	color: var(--kh-muted);
}

.kh-badge-val {
	font-size: 13.5px;
	font-weight: 800;
	color: var(--kh-ink);
	line-height: 1.5;
}

/* Events timeline ------------------------------------------------------- */

.kh-timeline {
	display: grid;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.kh-tl-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr);
	align-items: center;
	gap: 6px;
	padding: 8px 10px;
	border-radius: 12px;
	background: var(--kh-surface-2);
	border: 1px solid var(--kh-line-soft);
}

.kh-tl-side {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.kh-tl-home {
	justify-content: flex-end;
	text-align: right;
}

.kh-tl-away {
	justify-content: flex-start;
	text-align: left;
}

.kh-tl-icon {
	flex: 0 0 auto;
	font-size: 15px;
	line-height: 1;
}

.kh-tl-text {
	display: grid;
	gap: 1px;
	min-width: 0;
}

.kh-tl-text b {
	font-size: 12.5px;
	font-weight: 800;
	color: var(--kh-ink);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.kh-tl-text small {
	font-size: 10.5px;
	color: var(--kh-muted);
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.kh-tl-score {
	flex: 0 0 auto;
	padding: 2px 7px;
	border-radius: 6px;
	background: var(--kh-ink);
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

.kh-tl-min {
	justify-self: center;
	min-width: 44px;
	padding: 3px 6px;
	border-radius: 999px;
	background: #fff;
	border: 1px solid var(--kh-line);
	color: var(--kh-muted);
	font-size: 11px;
	font-weight: 800;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.kh-tl-break {
	display: flex;
	justify-content: center;
	padding: 7px 12px;
	border-radius: 999px;
	background: #f1f5f9;
	color: var(--kh-muted);
	font-size: 11.5px;
	font-weight: 800;
}

/* Lineups --------------------------------------------------------------- */

.kh-pitch-card {
	display: grid;
	gap: 14px;
}

.kh-pitch {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 10px;
	padding: 20px 14px;
	border-radius: 16px;
	background:
		radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, 0.08), transparent 60%),
		repeating-linear-gradient(180deg, #14532d 0 42px, #166534 42px 84px);
	overflow: hidden;
}

.kh-pitch::before {
	content: "";
	position: absolute;
	inset: 12px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 10px;
	pointer-events: none;
}

.kh-pitch::after {
	content: "";
	position: absolute;
	inset-inline-start: 50%;
	inset-block-start: 50%;
	width: 82px;
	height: 82px;
	margin-inline-start: -41px;
	margin-block-start: -41px;
	border: 1px solid rgba(255, 255, 255, 0.22);
	border-radius: 50%;
	pointer-events: none;
}

.kh-pitch-team {
	position: relative;
	z-index: 1;
	display: grid;
	gap: 12px;
	padding-block: 6px;
}

.kh-pitch-team--away {
	padding-block-end: 18px;
	border-bottom: 1px dashed rgba(255, 255, 255, 0.25);
}

.kh-formation {
	justify-self: flex-start;
	padding: 3px 9px;
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	font-size: 10.5px;
	font-weight: 700;
}

.kh-pitch-team--away .kh-formation {
	justify-self: flex-end;
}

.kh-pitch-line {
	display: flex;
	align-items: flex-start;
	justify-content: space-around;
	gap: 6px;
	width: 100%;
}

.kh-player {
	display: grid;
	justify-items: center;
	gap: 4px;
	flex: 1 1 0;
	min-width: 0;
	max-width: 96px;
}

.kh-player b {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: #fff;
	color: var(--kh-ink);
	font-size: 12px;
	font-weight: 800;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
	font-variant-numeric: tabular-nums;
}

.kh-player i {
	font-style: normal;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 1.3;
	text-align: center;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.kh-bench {
	padding: 14px 16px;
	background: var(--kh-surface-2);
	border: 1px solid var(--kh-line-soft);
	border-radius: 12px;
}

.kh-bench-title {
	margin: 0 0 8px;
	font-size: 12.5px;
	font-weight: 800;
	color: var(--kh-ink);
}

.kh-bench-list {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 6px 14px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.kh-bench-list li {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	color: var(--kh-ink);
	min-width: 0;
}

.kh-bench-list b {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	flex: 0 0 22px;
	border-radius: 6px;
	background: #e2e8f0;
	color: #475569;
	font-size: 10.5px;
	font-weight: 800;
}

.kh-bench-list span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.kh-bench-list small {
	margin-inline-start: auto;
	color: var(--kh-muted);
	font-size: 10.5px;
	font-weight: 600;
	white-space: nowrap;
}

/* Statistics ------------------------------------------------------------ */

.kh-stats-wrap {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.kh-stat-row {
	background: var(--kh-surface-2);
	border: 1px solid var(--kh-line-soft);
	padding: 10px 14px;
	border-radius: 10px;
}

.kh-stat-labels {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 6px;
	font-size: 13px;
	font-weight: 700;
	color: var(--kh-ink);
}

.kh-stat-labels .st-title {
	color: var(--kh-muted);
	font-size: 12px;
}

.kh-stat-bars {
	display: flex;
	height: 8px;
	border-radius: 4px;
	background: #e2e8f0;
	overflow: hidden;
	gap: 2px;
}

.kh-stat-bar.home {
	background: var(--kh-accent);
	transition: width 0.4s ease;
}

.kh-stat-bar.away {
	background: var(--kh-ink);
	transition: width 0.4s ease;
}

/* H2H ------------------------------------------------------------------- */

.kh-h2h-wrap {
	display: grid;
	gap: 10px;
}

.kh-h2h-row {
	background: var(--kh-surface-2);
	border: 1px solid var(--kh-line-soft);
	border-radius: 12px;
	padding: 10px 14px;
}

.h2h-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 6px;
	font-size: 11px;
	color: var(--kh-muted);
}

.h2h-match {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: 10px;
	font-size: 12.5px;
	font-weight: 700;
	color: var(--kh-ink);
}

.h2h-match span:last-child {
	text-align: left;
}

.h2h-score {
	padding: 4px 10px;
	border-radius: 8px;
	background: var(--kh-ink);
	color: #fff;
	font-size: 12.5px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

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

@media (max-width: 720px) {
	.kh-pane {
		padding: 14px;
	}

	.kh-tl-row {
		grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
		padding: 7px 8px;
	}

	.kh-tl-text b {
		font-size: 11.5px;
	}

	.kh-tl-text small {
		display: none;
	}

	.kh-player b {
		width: 26px;
		height: 26px;
		font-size: 11px;
	}

	.kh-player i {
		font-size: 9px;
	}

	.kh-bench-list {
		grid-template-columns: minmax(0, 1fr);
	}
}
