/* ============================================================
 * Header
 * Desktop shell and brand styles migrated from Tailwind utilities.
 * ============================================================ */

.navbar {
	position: fixed !important;
	top: var(--wpadminbar-h, 0px) !important;
	left: 0;
	right: 0;
	z-index: 50;
	width: 100%;
	background-color: var(--bg-gray-50);
	box-shadow: var(--shadow-sm);
	transform: translateY(0);
	transition:
		background-color var(--transition-normal),
		color var(--transition-normal);
}

.navbar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	margin-right: auto;
	margin-left: auto;
	padding: 0.75rem 1rem;
}

/* ── Language Switcher (Desktop) ─────────────────────────────── */
.navbar__language {
	position: relative;
}

.navbar__language .rtf-lang-switcher,
.rtf-lang-switcher {
	position: relative;
	display: inline-block;
	text-align: left;
}

.navbar__language .rtf-lang-toggle,
.rtf-lang-toggle {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 2rem;
	padding: 0.25rem 0.5rem;
	border: 0;
	border-radius: 0.375rem;
	background: transparent;
	color: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: opacity var(--transition-normal);
}

.navbar__language .rtf-lang-toggle:hover,
.rtf-lang-toggle:hover {
	opacity: 0.7;
}

.navbar__language .rtf-lang-flag,
.navbar__language img.rtf-lang-flag,
.rtf-lang-flag {
	display: block;
	width: 26px;
	height: 18px;
	max-width: none;
	flex: 0 0 26px;
	object-fit: contain;
}

.navbar__language .rtf-lang-chevron,
.rtf-lang-chevron {
	display: block;
	width: 0.75rem;
	height: 0.75rem;
	color: #6b7280;
	transition: color var(--transition-normal);
}

.navbar__language .rtf-lang-menu,
.navbar__language [data-lang-menu],
.rtf-lang-menu {
	position: absolute;
	top: calc(100% + 0.35rem);
	right: 0;
	z-index: 99999;
	width: min(190px, calc(100vw - 2rem));
	max-height: 280px;
	overflow-y: auto;
	padding: 0.25rem 0.35rem;
	border: 1px solid #dbe3ef !important;
	border-radius: 0.5rem !important;
	background-color: #fff !important;
	color: #172033 !important;
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15) !important;
}

.navbar__language .rtf-lang-menu .rtf-lang-link,
.navbar__language [data-lang-menu] .rtf-lang-link,
.rtf-lang-menu .rtf-lang-link {
	display: flex;
	min-height: 40px;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem;
	border-radius: 0.375rem;
	color: #172033;
	font-size: 0.875rem;
	text-decoration: none;
	white-space: nowrap;
	transition: opacity var(--transition-fast, 150ms);
}

.navbar__language .rtf-lang-menu .rtf-lang-link:hover,
.navbar__language [data-lang-menu] .rtf-lang-link:hover,
.rtf-lang-menu .rtf-lang-link:hover {
	opacity: 0.5;
}

