/**
 * Mentium Referral Popup - Stile Mentium
 *
 * @package Mentium_Referral
 */

.mentium-popup-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.6);
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}

.mentium-popup-content {
	background: #fff;
	border-radius: 16px;
	max-width: 460px;
	width: 100%;
	overflow: hidden;
	box-shadow: 0 8px 32px rgba(0, 170, 255, 0.3);
	border: 2px solid #00AAFF;
	animation: mentiumPopupSlideIn 0.3s ease;
}

@keyframes mentiumPopupSlideIn {
	from {
		opacity: 0;
		transform: translateY(-20px) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.popup-header {
	background: linear-gradient(135deg, #00AAFF 0%, #132977 100%);
	color: #fff;
	padding: 20px 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.popup-header h2 {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 8px;
}

.popup-header .sparkle-icon {
	font-size: 24px;
}

.popup-close {
	background: rgba(255, 255, 255, 0.2);
	border: none;
	color: #fff;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	font-size: 24px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}

.popup-close:hover {
	background: rgba(255, 255, 255, 0.3);
}

.popup-body {
	padding: 24px;
}

.popup-loading {
	text-align: center;
	padding: 40px;
	color: #132977;
}

.popup-loading .spinner {
	display: inline-block;
	width: 24px;
	height: 24px;
	border: 3px solid #00AAFF;
	border-top-color: transparent;
	border-radius: 50%;
	animation: mentiumSpin 0.8s linear infinite;
	margin-right: 10px;
	vertical-align: middle;
}

@keyframes mentiumSpin {
	to { transform: rotate(360deg); }
}

.reward-section {
	margin-bottom: 20px;
}

.reward-item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 16px;
	background: linear-gradient(135deg, rgba(0, 170, 255, 0.1) 0%, rgba(19, 41, 119, 0.1) 100%);
	border-radius: 12px;
	margin-bottom: 10px;
}

.reward-item:last-child {
	margin-bottom: 0;
}

.reward-icon {
	font-size: 20px;
	flex-shrink: 0;
}

.reward-text {
	font-size: 15px;
	font-weight: 600;
	background: linear-gradient(135deg, #00AAFF 0%, #132977 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.referral-link-section {
	margin-bottom: 20px;
}

.referral-link-section label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: #132977;
	margin-bottom: 8px;
}

.link-input-wrapper {
	display: flex;
	gap: 10px;
	padding: 12px;
	background: linear-gradient(135deg, rgba(0, 170, 255, 0.05) 0%, rgba(19, 41, 119, 0.05) 100%);
	border: 2px solid #00AAFF;
	border-radius: 12px;
}

.link-input-wrapper input {
	flex: 1;
	border: none;
	background: transparent;
	font-family: monospace;
	font-size: 13px;
	color: #132977;
	outline: none;
	min-width: 0;
}

.btn-copy {
	background: #00AAFF;
	color: #fff;
	border: none;
	padding: 8px 16px;
	border-radius: 8px;
	font-weight: 600;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 6px;
	transition: all 0.2s;
	flex-shrink: 0;
}

.btn-copy:hover {
	background: #132977;
	transform: scale(1.05);
}

.btn-copy.copied {
	background: #10B981;
}

.share-section {
	margin-bottom: 20px;
}

.share-label {
	font-size: 14px;
	font-weight: 600;
	color: #132977;
	margin-bottom: 12px;
}

.share-buttons {
	display: flex;
	gap: 12px;
}

.btn-share {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 16px;
	border-radius: 10px;
	font-weight: 600;
	font-size: 14px;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.2s;
	border: none;
}

.btn-whatsapp {
	background: #25D366;
	color: #fff;
}

.btn-whatsapp:hover {
	background: #128C7E;
	transform: translateY(-2px);
}

.btn-copy-alt {
	background: #00AAFF;
	color: #fff;
}

.btn-copy-alt:hover {
	background: #132977;
	transform: translateY(-2px);
}

.stats-section {
	display: flex;
	gap: 16px;
	margin-bottom: 20px;
}

.stat-item {
	flex: 1;
	text-align: center;
	padding: 16px;
	background: linear-gradient(135deg, rgba(0, 170, 255, 0.1) 0%, rgba(19, 41, 119, 0.1) 100%);
	border-radius: 12px;
	border-left: 4px solid #00AAFF;
}

.stat-value {
	display: block;
	font-size: 28px;
	font-weight: 700;
	color: #132977;
}

.stat-label {
	display: block;
	font-size: 12px;
	color: #64748B;
	margin-top: 4px;
}

.info-box {
	padding: 16px;
	background: linear-gradient(135deg, rgba(0, 170, 255, 0.1) 0%, rgba(19, 41, 119, 0.1) 100%);
	border-radius: 12px;
	border-left: 4px solid #00AAFF;
}

.info-title {
	font-size: 14px;
	font-weight: 600;
	color: #132977;
	margin: 0 0 10px;
}

.info-list {
	margin: 0;
	padding-left: 20px;
	list-style: none;
}

.info-list li {
	font-size: 13px;
	color: #132977;
	margin-bottom: 6px;
	position: relative;
}

.info-list li::before {
	content: "•";
	position: absolute;
	left: -15px;
	color: #00AAFF;
}

.popup-guest {
	text-align: center;
	padding: 20px 0;
}

.guest-text {
	font-size: 15px;
	color: #475569;
	margin-bottom: 20px;
}

.guest-buttons {
	display: flex;
	gap: 12px;
	justify-content: center;
}

.btn-primary {
	background: linear-gradient(135deg, #00AAFF 0%, #132977 100%);
	color: #fff;
	padding: 12px 32px;
	border-radius: 10px;
	font-weight: 600;
	text-decoration: none;
	transition: all 0.2s;
}

.btn-primary:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 170, 255, 0.3);
}

.btn-secondary {
	background: #f1f5f9;
	color: #132977;
	padding: 12px 32px;
	border-radius: 10px;
	font-weight: 600;
	text-decoration: none;
	transition: all 0.2s;
}

.btn-secondary:hover {
	background: #e2e8f0;
}

/* Referral in header – sempre visibile nella navbar Mentium */
.mentium-referral-header-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-right: 16px;
}

.mentium-header .navbar-utils .mentium-referral-header-wrap {
	display: flex !important;
	flex-shrink: 0;
	visibility: visible !important;
	opacity: 1 !important;
}

/* In blocco centrato: stessa distanza degli altri link (no margin extra) */
.mentium-header .mentium-nav-links-center .mentium-referral-header-wrap {
	margin: 0 !important;
}

.mentium-referral-header-wrap .referral-menu-link {
	display: flex;
	align-items: center;
	gap: 6px;
	color: inherit;
	text-decoration: none;
	font-weight: 500;
	white-space: nowrap;
}

/* Colori header blu (home/login) */
body.mentium-gradient-bg .mentium-referral-header-wrap .referral-menu-link {
	color: rgba(255, 255, 255, 0.95) !important;
}

body.mentium-gradient-bg .mentium-referral-header-wrap .referral-menu-link:hover {
	color: #fff !important;
}

/* Colori header bianco (bacheca/corsi) */
body:not(.mentium-gradient-bg) .mentium-referral-header-wrap .referral-menu-link {
	color: #0a083b !important;
}

body:not(.mentium-gradient-bg) .mentium-referral-header-wrap .referral-menu-link:hover {
	color: #1950d1 !important;
}

.mentium-referral-header-wrap .referral-icon {
	font-size: 16px;
}

.menu-item-referral .referral-menu-link {
	display: flex;
	align-items: center;
	gap: 6px;
	color: inherit;
	text-decoration: none;
	font-weight: 500;
}

.menu-item-referral .referral-icon {
	font-size: 16px;
}

.menu-item-generations {
	display: flex;
	align-items: center;
}

.generations-counter {
	display: flex;
	align-items: center;
	gap: 4px;
	background: linear-gradient(135deg, #00AAFF 0%, #132977 100%);
	color: #fff;
	padding: 4px 10px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 600;
}

/* Badge accanto alla campanella notifiche nella dashboard */
.generations-counter--dashboard {
	margin-left: 12px;
}

/* Badge cliccabile */
.generations-counter--clickable {
	cursor: pointer;
	border: none;
	font: inherit;
	transition: opacity 0.2s, transform 0.2s;
}

.generations-counter--clickable:hover {
	opacity: 0.9;
	transform: scale(1.02);
}

/* Popup generazioni - compatto */
.mentium-popup-content--small {
	max-width: 380px;
}

.generations-total-box {
	text-align: center;
	padding: 16px;
	background: linear-gradient(135deg, rgba(0, 170, 255, 0.15) 0%, rgba(19, 41, 119, 0.15) 100%);
	border-radius: 12px;
	margin-bottom: 16px;
}

.generations-total-value {
	display: block;
	font-size: 32px;
	font-weight: 700;
	background: linear-gradient(135deg, #00AAFF 0%, #132977 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.generations-total-label {
	font-size: 14px;
	color: #5B616F;
}

.generations-breakdown {
	margin-bottom: 16px;
}

.generations-breakdown-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 0;
	border-bottom: 1px solid #eee;
}

.generations-breakdown-row:last-child {
	border-bottom: none;
}

.breakdown-label {
	font-size: 14px;
	color: #5B616F;
}

.breakdown-value {
	font-weight: 600;
	color: #132977;
}

.generations-info-box {
	background: #f8f9fa;
	border-radius: 10px;
	padding: 14px;
	margin-bottom: 16px;
	font-size: 13px;
	line-height: 1.5;
	color: #5B616F;
}

.generations-info-box p {
	margin: 0 0 8px 0;
}

.generations-info-box p:last-child,
.generations-consumption-note {
	margin-bottom: 0;
	font-size: 12px;
	opacity: 0.9;
}

.btn-invite-link {
	display: block;
	text-align: center;
	padding: 12px 16px;
	background: linear-gradient(135deg, #00AAFF 0%, #132977 100%);
	color: #fff !important;
	border-radius: 10px;
	font-weight: 600;
	text-decoration: none;
	transition: opacity 0.2s;
}

.btn-invite-link:hover {
	opacity: 0.9;
	color: #fff !important;
}

.generations-popup-loading {
	text-align: center;
	padding: 40px;
	color: #132977;
}

.generations-popup-loading .spinner {
	display: inline-block;
	width: 24px;
	height: 24px;
	border: 3px solid #00AAFF;
	border-top-color: transparent;
	border-radius: 50%;
	animation: mentiumSpin 0.8s linear infinite;
	margin-right: 10px;
	vertical-align: middle;
}

.gen-icon {
	font-size: 14px;
}

@media (max-width: 768px) {
	.mentium-popup-overlay {
		overflow-y: auto;
		overflow-x: hidden;
		-webkit-overflow-scrolling: touch;
		align-items: flex-start;
		justify-content: flex-start;
		padding: 16px 16px 80px;
		height: 100vh;
		height: 100dvh;
		max-height: 100vh;
		max-height: 100dvh;
	}

	.mentium-popup-content {
		max-width: 100%;
		margin: 0 auto 0 0;
		flex-shrink: 0;
		overflow: visible;
	}
}

@media (max-width: 480px) {
	.mentium-popup-overlay {
		padding: 12px 12px 80px;
	}
	.share-buttons {
		flex-direction: column;
	}
	.stats-section {
		flex-direction: column;
	}
	.guest-buttons {
		flex-direction: column;
	}
}
