/**
 * DAF Marketplace — Header Topbar
 * Location: /wp-content/plugins/daf-marketplace/assets/css/header/header-topbar.css
 *
 * Purpose:
 * - Style the slim plugin-based marketplace utility top bar.
 * - Match the approved compact premium header direction.
 * - Keep left and right utility links clean, balanced, and lightweight.
 * - Support the native Marketplace Functions menu in the topbar right area.
 * - Respect saved Header Max-Width setting through CSS variables.
 */

.daf-mp-header__topbar {
	position: relative;
	z-index: 10001;
	width: 100%;
	background: #fff;
	border-bottom: 1px solid #e2e8f0;
	overflow: visible;
}

.daf-mp-header__topbar-inner,
.daf-mp-header__topbar-left,
.daf-mp-header__topbar-right,
.daf-mp-header-topbar-tools,
.daf-mp-header-topbar-actions,
.daf-mp-topbar-links,
.daf-mp-header__topbar .daf-mp-header-actions,
.daf-mp-header__topbar .daf-mp-header-account,
.daf-mp-header-marketplace-menu,
.daf-mp-header-marketplace-menu .menu,
.daf-mp-header-marketplace-menu__list {
	display: flex;
	align-items: center;
}

.daf-mp-header__topbar-inner {
	width: min(100% - 32px, var(--daf-mp-header-max-width, var(--daf-header-max-width, var(--daf-width-header, 1400px))));
	max-width: var(--daf-mp-header-max-width, var(--daf-header-max-width, var(--daf-width-header, 1400px)));
	min-height: 48px;
	margin-inline: auto;
	justify-content: space-between;
	gap: 20px;
}

.daf-mp-header__topbar-left,
.daf-mp-header__topbar-right {
	min-width: 0;
}

.daf-mp-header__topbar-left {
	flex: 0 1 auto;
}

.daf-mp-header__topbar-right {
	justify-content: flex-end;
	flex: 1 1 auto;
}

.daf-mp-header-topbar-tools {
	justify-content: flex-end;
	gap: 10px;
	min-width: 0;
	width: 100%;
}

.daf-mp-header-topbar-actions {
	flex: 0 0 auto;
	min-width: 0;
}

.daf-mp-topbar-links {
	gap: 0;
	min-width: 0;
	flex-wrap: nowrap;
}

.daf-mp-topbar-links--right {
	justify-content: flex-end;
}

.daf-mp-topbar-links__item {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 48px;
	padding: 0 16px;
	color: #64748b;
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	transition: color 0.2s ease;
}

.daf-mp-topbar-links__item:hover {
	color: #0f172a;
}

.daf-mp-topbar-links--left .daf-mp-topbar-links__item:first-child {
	padding-left: 0;
}

.daf-mp-topbar-links--right .daf-mp-topbar-links__item:last-child {
	padding-right: 0;
}

.daf-mp-topbar-links--left .daf-mp-topbar-links__item + .daf-mp-topbar-links__item::before,
.daf-mp-topbar-links--right .daf-mp-topbar-links__item + .daf-mp-topbar-links__item::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	width: 1px;
	height: 14px;
	background: #e2e8f0;
	transform: translateY(-50%);
}