.navbar__language .rtf-lang-menu .rtf-lang-link.is-current,
.navbar__language [data-lang-menu] .rtf-lang-link.is-current,
.rtf-lang-menu .rtf-lang-link.is-current {
	border-radius: 0.375rem;
	background-color: rgba(18, 62, 138, 0.08) !important;
	color: var(--primary, #123e8a) !important;
	font-weight: 600 !important;
}

.navbar__language .rtf-lang-menu .rtf-lang-link.is-current::after,
.navbar__language [data-lang-menu] .rtf-lang-link.is-current::after,
.rtf-lang-menu .rtf-lang-link.is-current::after {
	content: '';
	display: inline-block;
	width: 1rem;
	height: 1rem;
	margin-left: auto;
	flex-shrink: 0;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat center / contain;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* Dark mode for language switcher */
body.dark-mode .navbar__language .rtf-lang-chevron,
body.dark-mode .rtf-lang-chevron {
	color: #9ca3af;
}

body.dark-mode .navbar__language .rtf-lang-menu,
body.dark-mode .navbar__language [data-lang-menu],
body.dark-mode .rtf-lang-menu {
	border-color: rgba(255, 255, 255, 0.12) !important;
	background-color: #1f232b !important;
	color: #f3f4f6 !important;
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .navbar__language .rtf-lang-menu .rtf-lang-link,
body.dark-mode .navbar__language [data-lang-menu] .rtf-lang-link,
body.dark-mode .rtf-lang-menu .rtf-lang-link {
	color: #f3f4f6;
}

body.dark-mode .navbar__language .rtf-lang-menu .rtf-lang-link:hover,
body.dark-mode .navbar__language [data-lang-menu] .rtf-lang-link:hover,
body.dark-mode .rtf-lang-menu .rtf-lang-link:hover {
	opacity: 0.5;
}

body.dark-mode .navbar__language .rtf-lang-menu .rtf-lang-link.is-current,
body.dark-mode .navbar__language [data-lang-menu] .rtf-lang-link.is-current,
body.dark-mode .rtf-lang-menu .rtf-lang-link.is-current {
	background-color: rgba(18, 62, 138, 0.28) !important;
	color: var(--text-primary, #f3f4f6) !important;
}

/* ── User menu (Desktop) ─────────────────────────────────────── */
.navbar__user-menu {
	position: absolute;
	top: calc(100% + 0.35rem);
	right: 0;
	z-index: 99999;
	width: min(200px, calc(100vw - 2rem));
	max-height: 320px;
	overflow-y: auto;
	padding: 0.25rem 0.35rem;
	border: 1px solid #dbe3ef !important;
	border-radius: 0.5rem !important;
	background-color: #fff !important;
	color: #172033 !important;
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15) !important;
}

.navbar__user-menu-link {
	display: flex;
	min-height: 40px;
	align-items: center;
	gap: 0.65rem;
	padding: 0.5rem;
	border-radius: 0.375rem;
	color: #172033;
	font-size: 0.875rem;
	font-weight: 500;
	white-space: nowrap;
	text-decoration: none;
	transition: opacity var(--transition-fast, 150ms);
}

.navbar__user-menu-link svg {
	width: 1rem;
	height: 1rem;
	flex-shrink: 0;
	color: inherit;
}

.navbar__user-menu-link:hover {
	opacity: 0.5;
}

.navbar__user-menu-link--danger {
	color: #ef4444 !important;
}

.navbar__user-menu-link--danger svg {
	color: #ef4444 !important;
}

.navbar__user-menu-link--danger:hover {
	background-color: #fef2f2 !important;
	color: #dc2626 !important;
}

.navbar__user-menu-link--danger:hover svg {
	color: #dc2626 !important;
}

.navbar__user-menu hr {
	display: none;
}

/* Dark mode for user menu */
body.dark-mode .navbar__user-menu {
	border-color: rgba(255, 255, 255, 0.12) !important;
	background-color: #1f232b !important;
	color: #f3f4f6 !important;
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .navbar__user-menu-link {
	color: #f3f4f6;
}

body.dark-mode .navbar__user-menu-link svg {
	color: #9ca3af;
}

body.dark-mode .navbar__user-menu-link:hover {
	opacity: 0.5;
}

body.dark-mode .navbar__user-menu-link--danger {
	color: #f87171 !important;
}

body.dark-mode .navbar__user-menu-link--danger svg {
	color: #f87171 !important;
}

body.dark-mode .navbar__user-menu-link--danger:hover {
	background-color: rgba(239, 68, 68, 0.15) !important;
	color: #fca5a5 !important;
}

body.dark-mode .navbar__user-menu-link--danger:hover svg {
	color: #fca5a5 !important;
}

.navbar__chevron {
	display: block;
	width: 0.75rem;
	height: 0.75rem;
	color: #6b7280;
	opacity: 1;
	transition:
		color var(--transition-normal),
		transform var(--transition-normal);
}

body.dark-mode .navbar__chevron {
	color: #9ca3af;
}

.navbar__brand {
	display: inline-flex;
	flex-direction: column;
	margin-top: auto;
	margin-bottom: auto;
	color: var(--primary);
	font-weight: 700;
	text-align: start;
	white-space: nowrap;
	cursor: pointer;
	user-select: none;
}

.navbar__logo {
	width: auto;
	height: 0.75rem;
	margin-bottom: 0.25rem;
	padding-top: 0.125rem;
}

.navbar__tagline {
	color: var(--primary);
	font-size: 0.5rem;
	font-weight: 600;
}

body.dark-mode .navbar__tagline {
	color: var(--color-white);
}

.navbar__desktop-search {
	display: none;
}

.navbar__mobile-search-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem;
	border: 0;
	border-radius: 0.375rem;
	background: transparent;
	color: var(--text-primary, #1f2937);
	cursor: pointer;
	transition: opacity var(--transition-fast, 150ms);
}

.navbar__mobile-search-toggle:hover {
	opacity: 0.5;
}

.navbar__mobile-search-toggle-icon,
.navbar__mobile-search-toggle svg {
	width: 1.35rem;
	height: 1.35rem;
	color: inherit;
	stroke: currentColor;
}

.navbar__search-form,
.navbar__search-control,
.navbar__search-input {
	width: 100%;
}

.navbar__search-control {
	position: relative;
	display: inline-block;
}

.navbar__search-icon {
	position: absolute;
	top: 50%;
	left: 0.75rem;
	width: 1.25rem;
	height: 1.25rem;
	color: var(--text-body);
	transform: translateY(-50%);
}

.navbar__search-input {
	padding: 0.375rem 0.75rem 0.375rem 2.5rem;
	border: 2px solid rgba(51, 51, 51, 0.2);
	border-radius: 9999px;
	background: transparent;
	color: var(--text-body);
	font-size: 0.875rem;
}

.navbar__search-input::placeholder {
	color: rgba(51, 51, 51, 0.6);
}

.navbar__search-input:focus {
	border-color: rgba(51, 51, 51, 0.3);
	outline: none;
}

body.dark-mode .navbar__search-icon {
	color: #9ca3af;
}

body.dark-mode .navbar__search-input {
	border-color: #374151;
	color: #e5e7eb;
}

body.dark-mode .navbar__search-input:focus {
	border-color: #6b7280;
}

.navbar__mobile-search-row {
	width: 100%;
	padding: 0.5rem 1rem 0.75rem;
	border-top: 1px solid var(--border-light, #e5e7eb);
	background-color: var(--bg-white, #ffffff);
}

#mobile-search-row.hidden {
	display: none;
}

.navbar__mobile-search-form,
.navbar__mobile-search-control,
.navbar__mobile-search-input {
	width: 100%;
}

.navbar__mobile-search-control {
	position: relative;
}

.navbar__mobile-search-icon {
	position: absolute;
	top: 50%;
	left: 0.75rem;
	color: #9ca3af;
	transform: translateY(-50%);
}

.navbar__mobile-search-input {
	padding: 0.375rem 2.25rem 0.375rem 2.5rem;
	border: 1px solid var(--border-medium, #d1d5db);
	border-radius: 9999px;
	background: transparent;
	color: var(--text-body);
	font-size: 0.875rem;
	transition: border-color var(--transition-fast);
}

.navbar__mobile-search-input::placeholder {
	color: rgba(51, 51, 51, 0.6);
}

.navbar__mobile-search-input:focus {
	border-color: rgba(51, 51, 51, 0.4);
	background: transparent;
	outline: none;
}

.navbar__mobile-search-close {
	position: absolute;
	top: 50%;
	right: 0.75rem;
	border: 0;
	background: transparent;
	color: #9ca3af;
	cursor: pointer;
	transform: translateY(-50%);
}

.navbar__mobile-search-close:hover {
	opacity: 0.8;
}

.navbar__search-input::-webkit-search-cancel-button,
.navbar__search-input::-webkit-search-decoration,
.navbar__search-input::-webkit-search-results-button,
.navbar__search-input::-webkit-search-results-decoration,
.navbar__mobile-search-input::-webkit-search-cancel-button,
.navbar__mobile-search-input::-webkit-search-decoration,
.navbar__mobile-search-input::-webkit-search-results-button,
.navbar__mobile-search-input::-webkit-search-results-decoration {
	-webkit-appearance: none !important;
	appearance: none !important;
	display: none !important;
	width: 0 !important;
	height: 0 !important;
}

.navbar__search-input::-ms-clear,
.navbar__mobile-search-input::-ms-clear {
	display: none !important;
	width: 0 !important;
	height: 0 !important;
}

/* Neutralize browser autofill background on search inputs */
.navbar__search-input:-webkit-autofill,
.navbar__search-input:-webkit-autofill:hover,
.navbar__search-input:-webkit-autofill:focus,
.navbar__search-input:-webkit-autofill:active,
.navbar__mobile-search-input:-webkit-autofill,
.navbar__mobile-search-input:-webkit-autofill:hover,
.navbar__mobile-search-input:-webkit-autofill:focus,
.navbar__mobile-search-input:-webkit-autofill:active {
	-webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
	box-shadow: 0 0 0 1000px #ffffff inset !important;
	-webkit-text-fill-color: var(--text-body, #333333) !important;
	caret-color: var(--text-body, #333333) !important;
	transition: background-color 50000s ease-in-out 0s !important;
}

/* Dark mode for mobile search */
body.dark-mode .navbar__mobile-search-row {
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	background-color: #202225 !important;
}

body.dark-mode .navbar__mobile-search-input {
	border-color: #374151 !important;
	background: transparent !important;
	color: #e5e7eb !important;
}

body.dark-mode .navbar__mobile-search-input::placeholder {
	color: #9ca3af;
}

body.dark-mode .navbar__mobile-search-input:focus {
	border-color: #6b7280 !important;
	background: transparent !important;
}

body.dark-mode .navbar__search-input:-webkit-autofill,
body.dark-mode .navbar__search-input:-webkit-autofill:hover,
body.dark-mode .navbar__search-input:-webkit-autofill:focus,
body.dark-mode .navbar__search-input:-webkit-autofill:active,
body.dark-mode .navbar__mobile-search-input:-webkit-autofill,
body.dark-mode .navbar__mobile-search-input:-webkit-autofill:hover,
body.dark-mode .navbar__mobile-search-input:-webkit-autofill:focus,
body.dark-mode .navbar__mobile-search-input:-webkit-autofill:active {
	-webkit-box-shadow: 0 0 0 1000px #202225 inset !important;
	box-shadow: 0 0 0 1000px #202225 inset !important;
	-webkit-text-fill-color: #e5e7eb !important;
	caret-color: #e5e7eb !important;
	transition: background-color 50000s ease-in-out 0s !important;
}

body.dark-mode .navbar__mobile-search-close:hover {
	color: #ffffff;
}

.navbar__actions {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.navbar__language,
.navbar__user,
.navbar__login-link {
	display: none;
}

.navbar__user {
	position: relative;
}

.navbar__user-toggle {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	border: 0;
	background: transparent;
	cursor: pointer;
	transition: opacity var(--transition-normal);
}

.navbar__user-toggle:hover {
	opacity: 0.7;
}

.navbar__avatar {
	width: 2rem;
	height: 2rem;
	border-radius: 9999px;
	object-fit: cover;
}

.navbar__user-name {
	display: none;
	font-size: 0.875rem;
	font-weight: 600;
}

.navbar__chevron {
	flex: 0 0 auto;
}

.navbar__login-link {
	font-size: 0.75rem;
	font-weight: 700;
	white-space: nowrap;
	text-decoration: none;
	cursor: pointer;
	transition: opacity var(--transition-normal);
}

.navbar__login-link:hover {
	opacity: 0.5;
}

.navbar__icon-button {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem;
	border: 0;
	border-radius: 0.375rem;
	background: transparent;
	color: var(--text-primary, #1f2937);
	cursor: pointer;
	transition: opacity var(--transition-fast, 150ms);
}

.navbar__icon-button:hover {
	opacity: 0.5;
}

.navbar__icon-button svg {
	width: 1.35rem;
	height: 1.35rem;
	color: inherit;
	stroke: currentColor;
}

/* Dark mode for navbar action buttons */
body.dark-mode .navbar__mobile-search-toggle,
body.dark-mode .navbar__icon-button,
body.dark-mode .mobile-nav-toggle {
	color: #f3f4f6;
}

body.dark-mode .navbar__mobile-search-toggle:hover,
body.dark-mode .navbar__icon-button:hover,
body.dark-mode .mobile-nav-toggle:hover {
	opacity: 0.5;
}

body.dark-mode .navbar__mobile-search-toggle-icon,
body.dark-mode .navbar__mobile-search-toggle svg,
body.dark-mode .navbar__icon-button svg,
body.dark-mode .mobile-nav-toggle svg {
	color: inherit;
	stroke: currentColor;
}

.navbar__primary {
	width: 100%;
	overflow: visible;
	background-color: var(--primary);
	color: #ffffff;
	transition:
		background-color var(--transition-normal),
		color var(--transition-normal);
}

.navbar__primary-inner {
	display: none;
}

@media (min-width: 768px) {

	.navbar__mobile-search-toggle,
	.navbar__mobile-search-row {
		display: none;
	}

	.navbar__desktop-search {
		display: block;
		flex: 1 1 0%;
		max-width: 280px;
		margin-right: 0.75rem;
		margin-left: 0.75rem;
	}

	.navbar__language,
	.navbar__user {
		display: block;
	}

	.navbar__login-link {
		display: inline-block;
	}

	.navbar__primary-inner {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: center;
		gap: 2rem;
		margin-right: auto;
		margin-left: auto;
		padding: 0.75rem 2rem;
		text-transform: uppercase;
	}

	.navbar__language {
		flex: 0 0 auto;
	}

	.navbar__logo {
		height: 1rem;
	}

	.navbar__tagline {
		font-size: 0.625rem;
	}
}

@media (min-width: 1024px) {
	.navbar__desktop-search {
		max-width: 480px;
		margin-right: 1.5rem;
		margin-left: 1.5rem;
	}

	.navbar__actions {
		gap: 1.5rem;
	}

	.navbar__user-name {
		display: inline;
	}

	.navbar__login-link {
		font-size: 0.875rem;
	}

	.navbar__primary-inner {
		gap: 3rem;
	}
}

@media (min-width: 1280px) {
	.navbar__primary-inner {
		gap: 5rem;
	}
}

/* ── "Khác" (More) Dropdown Menu ────────────────────────────── */
.nav-more-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.nav-more-toggle {
	font-family: inherit;
	line-height: inherit;
}

.nav-more-chevron {
	width: 0.75rem;
	height: 0.75rem;
}

.nav-more-menu {
	position: absolute;
	top: calc(100% + 0.35rem);
	right: 0;
	z-index: 99999;
	width: min(200px, calc(100vw - 2rem));
	max-height: 280px;
	overflow-y: auto;
	padding: 0.25rem 0.35rem;
	border: 1px solid #dbe3ef !important;
	border-radius: 0.5rem !important;
	background-color: #fff !important;
	color: #172033 !important;
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15) !important;
	text-transform: none;
}

/* Invisible hover bridge to eliminate gap between toggle and menu */
.nav-more-menu::before {
	content: '';
	position: absolute;
	bottom: 100%;
	left: -20px;
	right: -20px;
	height: 16px;
	background: transparent;
}

.nav-more-item {
	display: flex;
	min-height: 40px;
	align-items: center;
	padding: 0.5rem 0.65rem;
	border-radius: 0.375rem;
	color: #172033 !important;
	font-size: 0.875rem;
	font-weight: 500;
	white-space: nowrap;
	text-decoration: none;
	transition: opacity var(--transition-fast, 150ms);
}

.nav-more-item:hover {
	opacity: 0.5;
}

.nav-more-item.is-active {
	border-radius: 0.375rem;
	background-color: rgba(18, 62, 138, 0.08) !important;
	color: var(--primary, #123e8a) !important;
	font-weight: 600 !important;
}

.nav-more-item.is-active::after {
	content: '';
	display: inline-block;
	width: 1rem;
	height: 1rem;
	margin-left: auto;
	flex-shrink: 0;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat center / contain;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* Dark mode for nav-more-menu */
body.dark-mode .nav-more-menu {
	border-color: rgba(255, 255, 255, 0.12) !important;
	background-color: #1f232b !important;
	color: #f3f4f6 !important;
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .nav-more-item {
	color: #f3f4f6 !important;
}

body.dark-mode .nav-more-item:hover {
	opacity: 0.5;
}

body.dark-mode .nav-more-item.is-active {
	background-color: rgba(18, 62, 138, 0.28) !important;
	color: var(--text-primary, #f3f4f6) !important;
}
