/*
 * SPDX-FileCopyrightText: 2010-2024 the Friendica project
 *
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

/* Discord-style Modern Hovercard for frio_modern theme */

.hovercard {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1040;
	display: none;
	width: 340px;
	min-width: 340px;
	max-width: 340px;
	padding: 0;
	text-align: left;
	background: #ffffff;
	background-clip: padding-box;
	border: none;
	border-radius: 12px;
	box-shadow: 
		0 8px 16px rgba(0, 0, 0, 0.24),
		0 0 0 1px rgba(0, 0, 0, 0.08);
	white-space: normal;
	animation: hovercardFadeIn 0.15s ease-out;
	transform-origin: center top;
	will-change: transform, opacity;
	overflow: hidden;
}

@keyframes hovercardFadeIn {
	from {
		opacity: 0;
		transform: scale(0.98);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* Position variations */
.hovercard.top {
	margin-top: -10px;
}

.hovercard.right {
	margin-left: 10px;
}

.hovercard.bottom {
	margin-top: 10px;
}

.hovercard.left {
	margin-left: -10px;
}

/* Hide arrows for cleaner look */
.hovercard > .arrow,
.hovercard > .arrow:after {
	display: none;
}

/* Discord-style content wrapper */
.hovercard-modern-content {
	position: relative;
	width: 100%;
	background: transparent;
}

/* Banner section with gradient */
.hovercard-banner {
	position: relative;
	width: 100%;
	height: 80px;
	background: linear-gradient(135deg, #7289da 0%, #5865f2 100%);
	overflow: hidden;
}

.hovercard-banner-gradient {
	position: absolute;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, 
		rgba(114, 137, 218, 0.3) 0%, 
		rgba(88, 101, 242, 0.3) 50%,
		rgba(114, 137, 218, 0.3) 100%);
	animation: gradientShift 8s ease infinite;
	background-size: 200% 200%;
}

@keyframes gradientShift {
	0% { background-position: 0% 50%; }
	50% { background-position: 100% 50%; }
	100% { background-position: 0% 50%; }
}

/* Profile section with avatar */
.hovercard-profile-section {
	position: relative;
	margin-top: -50px;
	padding: 0 20px;
	text-align: center;
}

.hovercard-avatar-wrapper {
	position: relative;
	display: inline-block;
}

.hovercard-avatar {
	width: 100px;
	height: 100px;
	border-radius: 50%;
	border: 6px solid #ffffff;
	background: #ffffff;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
	object-fit: cover;
	transition: transform 0.2s ease;
}

.hovercard-avatar:hover {
	transform: scale(1.05);
}

/* Account type badge */
.hovercard-badge {
	position: absolute;
	bottom: 5px;
	right: 5px;
	background: #5865f2;
	color: white;
	padding: 2px 8px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* User info section */
.hovercard-info-section {
	padding: 16px 20px 12px;
	text-align: center;
}

.hovercard-username {
	margin-bottom: 8px;
}

.hovercard-username h4 {
	margin: 0;
	padding: 0;
}

.hovercard-username h4 a {
	font-size: 20px;
	font-weight: 700;
	color: $font_color_darker;
	text-decoration: none;
	letter-spacing: -0.02em;
	transition: color 0.15s ease;
}

.hovercard-username h4 a:hover {
	color: $link_color;
}

.hovercard-handle {
	font-size: 14px;
	color: $font_color_lighter;
	margin-bottom: 6px;
}

.handle-icon {
	opacity: 0.6;
	margin-right: 2px;
}

.hovercard-network {
	font-size: 12px;
	color: $font_color_lighter;
	margin-bottom: 8px;
	opacity: 0.8;
}

.hovercard-network a {
	color: $link_color;
	text-decoration: none;
}

.hovercard-bio {
	font-size: 13px;
	color: $font_color;
	line-height: 1.4;
	margin-top: 12px;
	padding: 10px 15px;
	background: rgba(0, 0, 0, 0.03);
	border-radius: 8px;
	max-height: 60px;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

/* Divider */
.hovercard-divider {
	height: 1px;
	background: rgba(0, 0, 0, 0.08);
	margin: 0 20px;
}

/* Action buttons section */
.hovercard-actions-section {
	padding: 12px 20px 16px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
}

.hovercard-action-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 6px 12px;
	font-size: 13px;
	font-weight: 500;
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.05);
	color: $font_color;
	border: none;
	text-decoration: none !important;
	transition: all 0.15s ease;
	cursor: pointer;
}

.hovercard-action-btn:hover {
	background: rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
}

.hovercard-action-btn:active {
	transform: translateY(0);
}

.hovercard-action-btn i {
	font-size: 14px;
}

.hovercard-action-btn span {
	white-space: nowrap;
}

/* Primary action button */
.hovercard-action-btn.primary {
	background: #5865f2;
	color: white;
}

.hovercard-action-btn.primary:hover {
	background: #4752c4;
}

/* Success action button */
.hovercard-action-btn.success {
	background: #3ba55d;
	color: white;
}

.hovercard-action-btn.success:hover {
	background: #2d8049;
}

/* Danger action button */
.hovercard-action-btn.danger {
	background: #ed4245;
	color: white;
}

.hovercard-action-btn.danger:hover {
	background: #c73638;
}

/* Icon-only buttons */
.hovercard-action-btn.icon-only {
	padding: 8px;
	min-width: 36px;
}

/* Tags section */
.hovercard-tags-section {
	padding: 12px 20px 16px;
	background: rgba(0, 0, 0, 0.02);
	border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.hovercard-tags-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: $font_color_lighter;
	margin-bottom: 8px;
}

.hovercard-tags-content {
	font-size: 12px;
	color: $font_color;
	line-height: 1.6;
}

.hovercard-tags-content a {
	display: inline-block;
	padding: 2px 8px;
	margin: 2px;
	background: rgba(88, 101, 242, 0.1);
	color: #5865f2;
	border-radius: 12px;
	text-decoration: none;
	transition: all 0.15s ease;
}

.hovercard-tags-content a:hover {
	background: rgba(88, 101, 242, 0.2);
	transform: translateY(-1px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.hovercard {
		width: 320px;
		min-width: 320px;
		max-width: calc(100vw - 32px);
	}
}

/* Mobile-specific adjustments */
@media (max-width: 480px) {
	.hovercard {
		position: fixed !important;
		top: 50% !important;
		left: 50% !important;
		transform: translate(-50%, -50%) !important;
		margin: 0 !important;
		z-index: 10000;
		width: calc(100vw - 32px);
		max-width: 340px;
	}
	
	/* Add overlay for mobile */
	.hovercard::before {
		content: "";
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0, 0, 0, 0.5);
		z-index: -1;
		animation: overlayFadeIn 0.15s ease-out;
	}
}

@keyframes overlayFadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* Dark theme support */
body.theme-dark .hovercard,
body[data-theme="dark"] .hovercard {
	background: #2b2d31;
	box-shadow: 
		0 8px 16px rgba(0, 0, 0, 0.48),
		0 0 0 1px rgba(0, 0, 0, 0.3);
}

body.theme-dark .hovercard-banner,
body[data-theme="dark"] .hovercard-banner {
	background: linear-gradient(135deg, #404eed 0%, #5865f2 100%);
}

body.theme-dark .hovercard-avatar,
body[data-theme="dark"] .hovercard-avatar {
	border-color: #2b2d31;
}

body.theme-dark .hovercard-username h4 a,
body[data-theme="dark"] .hovercard-username h4 a {
	color: #f2f3f5;
}

body.theme-dark .hovercard-handle,
body[data-theme="dark"] .hovercard-handle {
	color: #b5bac1;
}

body.theme-dark .hovercard-network,
body[data-theme="dark"] .hovercard-network {
	color: #949ba4;
}

body.theme-dark .hovercard-bio,
body[data-theme="dark"] .hovercard-bio {
	background: rgba(0, 0, 0, 0.2);
	color: #dbdee1;
}

body.theme-dark .hovercard-divider,
body[data-theme="dark"] .hovercard-divider {
	background: rgba(255, 255, 255, 0.08);
}

body.theme-dark .hovercard-action-btn,
body[data-theme="dark"] .hovercard-action-btn {
	background: rgba(255, 255, 255, 0.05);
	color: #dbdee1;
}

body.theme-dark .hovercard-action-btn:hover,
body[data-theme="dark"] .hovercard-action-btn:hover {
	background: rgba(255, 255, 255, 0.08);
}

body.theme-dark .hovercard-tags-section,
body[data-theme="dark"] .hovercard-tags-section {
	background: rgba(0, 0, 0, 0.2);
	border-top-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .hovercard-tags-content a,
body[data-theme="dark"] .hovercard-tags-content a {
	background: rgba(88, 101, 242, 0.2);
	color: #949eed;
}

body.theme-dark .hovercard-tags-content a:hover,
body[data-theme="dark"] .hovercard-tags-content a:hover {
	background: rgba(88, 101, 242, 0.3);
}

/* Black theme support */
body.theme-black .hovercard,
body[data-theme="black"] .hovercard {
	background: #000000;
	box-shadow: 
		0 8px 16px rgba(255, 255, 255, 0.1),
		0 0 0 1px rgba(255, 255, 255, 0.2);
}

body.theme-black .hovercard-banner,
body[data-theme="black"] .hovercard-banner {
	background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

body.theme-black .hovercard-avatar,
body[data-theme="black"] .hovercard-avatar {
	border-color: #000000;
}

body.theme-black .hovercard-bio,
body[data-theme="black"] .hovercard-bio {
	background: rgba(255, 255, 255, 0.05);
}

body.theme-black .hovercard-divider,
body[data-theme="black"] .hovercard-divider {
	background: rgba(255, 255, 255, 0.1);
}

body.theme-black .hovercard-action-btn,
body[data-theme="black"] .hovercard-action-btn {
	background: rgba(255, 255, 255, 0.08);
}

body.theme-black .hovercard-action-btn:hover,
body[data-theme="black"] .hovercard-action-btn:hover {
	background: rgba(255, 255, 255, 0.12);
}

body.theme-black .hovercard-tags-section,
body[data-theme="black"] .hovercard-tags-section {
	background: rgba(255, 255, 255, 0.03);
	border-top-color: rgba(255, 255, 255, 0.1);
}

/* Loading state */
.hovercard.loading {
	min-height: 300px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.hovercard.loading::after {
	content: "";
	width: 40px;
	height: 40px;
	border: 3px solid rgba(88, 101, 242, 0.2);
	border-top-color: #5865f2;
	border-radius: 50%;
	animation: hovercardSpin 0.8s linear infinite;
}

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

/* Accessibility improvements */
.hovercard:focus-within {
	box-shadow: 
		0 8px 16px rgba(0, 0, 0, 0.24),
		0 0 0 3px rgba(88, 101, 242, 0.4);
}

/* Performance optimizations */
.hovercard * {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Prevent text selection during animations */
.hovercard {
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

.hovercard-info-section,
.hovercard-tags-content {
	-webkit-user-select: text;
	-moz-user-select: text;
	-ms-user-select: text;
	user-select: text;
}

/* Compatibility with old template structure (fallback) */
.basic-content {
	display: none;
}

/* Utility classes */
.right-aligned {
	float: right !important;
}

.left-align {
	float: left !important;
}

.hidden {
	display: none !important;
	visibility: hidden !important;
}