/**
 * Kudos Reactions Styles
 * Custom styles for BuddyBoss reaction buttons on Kudos posts
 *
 * @package SchoolKudosCore
 * @since 1.0.0
 */

.sk-kudos-reaction-container {
	position: relative;
}

.therisereport-kudos-reactions-wrapper {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
}

.therisereport-kudos-reactions-wrapper .therisereport-kudos-reactions {
	width: 100%;
	margin: 0;
	order: 1;
	font-size: 14px;
	color: var(--bb-body-text-color);
	line-height: 1.6;
}

.therisereport-kudos-reactions-wrapper .sk-kudos-reaction-container {
	order: 2;
}

.sk-kudos-reaction-wrapper {
	display: inline-block;
	position: relative;
	overflow: visible;
}

/* ============================================
	Reaction Button - BuddyBoss Structure
============================================ */
.group-kudos-single #buddypress .sk-kudos-reaction-wrapper .bp-like-button.sk-kudos-reaction-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	padding: 6px 14px;
	background: transparent;
	border: 1px solid var(--bb-content-border-color);
	border-radius: var(--bb-button-radius);
	color: var(--bb-alternate-text-color);
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	line-height: 20px;
	cursor: pointer;
	position: relative;
	box-shadow: none;
	vertical-align: middle;
	transition: all 0.2s ease;
}

.group-kudos-single #buddypress .sk-kudos-reaction-wrapper .bp-like-button.sk-kudos-reaction-button:hover {
	background: var(--bb-content-alternate-background-color);
}

/* Login required button styling */
.sk-kudos-reaction-wrapper .bp-like-button.login-required {
	opacity: 0.8;
	font-style: italic;
}

.sk-kudos-reaction-wrapper .bp-like-button.login-required:hover {
	background: var(--bb-content-alternate-background-color);
	opacity: 1;
}

.sk-kudos-reaction-wrapper .bp-like-button.login-required .like-count {
	font-style: normal;
	font-size: 13px;
}

/* Button Icons */
.sk-kudos-reaction-wrapper .bp-like-button i[class*="bb-icon"] {
	font-size: 24px;
	line-height: 1;
	vertical-align: middle;
	margin-right: 4px;
	color: var(--bb-alternate-text-color);
	font-weight: 200;	

}

.sk-kudos-reaction-wrapper .bp-like-button.has-reaction i[class*="bb-icon"],
.sk-kudos-reaction-wrapper .bp-like-button.has-reaction .like-count {
	color: #5187e5;
}

/* Subtle pulse animation for reacted state */
.sk-kudos-reaction-wrapper .bp-like-button.has-reaction img,
.sk-kudos-reaction-wrapper .bp-like-button.has-emotion img {
	animation: sk-reaction-pulse 2s ease-in-out infinite;
}

@keyframes sk-reaction-pulse {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.1);
	}
}

.sk-kudos-reaction-wrapper .bp-like-button img {
	width: 24px;
	height: 24px;
	object-fit: contain;
	vertical-align: middle;
	margin-right: 2px;
}

/* Button Text */
.sk-kudos-reaction-wrapper .bp-like-button .like-count {
	font-weight: 500;
	display: inline-flex;
	align-items: center;
	visibility: visible;
	color: inherit;
	font-size: 14px;
	line-height: 1;
	margin: 0;
	padding: 0;
	vertical-align: middle;
	color: var(--bb-alternate-text-color);
}

/* Loading State */
.sk-kudos-reaction-wrapper .bp-like-button.loading {
	opacity: 0.4;
	pointer-events: none;
	position: relative;
}

.sk-kudos-reaction-wrapper .bp-like-button.loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 16px;
	height: 16px;
	border: 2px solid var(--bb-content-border-color);
	border-top-color: var(--bb-body-text-color);
	border-radius: 50%;
	animation: sk-reaction-spin 0.8s linear infinite;
}

@keyframes sk-reaction-spin {
	to {
		transform: translate(-50%, -50%) rotate(360deg);
	}
}

