/**
 * Noxora Hotfix & Premium Polish v4.26.1
 * Global icon sizing, search, categories, footer, AI backdrop, notifications.
 */

/* ── Persistent ecosystem backdrop (AI / modal stacking fix) ── */
html.noxora-html,
html.ns-story-html,
html.ns-tube-html,
html.ns-pro-html,
html.nx-landing-html,
html.noxora-profile-html {
	background-color: var(--nx-bg, #070707);
}

body.noxora-body::before,
body.ns-story-body::before,
body.ns-tube-body::before,
body.ns-pro-body::before,
body.nx-landing-body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -2;
	pointer-events: none;
	background:
		radial-gradient(ellipse 90% 60% at 50% -15%, rgba(225, 6, 0, 0.07), transparent 55%),
		radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 240, 255, 0.04), transparent 50%),
		var(--nx-bg, #070707);
	transform: translateZ(0);
	will-change: transform;
	backface-visibility: hidden;
}

.nx-ai-root {
	isolation: isolate;
	contain: layout style;
}

.nx-ai__panel {
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	background: rgba(10, 10, 12, 0.92);
}

/* ── Global icon button normalization ── */
.nx-icon-btn,
.ns-story-icon-btn,
.ns-tube-icon-btn,
.ns-pro-icon-btn,
.nx-notify__trigger,
.nx-shared-profile__trigger {
	width: 40px;
	height: 40px;
	min-width: 40px;
	min-height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px;
	padding: 0;
}

.ns-story-header__burger,
.ns-tube-site-header__burger,
.ns-pro-site-header__burger {
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	background: rgba(255, 255, 255, 0.04);
	border-radius: 10px;
	color: inherit;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.ns-story-header__burger span,
.ns-tube-site-header__burger span,
.ns-pro-site-header__burger span {
	display: none;
}

/* ── Header link icon alignment ── */
.nx-main-header__link,
.ns-story-header__link,
.ns-tube-site-header__link,
.ns-pro-site-header__link {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}

.nx-main-header__link svg,
.ns-story-header__link svg,
.ns-tube-site-header__link svg,
.ns-pro-site-header__link svg {
	flex-shrink: 0;
}

/* Sticky premium headers — see nx-header-system.css */

/* ── Category rail clamp ── */
.ns-story-cats-rail,
.ns-tube-cats-rail {
	max-height: clamp(44px, 8vh, 52px);
	overflow: hidden;
}

.ns-story-cats__btn,
.ns-tube-cats__btn {
	font-size: clamp(0.72rem, 2.2vw, 0.82rem);
	padding: clamp(0.35rem, 1.2vw, 0.5rem) clamp(0.55rem, 2vw, 0.85rem);
	max-height: 36px;
	white-space: nowrap;
	flex-shrink: 0;
}

.ns-story-mega__panel,
.ns-tube-mega__panel {
	max-height: min(68vh, 480px);
	overflow: auto;
	overscroll-behavior: contain;
}

.ns-story-mega__icon,
.ns-tube-mega__icon {
	width: clamp(28px, 4vw, 36px);
	height: clamp(28px, 4vw, 36px);
}

.ns-story-mega__grid,
.ns-tube-mega__grid {
	grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
	gap: clamp(0.45rem, 2vw, 0.75rem);
}

/* ── Global search — shared across all modules ── */
.nx-global-search {
	position: fixed;
	inset: 0;
	z-index: 500;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: clamp(1rem, 8vh, 4rem) 1rem;
}

.nx-global-search[hidden] {
	display: none !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

.nx-global-search__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.65);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	cursor: pointer;
}

