/**
 * Nexus Tooltip Stylesheet — D&D Technomancy & Wowhead Rarity Design System
 * Uses Cinesist Theme Tokens: --cs-brand, --cs-brand-2, Glassmorphism
 */

:root {
	--nx-brand: var(--cs-brand, #6366f1);
	--nx-brand-2: var(--cs-brand-2, #ec4899);
	--nx-bg-glass: rgba(15, 23, 42, 0.92);
	--nx-border-glass: rgba(255, 255, 255, 0.12);
	--nx-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.6), 0 0 20px rgba(99, 102, 241, 0.15);
	--nx-radius: 12px;

	/* Wowhead Rarity Color Palette */
	--nx-rarity-poor: #9d9d9d;
	--nx-rarity-common: #ffffff;
	--nx-rarity-uncommon: #1eff00;
	--nx-rarity-rare: #0070dd;
	--nx-rarity-very_rare: #a335ee;
	--nx-rarity-legendary: #ff8000;
	--nx-rarity-artifact: #e6cc80;
}

/* Tooltip Portal Wrapper */
.nexus-tooltip-portal {
	position: fixed;
	z-index: 999999;
	pointer-events: none !important;
	opacity: 0;
	transform: scale(0.96) translateY(4px);
	transition: opacity 0.14s ease-out, transform 0.14s ease-out;
	max-width: 380px;
	width: max-content;
	box-sizing: border-box;
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	will-change: transform, opacity, left, top;
}

.nexus-tooltip-portal.is-visible {
	opacity: 1;
	transform: scale(1) translateY(0);
}

/* Card Shell (MagiTech Obsidian Glass & Wowhead Bevel) */
.nx-tp-card {
	pointer-events: none !important;
	background: rgba(8, 12, 20, 0.96) !important;
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border: 1px solid #23314d !important;
	border-radius: var(--nx-radius) !important;
	box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05) inset !important;
	padding: 14px !important;
	color: #f1f5f9 !important;
	overflow: hidden !important;
	box-sizing: border-box !important;
}

.nx-tp-card * {
	box-sizing: border-box !important;
}

.nx-tp-body {
	display: flex !important;
	gap: 14px !important;
	align-items: flex-start !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* Visual Media */
.nx-tp-poster {
	width: 80px !important;
	height: 118px !important;
	flex-shrink: 0 !important;
	border-radius: 8px !important;
	overflow: hidden !important;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4) !important;
	border: 1px solid rgba(255, 255, 255, 0.08) !important;
	background: #1e293b !important;
	align-self: flex-start !important;
	margin: 0 !important;
	padding: 0 !important;
}

.nx-tp-poster img {
	width: 100% !important;
	height: 100% !important;
	max-width: 100% !important;
	max-height: 100% !important;
	object-fit: cover !important;
	display: block !important;
	border-radius: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
}

.nx-tp-icon {
	width: 54px;
	height: 54px;
	flex-shrink: 0;
	border-radius: 8px;
	overflow: hidden;
	border: 2px solid var(--nx-border-glass);
	background: #0f172a;
}

.nx-tp-icon img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.nx-tp-avatar {
	width: 60px;
	height: 60px;
	flex-shrink: 0;
	border-radius: 50%;
	overflow: hidden;
	border: 2px solid var(--nx-brand);
}

.nx-tp-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Typography & Content Layout */
.nx-tp-main {
	flex: 1 !important;
	min-width: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
}

.nx-tp-header-line {
	display: flex !important;
	justify-content: space-between !important;
	align-items: center !important;
	margin: 0 0 6px 0 !important;
	padding: 0 !important;
}

.nx-tp-card .nx-tp-badge {
	display: inline-block !important;
	font-size: 10px !important;
	font-weight: 700 !important;
	letter-spacing: 0.06em !important;
	text-transform: uppercase !important;
	padding: 2px 7px !important;
	border-radius: 4px !important;
	background: rgba(255, 255, 255, 0.08) !important;
	color: #94a3b8 !important;
	margin: 0 !important;
	line-height: normal !important;
}

.nx-tp-badge-cinema {
	background: rgba(236, 72, 153, 0.2);
	color: #f472b6;
	border: 1px solid rgba(236, 72, 153, 0.4);
}