/* ============================================
Emotions Popup (BuddyBoss Structure)
============================================ */
.sk-kudos-reaction-wrapper .ac-emotions_list {
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%);
	margin-bottom: 8px;
	background: var(--bb-content-background-color);
	border: 1px solid var(--bb-content-border-color);
	border-radius: calc(var(--bb-button-radius) * 3);
	padding: 6px 10px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	z-index: 1000;
	white-space: nowrap;
	display: none;
	align-items: center;
	gap: 8px;
	min-width: max-content;
	width: auto;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease,
		visibility 0.3s ease,
		transform 0.3s ease;
}

/* When visible */
.sk-kudos-reaction-wrapper .ac-emotions_list.visible,
.sk-kudos-reaction-wrapper .ac-emotions_list.active {
	display: flex;
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(-2px);
	animation: sk-popup-appear 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Popup appear animation */
@keyframes sk-popup-appear {
	0% {
		opacity: 0;
		transform: translateX(-50%) translateY(10px) scale(0.8);
	}
	100% {
		opacity: 1;
		transform: translateX(-50%) translateY(-2px) scale(1);
	}
}

/* Arrow indicator */
.sk-kudos-reaction-wrapper .ac-emotions_list::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-top-color: var(--bb-content-background-color);
	filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.05));
}

/* Emotion items */
.sk-kudos-reaction-wrapper .ac-emotions_list .ac-emotion_item {
	display: inline-flex;
	align-items: center;
	opacity: 0;
	animation: sk-emoji-fade-in 0.3s ease forwards;
}

/* Stagger animation for each emoji */
.sk-kudos-reaction-wrapper .ac-emotions_list .ac-emotion_item:nth-child(1) {
	animation-delay: 0.05s;
}
.sk-kudos-reaction-wrapper .ac-emotions_list .ac-emotion_item:nth-child(2) {
	animation-delay: 0.1s;
}
.sk-kudos-reaction-wrapper .ac-emotions_list .ac-emotion_item:nth-child(3) {
	animation-delay: 0.15s;
}
.sk-kudos-reaction-wrapper .ac-emotions_list .ac-emotion_item:nth-child(4) {
	animation-delay: 0.2s;
}
.sk-kudos-reaction-wrapper .ac-emotions_list .ac-emotion_item:nth-child(5) {
	animation-delay: 0.25s;
}
.sk-kudos-reaction-wrapper .ac-emotions_list .ac-emotion_item:nth-child(6) {
	animation-delay: 0.3s;
}