.nx-global-search__panel {
	position: relative;
	width: min(92vw, 580px);
	border-radius: var(--nx-radius-xl, 20px);
	border: 1px solid var(--nx-border, rgba(255, 255, 255, 0.1));
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
	overflow: hidden;
	animation: nxSearchIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes nxSearchIn {
	from { opacity: 0; transform: translateY(-12px) scale(0.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.nx-global-search__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.15rem 0.5rem;
}

.nx-global-search__title {
	margin: 0;
	font-size: clamp(0.95rem, 2.5vw, 1.05rem);
	font-weight: 700;
	letter-spacing: -0.02em;
}

.nx-global-search__close {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border: none;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.05);
	color: inherit;
	cursor: pointer;
}

.nx-global-search__input-wrap {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	margin: 0 1rem 0.75rem;
	padding: 0 0.85rem;
	border-radius: 14px;
	border: 1px solid var(--nx-border, rgba(255, 255, 255, 0.08));
	background: rgba(0, 0, 0, 0.35);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.nx-global-search__input-wrap:focus-within {
	border-color: rgba(0, 240, 255, 0.45);
	box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.12);
}

.nx-global-search__input-icon {
	opacity: 0.7;
	flex-shrink: 0;
}

.nx-global-search__input {
	flex: 1;
	min-height: 48px;
	border: none;
	background: transparent;
	color: var(--nx-text, #f4f4f8);
	font: inherit;
	outline: none;
}

.nx-global-search__input::placeholder {
	color: var(--nx-muted, rgba(255, 255, 255, 0.45));
}

.nx-global-search__kbd {
	font-size: 0.68rem;
	padding: 0.2rem 0.45rem;
	border-radius: 6px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	opacity: 0.65;
}

.nx-global-search__body {
	padding: 0 1rem 1rem;
	max-height: min(50vh, 420px);
	overflow: auto;
}

.nx-global-search__section-title {
	margin: 0 0 0.55rem;
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--nx-muted);
}

.nx-global-search__modules {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.35rem;
}

.nx-global-search__module {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.65rem 0.75rem;
	border-radius: 12px;
	text-decoration: none;
	color: inherit;
	border: 1px solid transparent;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.nx-global-search__module:hover,
.nx-global-search__module:focus-visible {
	background: rgba(255, 255, 255, 0.05);
	border-color: rgba(0, 240, 255, 0.2);
	outline: none;
}

.nx-global-search__module-icon {
	width: 36px;
	height: 36px;
	display: grid;
	place-items: center;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.04);
	flex-shrink: 0;
}

.nx-global-search__module-text {
	display: grid;
	gap: 0.1rem;
}

.nx-global-search__module-text strong {
	font-size: 0.88rem;
}

.nx-global-search__module-text span {
	font-size: 0.75rem;
	color: var(--nx-muted);
}

.nx-global-search__recent {
	list-style: none;
	margin: 0 0 1rem;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.nx-global-search__recent-btn {
	border: 1px solid var(--nx-border, rgba(255, 255, 255, 0.08));
	background: rgba(255, 255, 255, 0.04);
	color: inherit;
	border-radius: 999px;
	padding: 0.35rem 0.75rem;
	font-size: 0.78rem;
	cursor: pointer;
}

.nx-global-search__content {
	display: grid;
	gap: 0.75rem;
	max-height: 280px;
	overflow: auto;
}

.nx-global-search__content-group h4 {
	margin: 0 0 0.35rem;
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--nx-muted);
}

.nx-global-search__content-item {
	display: grid;
	gap: 0.1rem;
	padding: 0.45rem 0.55rem;
	border-radius: 8px;
	text-decoration: none;
	color: inherit;
	border: 1px solid rgba(255, 255, 255, 0.06);
}

.nx-global-search__content-item:hover {
	background: rgba(124, 92, 255, 0.1);
	border-color: rgba(124, 92, 255, 0.25);
}

.nx-global-search__content-item span {
	font-size: 0.72rem;
	color: var(--nx-muted);
}

/* ── Notification bell polish ── */
.nx-notify__trigger:hover,
.nx-notify__trigger:focus-visible {
	background: rgba(255, 255, 255, 0.1);
	outline: none;
}

.nx-notify__badge:not([hidden]) {
	animation: nxNotifyPulse 2s ease-in-out infinite;
}

@keyframes nxNotifyPulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.08); }
}

.nx-notify__trigger:hover .nx-notify__badge:not([hidden]) {
	box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}