.daf-mp-topbar-links__text {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.daf-mp-topbar-links--left .daf-mp-topbar-links__item:first-child .daf-mp-topbar-links__text::before {
	content: "";
	display: inline-block;
	width: 18px;
	height: 12px;
	border: 1px solid #d7dee8;
	border-radius: 2px;
	background: linear-gradient(to bottom, #b22234 0 14%, #ffffff 14% 28%, #b22234 28% 42%, #ffffff 42% 56%, #b22234 56% 70%, #ffffff 70% 84%, #b22234 84% 100%);
}

.daf-mp-topbar-links--left .daf-mp-topbar-links__item:nth-child(2) .daf-mp-topbar-links__text::before {
	content: "";
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 1.6px solid currentColor;
	border-radius: 999px;
	box-sizing: border-box;
	background:
		radial-gradient(circle at center, transparent 34%, currentColor 35% 37%, transparent 38%),
		linear-gradient(currentColor, currentColor) center/1.2px 100% no-repeat,
		linear-gradient(90deg, currentColor, currentColor) center/100% 1.2px no-repeat;
	opacity: 0.88;
}

/* Native Marketplace Functions menu */
.daf-mp-header-marketplace-menu {
	min-width: 0;
}

.daf-mp-header-marketplace-menu,
.daf-mp-header-marketplace-menu ul,
.daf-mp-header-marketplace-menu li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.daf-mp-header-marketplace-menu .menu,
.daf-mp-header-marketplace-menu__list {
	gap: 0;
	min-width: 0;
	flex-wrap: nowrap;
}

.daf-mp-header-marketplace-menu li {
	position: relative;
	display: flex;
	align-items: center;
}

.daf-mp-header-marketplace-menu li + li::before {
	display: none;
}

.daf-mp-header-marketplace-menu a {
	display: inline-flex;
	align-items: center;
	min-height: 48px;
	padding: 0 10px;
	color: #334155;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.2;
	white-space: nowrap;
	text-transform: none;
	letter-spacing: 0;
	text-decoration: none;
	transition: color 0.2s ease;
}

.daf-mp-header-marketplace-menu a:hover,
.daf-mp-header-marketplace-menu a:focus {
	color: #0f172a;
	outline: none;
	text-decoration: none;
}

.daf-mp-header-marketplace-menu .menu-item:first-child a,
.daf-mp-header-marketplace-menu li:first-child a {
	padding-left: 0;
}

.daf-mp-header-marketplace-menu .menu-item:last-child a,
.daf-mp-header-marketplace-menu li:last-child a {
	padding-right: 0;
}

.daf-mp-header-marketplace-menu .sub-menu {
	display: none;
}

/* Legacy fallback actions */
.daf-mp-header__topbar .daf-mp-header-actions {
	gap: 12px;
}

.daf-mp-header__topbar .daf-mp-header-action {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	color: #334155;
	transition: color 0.2s ease;
}

.daf-mp-header__topbar .daf-mp-header-action:hover {
	color: #0f172a;
}

.daf-mp-header__topbar .daf-mp-header-action__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 23px;
	height: 23px;
}

.daf-mp-header__topbar .daf-mp-header-action__icon svg {
	width: 100%;
	height: 100%;
}

.daf-mp-header__topbar .daf-mp-header-action__badge {
	position: absolute;
	top: -1px;
	right: -4px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 17px;
	height: 17px;
	padding: 0 4px;
	border: 2px solid #fff;
	border-radius: 999px;
	background: #2f855a;
	color: #fff;
	font-size: 9px;
	font-weight: 700;
	line-height: 1;
}

.daf-mp-header__topbar .daf-mp-header-action__text,
.daf-mp-header__topbar .daf-mp-header-account__text {
	display: none;
}

.daf-mp-header__topbar .daf-mp-header-account {
	gap: 0;
	min-height: 34px;
	padding-left: 2px;
	color: #0f172a;
}

.daf-mp-header__topbar .daf-mp-header-account__avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border: 1px solid #e2e8f0;
	border-radius: 999px;
	background: #f8fafc;
	color: #0f172a;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	overflow: hidden;
}

.daf-mp-header__topbar .daf-mp-header-account__avatar--image img,
.daf-mp-header__topbar .daf-mp-header-account__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 999px;
}

.daf-mp-header__topbar .daf-mp-header-account__chevron {
	display: none;
}

@media (max-width: 1200px) {
	.daf-mp-header__topbar-inner {
		width: min(100% - 28px, var(--daf-mp-header-max-width, var(--daf-header-max-width, var(--daf-width-header, 1400px))));
		gap: 14px;
	}

	.daf-mp-header-topbar-tools {
		gap: 8px;
	}

	.daf-mp-topbar-links__item {
		padding: 0 12px;
	}

	.daf-mp-header-marketplace-menu a {
		padding: 0 8px;
		font-size: 14px;
	}

	.daf-mp-header__topbar .daf-mp-header-actions {
		gap: 8px;
	}

	.daf-mp-header__topbar .daf-mp-header-action {
		width: 30px;
		height: 30px;
	}

	.daf-mp-header__topbar .daf-mp-header-action__icon {
		width: 20px;
		height: 20px;
	}

	.daf-mp-header__topbar .daf-mp-header-account__avatar {
		width: 38px;
		height: 38px;
	}
}

@media (max-width: 1024px) {
	.daf-mp-header__topbar {
		display: none;
	}
}