/* Emoji fade in animation */
@keyframes sk-emoji-fade-in {
	0% {
		opacity: 0;
		transform: translateY(10px) scale(0.6);
	}
	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.sk-kudos-reaction-wrapper .ac-emotions_list a {
	display: inline-flex;
	align-items: center;
	padding: 2px;
	margin: 0;
	transition: transform 0.3s ease-out;
	line-height: 0;
	flex-shrink: 0;
	text-decoration: none;
	transform: scale(1);
}

.sk-kudos-reaction-wrapper .ac-emotions_list a:hover {
	transform: scale(1.2);
	transition: transform 0.2s ease-in;
}

/* Emotion icons - Desktop size */
.sk-kudos-reaction-wrapper .ac-emotions_list img {
	width: 32px;
	height: 32px;
	display: block;
	object-fit: contain;
}

.sk-kudos-reaction-wrapper .ac-emotions_list i[class*="bb-icon"] {
	font-size: 32px !important;
	width: 32px;
	height: 32px;
	line-height: 32px;
	text-align: center;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.sk-kudos-reaction-wrapper .ac-emotions_list svg {
	width: 32px !important;
	height: 32px !important;
	display: block;
}

/* Large desktop screens - even bigger */
@media (min-width: 1200px) {
	.sk-kudos-reaction-wrapper .ac-emotions_list img {
		width: 36px;
		height: 36px;
	}

	.sk-kudos-reaction-wrapper .ac-emotions_list i[class*="bb-icon"] {
		font-size: 36px;
		width: 36px;
		height: 36px;
		line-height: 36px;
	}

	.sk-kudos-reaction-wrapper .ac-emotions_list svg {
		width: 36px !important;
		height: 36px !important;
	}
}

/* Override BuddyBoss tooltip styles ONLY for kudos reactions */
.sk-kudos-reaction-container .sk-kudos-reaction-wrapper .ac-emotions_list a[data-bp-tooltip]::before,
.sk-kudos-reaction-container .sk-kudos-reaction-wrapper .ac-emotions_list a[data-bp-tooltip]::after {
	font-size: 12px !important;
	padding: 4px 8px !important;
	white-space: nowrap !important;
	line-height: 1.2 !important;
}

/* Specific tooltip overrides for emotion items in kudos reactions */
.sk-kudos-reaction-container .sk-kudos-reaction-wrapper .ac-emotions_list .ac-emotion_item a[data-bp-tooltip]::after {
	font-size: 12px !important;
	padding: 4px 8px !important;
	line-height: 1.2 !important;
	min-width: auto !important;
	max-width: 120px !important;
}

/* Ensure tooltip position for kudos reactions only */
.sk-kudos-reaction-container .sk-kudos-reaction-wrapper .ac-emotions_list a[data-bp-tooltip-pos]::after,
.sk-kudos-reaction-container .sk-kudos-reaction-wrapper .ac-emotions_list a[data-bp-tooltip-pos]::before {
	font-size: 12px;
}

/* ============================================
	Mobile Responsive
============================================ */
@media (max-width: 768px) {
	.therisereport-kudos-reactions-wrapper {
		gap: 10px;
	}

	.sk-kudos-reaction-wrapper .bp-like-button.sk-kudos-reaction-button {
		padding: 5px 12px;
		font-size: 13px;
		gap: 3px;
		position: relative;
		-webkit-touch-callout: none;
		-webkit-user-select: none;
		user-select: none;
	}

	/* Visual feedback for reacted state on mobile */
	.sk-kudos-reaction-wrapper .bp-like-button.unfav {
		background: var(--bb-content-alternate-background-color);
		border-color: #5187e5;
	}

	.sk-kudos-reaction-wrapper .bp-like-button i[class*="bb-icon"] {
		font-size: 18px;
	}

	.sk-kudos-reaction-wrapper .bp-like-button img {
		width: 18px;
		height: 18px;
	}

	.sk-kudos-reaction-wrapper .bp-like-button .like-count {
		font-size: 13px;
	}

	.sk-kudos-reaction-wrapper {
		overflow: visible !important;
	}

	.sk-kudos-reaction-wrapper .ac-emotions_list {
		padding: 8px 10px;
		gap: 8px;
		position: absolute !important;
		bottom: calc(100% + 2px);
		left: -30px !important;
		right: auto !important;
		transform: none !important;
		width: auto;
		max-width: 90vw;
		z-index: 9999 !important;
	}

	.sk-kudos-reaction-wrapper .ac-emotions_list.visible,
	.sk-kudos-reaction-wrapper .ac-emotions_list.active {
		transform: none !important;
	}

	.sk-kudos-reaction-wrapper .ac-emotions_list::after {
		left: 80px;
		transform: none;
	}

	.sk-kudos-reaction-wrapper .ac-emotions_list a {
		padding: 4px;
		-webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
	}

	.sk-kudos-reaction-wrapper .ac-emotions_list img,
	.sk-kudos-reaction-wrapper .ac-emotions_list svg {
		width: 28px;
		height: 28px;
	}

	.sk-kudos-reaction-wrapper .ac-emotions_list i[class*="bb-icon"] {
		font-size: 28px;
		width: 28px;
		height: 28px;
		line-height: 28px;
	}
}

/* Ensure proper z-index stacking */
.sk-kudos-reaction-wrapper {
	z-index: 10;
}

.sk-kudos-reaction-wrapper .ac-emotions_list {
	z-index: 1000;
}

/* Prevent accidental clicks during hover */
body.sk-kudos-emotions-mode .sk-kudos-reaction-wrapper .ac-emotions_list::before {
	content: '';
	position: absolute;
	top: 95%;
	left: 0;
	right: 0;
	height: 15px;
	z-index: -1;
}

.therisereport-kudos-post-meta-footer {
	margin-top: 16px;
}