/* ── Author profile card (reading mode) ── */
.ns-story-article-header__author-link {
	text-decoration: none;
	color: inherit;
	cursor: pointer;
	transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.ns-story-article-header__author-link:hover,
.ns-story-article-header__author-link:focus-visible {
	transform: translateY(-1px);
	border-color: rgba(196, 30, 58, 0.45);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	outline: none;
}

.ns-story-article-header__author-xp {
	font-size: 0.65rem;
	color: var(--nx-gold, #d4af37);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

/* ── Story action bar link button ── */
.ns-story-actions__link {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 0.15rem;
	border: none;
	background: transparent;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
	font: inherit;
	padding: 0.35rem 0.5rem;
	border-radius: 10px;
}

/* ── Enterprise Story footer ── */
.ns-story-footer--enterprise {
	margin-top: 2rem;
	padding: clamp(1.25rem, 4vw, 2rem);
	border-radius: 20px 20px 0 0;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ns-story-footer__grid--enterprise {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
	gap: clamp(1rem, 3vw, 1.75rem);
}

.ns-story-footer--enterprise .ns-story-footer__col h4 {
	margin: 0 0 0.65rem;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--nx-muted);
}

.ns-story-footer--enterprise .ns-story-footer__col ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.4rem;
}

.ns-story-footer--enterprise .ns-story-footer__col a,
.ns-story-footer--enterprise .ns-story-footer__btn {
	font-size: 0.84rem;
	color: var(--nx-text-secondary, #c8c8d4);
	text-decoration: none;
}

.ns-story-footer__bottom--enterprise {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-top: 1.25rem;
	padding-top: 1rem;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Pro Marketplace hub ── */
.ns-pro-marketplace-hub {
	margin: 1.5rem 0;
	padding: clamp(1rem, 3vw, 1.5rem);
	border-radius: 18px;
	border: 1px solid rgba(212, 175, 55, 0.15);
}

.ns-pro-marketplace-hub__banner {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1rem;
}

.ns-pro-marketplace-hub__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.ns-pro-marketplace-hub__search {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	margin-bottom: 1.25rem;
	padding: 0.5rem 0.75rem;
	border-radius: 14px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	background: rgba(0, 0, 0, 0.25);
}

.ns-pro-marketplace-hub__search input {
	flex: 1;
	min-height: 44px;
	border: none;
	background: transparent;
	color: inherit;
	font: inherit;
	outline: none;
}

.ns-pro-marketplace-hub__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
	gap: 0.85rem;
	width: 100%;
}

.ns-pro-marketplace-hub__grid--compact {
	grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
}

.ns-pro-marketplace-hub__section {
	margin-bottom: 1.25rem;
}

.ns-pro-marketplace-hub__section h3 {
	margin: 0 0 0.65rem;
	font-size: 0.9rem;
}

.ns-pro-marketplace-hub--compact {
	margin: 0;
}

.ns-pro-marketplace-hub--compact .ns-pro-marketplace-hub__section {
	margin-bottom: 0.75rem;
}

.ns-pro-marketplace-hub__foot {
	margin: 0;
}

@media (max-width: 768px) {
	.ns-story-actions {
		gap: 0.15rem;
	}

	.ns-story-actions__label {
		display: none;
	}

	.nx-global-search__panel {
		width: 100%;
	}
}

/* Community public profile */
.nx-comm-user-page__tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 1rem 0;
	padding: 0.65rem;
	border-radius: 12px;
}

.nx-comm-user-page__tab {
	padding: 0.45rem 0.85rem;
	border-radius: 999px;
	text-decoration: none;
	font-size: 0.82rem;
	color: inherit;
	border: 1px solid rgba(255, 255, 255, 0.1);
}

.nx-comm-user-page__tab.is-active {
	border-color: rgba(212, 175, 55, 0.55);
	background: rgba(212, 175, 55, 0.12);
}

.nx-comm-user-page__actions {
	margin: 0.75rem 0 1rem;
}

.nx-comm-user-page__section {
	margin-bottom: 1rem;
	padding: 1rem;
	border-radius: 12px;
}

.nx-comm-user-page__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.35rem;
}