.nx-tp-badge-game {
	background: rgba(99, 102, 241, 0.2);
	color: #a5b4fc;
	border: 1px solid rgba(99, 102, 241, 0.4);
}

.nx-tp-badge-ext {
	background: rgba(59, 130, 246, 0.2);
	color: #60a5fa;
}

.nx-tp-rating {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	font-size: 11px;
	font-weight: 700;
	color: #fbbf24;
	background: rgba(251, 191, 36, 0.12);
	padding: 2px 6px;
	border-radius: 4px;
}

.nx-tp-card .nx-tp-title {
	font-size: 15px !important;
	font-weight: 700 !important;
	line-height: 1.25 !important;
	margin: 4px 0 6px 0 !important;
	padding: 0 !important;
	color: #ffffff !important;
	word-break: break-word !important;
}

.nx-tp-meta-bar {
	font-size: 12px !important;
	color: #94a3b8 !important;
	margin: 0 0 6px 0 !important;
	padding: 0 !important;
	display: flex !important;
	flex-wrap: wrap !important;
	gap: 6px !important;
	align-items: center !important;
	line-height: normal !important;
}

.nx-tp-bullet {
	opacity: 0.5;
}

.nx-tp-card .nx-tp-desc,
.nx-tp-desc {
	font-size: 12px !important;
	line-height: 1.4 !important;
	color: #94a3b8 !important;
	margin: 4px 0 6px 0 !important;
	padding: 0 !important;
	display: -webkit-box !important;
	-webkit-line-clamp: 3 !important;
	-webkit-box-orient: vertical !important;
	overflow: hidden !important;
}

.nx-tp-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 6px;
}

.nx-tp-tag {
	font-size: 10px;
	background: rgba(255, 255, 255, 0.06);
	padding: 2px 6px;
	border-radius: 4px;
	color: #cbd5e1;
}

.nx-tp-platform {
	background: rgba(99, 102, 241, 0.15);
	color: #c7d2fe;
}

.nx-tp-subdued {
	font-size: 11px;
	color: #64748b;
}

/* =========================================================================
   WOWHEAD RARITY THEMES (D&D 5E CODEX & CINESCORE 7-TIER SPECTRUM)
   ========================================================================= */

