/* =========================================================
   Custom Dashboard — khối đăng nhập/đăng ký gắn vào header theme
   Không phụ thuộc auth.css để dùng được ở mọi trang.
   ========================================================= */

.cdh {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	line-height: 1.2;
	vertical-align: middle;
}

.cdh * {
	box-sizing: border-box;
}

/* ---------- Nút ---------- */

.cdh__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 9px 16px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	border: 1px solid transparent;
	border-radius: calc(var(--cd-radius, 14px) - 4px);
	cursor: pointer;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.cdh__btn--primary,
.cdh__btn--primary:visited {
	background: var(--cd-primary, #2563eb);
	color: #fff;
}

.cdh__btn--primary:hover,
.cdh__btn--primary:focus {
	background: var(--cd-primary-dark, #1d4ed8);
	color: #fff;
}

.cdh__btn--ghost,
.cdh__btn--ghost:visited {
	background: transparent;
	color: inherit;
	border-color: currentColor;
	opacity: .85;
}

.cdh__btn--ghost:hover,
.cdh__btn--ghost:focus {
	opacity: 1;
	color: var(--cd-primary, #2563eb);
	border-color: var(--cd-primary, #2563eb);
}

/* ---------- Kiểu link (style="links") ---------- */

.cdh__link,
.cdh__link:visited {
	font-size: 14px;
	font-weight: 600;
	color: inherit;
	text-decoration: none;
	padding: 4px 2px;
}

.cdh__link:hover,
.cdh__link--strong {
	color: var(--cd-primary, #2563eb);
}

/* ---------- Nút mở menu người dùng ---------- */

.cdh__trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 5px 10px 5px 5px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	color: inherit;
	background: transparent;
	border: 1px solid rgba(125, 135, 150, .28);
	border-radius: 999px;
	cursor: pointer;
	max-width: 220px;
}

.cdh__trigger:hover {
	border-color: var(--cd-primary, #2563eb);
	color: var(--cd-primary, #2563eb);
}

.cdh__avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	flex: 0 0 auto;
}

.cdh__name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cdh__caret {
	flex: 0 0 auto;
	transition: transform .18s ease;
}

.cdh--user.is-open .cdh__caret {
	transform: rotate(180deg);
}

/* ---------- Menu xổ xuống ---------- */

.cdh__dropdown {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 999;
	min-width: 250px;
	padding: 8px;
	text-align: left;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 14px;
	box-shadow: 0 16px 40px rgba(15, 23, 42, .16);
}

.cdh__dropdown[hidden] {
	display: none;
}

.cdh__head {
	display: grid;
	gap: 2px;
	padding: 10px 12px 12px;
	margin-bottom: 6px;
	border-bottom: 1px solid #e2e8f0;
}

.cdh__head strong {
	font-size: 14.5px;
	color: #0f172a;
}

.cdh__head span {
	font-size: 12.5px;
	color: #64748b;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cdh__item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 9px 12px;
	font-size: 14px;
	font-weight: 500;
	font-family: inherit;
	text-align: left;
	color: #334155;
	text-decoration: none;
	background: transparent;
	border: 0;
	border-radius: 9px;
	cursor: pointer;
}

.cdh__item:hover,
.cdh__item:focus {
	background: #f1f5f9;
	color: var(--cd-primary, #2563eb);
}

.cdh__icon {
	width: 18px;
	height: 18px;
	flex: 0 0 auto;
}

.cdh__logout {
	margin: 6px 0 0;
	padding-top: 6px;
	border-top: 1px solid #e2e8f0;
}

.cdh__item--logout {
	color: #b91c1c;
}

.cdh__item--logout:hover {
	background: #fef2f2;
	color: #b91c1c;
}

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
	.cdh__name {
		display: none;
	}

	.cdh__dropdown {
		position: fixed;
		left: 12px;
		right: 12px;
		top: auto;
		min-width: 0;
	}
}