/* Mythic / Artifact (95–100) */
.nx-rarity-mythic,
.nx-rarity-artifact {
	border-color: #e5c158 !important;
	box-shadow: 0 0 26px rgba(229, 193, 88, 0.5) !important;
}
.nx-title-mythic,
.nx-title-artifact { color: #e5c158 !important; }
.nx-tp-badge-mythic,
.nx-tp-badge-artifact { background: rgba(229, 193, 88, 0.2); color: #e5c158; }

/* Legendary (85–94) */
.nx-rarity-legendary {
	border-color: #ff8000 !important;
	box-shadow: 0 0 24px rgba(255, 128, 0, 0.4) !important;
}
.nx-title-legendary { color: #ff8000 !important; }
.nx-tp-badge-legendary { background: rgba(255, 128, 0, 0.15); color: #ff8000; }

/* Epic (75–84) */
.nx-rarity-epic,
.nx-rarity-very_rare {
	border-color: #a335ee !important;
	box-shadow: 0 0 20px rgba(163, 53, 238, 0.35) !important;
}
.nx-title-epic,
.nx-title-very_rare { color: #a335ee !important; }
.nx-tp-badge-epic,
.nx-tp-badge-very_rare { background: rgba(163, 53, 238, 0.15); color: #a335ee; }

/* Rare (60–74) */
.nx-rarity-rare {
	border-color: #0070dd !important;
	box-shadow: 0 0 18px rgba(0, 112, 221, 0.3) !important;
}
.nx-title-rare { color: #0070dd !important; }
.nx-tp-badge-rare { background: rgba(0, 112, 221, 0.15); color: #0070dd; }

/* Uncommon (45–59) */
.nx-rarity-uncommon {
	border-color: #1eff00 !important;
	box-shadow: 0 0 16px rgba(30, 255, 0, 0.25) !important;
}
.nx-title-uncommon { color: #1eff00 !important; }
.nx-tp-badge-uncommon { background: rgba(30, 255, 0, 0.15); color: #1eff00; }

/* Common (25–44) */
.nx-rarity-common {
	border-color: #ffffff !important;
	box-shadow: 0 0 10px rgba(255, 255, 255, 0.15) !important;
}
.nx-title-common { color: #ffffff !important; }
.nx-tp-badge-common { background: rgba(255, 255, 255, 0.1); color: #ffffff; }

/* Scrap / Poor (0–24) */
.nx-rarity-scrap,
.nx-rarity-poor {
	border-color: #9d9d9d !important;
	box-shadow: 0 0 10px rgba(157, 157, 157, 0.15) !important;
}
.nx-title-scrap,
.nx-title-poor { color: #9d9d9d !important; }
.nx-tp-badge-scrap,
.nx-tp-badge-poor { background: rgba(157, 157, 157, 0.15); color: #9d9d9d; }

/* Unrated / NR (Brand Adaptive Color) */
.nx-rarity-nr,
.nx-rarity-unrated {
	border-color: var(--cs-brand, #a855f7) !important;
	box-shadow: 0 0 16px rgba(168, 85, 247, 0.3) !important;
}
.nx-title-nr,
.nx-title-unrated { color: var(--cs-brand, #a855f7) !important; }
.nx-tp-badge-nr,
.nx-tp-badge-unrated { background: rgba(168, 85, 247, 0.15); color: var(--cs-brand, #a855f7); }

.nx-tp-rating-nr {
	color: var(--cs-brand, #a855f7) !important;
	border-color: var(--cs-brand, #a855f7) !important;
}

.nx-tp-stats-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px 8px;
	font-size: 11px;
	color: #94a3b8;
	margin: 6px 0;
	background: rgba(0, 0, 0, 0.25);
	padding: 6px 8px;
	border-radius: 6px;
}

.nx-codex-flavor {
	font-style: italic;
	color: #fbbf24;
	opacity: 0.9;
}

/* Page & Review Badges */
.nx-tp-badge-page {
	background: rgba(14, 165, 233, 0.2);
	color: #38bdf8;
	border: 1px solid rgba(14, 165, 233, 0.3);
}

.nx-tp-badge-review {
	background: rgba(245, 158, 11, 0.2);
	color: #fbbf24;
	border: 1px solid rgba(245, 158, 11, 0.3);
}

.nx-tp-score-badge {
	display: inline-flex;
	align-items: center;
	font-size: 12px;
	font-weight: 800;
	padding: 2px 7px;
	border-radius: 6px;
	border: 1.5px solid currentColor;
	background: rgba(0, 0, 0, 0.3);
}

/* =========================================================================
   MAGITECH / WOWHEAD LOOT STANDARD EXTENSIONS
   ========================================================================= */

.nx-tp-poster-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #0f172a;
}

.nx-tp-placeholder-icon {
	font-size: 28px;
	opacity: 0.7;
}

.nx-tp-count-pill {
	font-size: 10px;
	color: #94a3b8;
	background: rgba(255, 255, 255, 0.08);
	padding: 2px 7px;
	border-radius: 4px;
	font-weight: 600;
}

.nx-tp-meta-gold {
	color: #ffd100;
	font-weight: 600;
}

.nx-tp-meta-cyan {
	color: #38bdf8;
}

.nx-tp-meta-green {
	color: #00ff66;
	font-weight: 600;
}

.nx-tp-quote {
	font-size: 12px;
	font-style: italic;
	color: #00ff66;
	line-height: 1.4;
	margin-top: 6px;
	margin-bottom: 2px;
	text-shadow: 0 0 10px rgba(0, 255, 102, 0.25);
}

.nx-tp-loot-footer {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
	padding-top: 6px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	font-size: 11px;
}

.nx-tp-loot-label {
	color: #64748b;
	font-weight: 500;
}

.nx-tp-loot-avatar {
	width: 18px !important;
	height: 18px !important;
	max-width: 18px !important;
	max-height: 18px !important;
	border-radius: 50% !important;
	object-fit: cover !important;
	border: 1px solid rgba(255, 255, 255, 0.2) !important;
	flex-shrink: 0 !important;
	display: inline-block !important;
	margin: 0 !important;
	padding: 0 !important;
}

.nx-tp-loot-author {
	color: #cbd5e1;
	font-weight: 600;
	text-decoration: none;
	transition: color 0.15s ease;
}

.nx-tp-loot-author:hover {
	color: #ffd100;
	text-decoration: underline;
}


