/**
 * Social Share Buttons Styles
 * Minimal, performant styling for magazine social sharing
 */

/* Share button container */
.satmag-share-buttons {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	position: relative;
}

/* Native Share Button - Link Style (for magazine-list inline) */
.satmag-share-native.satmag-share-link-style {
	display: inline-flex;
	align-items: center;
	color: #0073aa;
	text-decoration: none;
	font-size: 14px;
	cursor: pointer;
	transition: color 0.2s ease;
	background: none;
	border: none;
	padding: 0;
	line-height: 1;
}
.dark-mode .satmag-share-native.satmag-share-link-style {
	color: #ff7777;
}
.satmag-share-native.satmag-share-link-style:hover {
	color: #005177;
	text-decoration: underline;
}

/* Dark mode support for link style */
@media (prefers-color-scheme: dark) {
	.satmag-share-native.satmag-share-link-style {
		color: #ff7777;
	}

	.satmag-share-native.satmag-share-link-style:hover {
		color: #ff9999;
	}

	.satmag-share-buttons.is-open .satmag-share-native.satmag-share-link-style {
		color: #ff9999;
	}
}

.satmag-share-native.satmag-share-link-style .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	line-height: 1;
}

/* Native Share Button - Icon Button Style (for other blocks) */
.satmag-share-native.satmag-share-button-style {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: #f0f0f0;
	border: 1px solid #ddd;
	border-radius: 4px;
	cursor: pointer;
	color: #333;
	transition: background 0.2s ease, transform 0.1s ease;
	position: relative;
}

.satmag-share-native.satmag-share-button-style:hover {
	background: #e0e0e0;
	transform: translateY(-1px);
}

.satmag-share-native.satmag-share-button-style:active {
	transform: translateY(0);
}

.satmag-share-native.satmag-share-button-style .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

/* Active state when dropdown is open */
.satmag-share-buttons.is-open .satmag-share-native {
	background: #e0e0e0;
	border-color: #999;
}

/* Keep link style intact even when open */
.satmag-share-buttons.is-open .satmag-share-native.satmag-share-link-style {
	background: none;
	border-color: transparent;
	color: #005177;
}

/* Fallback social platform links */
.satmag-share-fallback {
	display: none;
	gap: 8px;
	align-items: center;
}

.satmag-share-fallback.is-visible {
	display: flex;
}

/* Dropdown mode (desktop fallback) */
.satmag-share-fallback.is-dropdown {
	display: none;
	position: absolute;
	top: calc(100% + 4px);
	right: 0;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 6px;
	padding: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	z-index: 1000;
	opacity: 0;
	transform: translateY(-10px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
	white-space: nowrap;
}

.satmag-share-buttons.is-open .satmag-share-fallback.is-dropdown {
	display: flex;
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

/* Positioning adjustment for inline display in list layouts */
.satmag-list-actions .satmag-share-fallback.is-dropdown,
.satmag-archive-list-actions .satmag-share-fallback.is-dropdown {
	right: auto;
	left: 0;
	top: calc(100% + 2px);
}

/* Ensure inline style share buttons align properly */
.satmag-list-actions .satmag-share-buttons,
.satmag-archive-list-actions .satmag-share-buttons {
	display: inline-flex;
	margin-left: 12px;
}

/* Ensure dropdown appears above other content */
.satmag-share-buttons.has-dropdown {
	z-index: 1;
}

.satmag-share-buttons.has-dropdown.is-open {
	z-index: 1001;
}

.satmag-share-link {
	display: inline-flex;
	width: 32px;
	height: 32px;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: transform 0.2s ease, opacity 0.2s ease;
	text-decoration: none;
	flex-shrink: 0;
}

.satmag-share-link:hover {
	transform: translateY(-2px);
	opacity: 0.9;
}

.satmag-share-link:active {
	transform: translateY(0);
}

/* Platform-specific colors */
.satmag-share-facebook {
	background: #1877f2;
}

.satmag-share-twitter {
	background: #000;
}

.satmag-share-linkedin {
	background: #0a66c2;
}

.satmag-share-email {
	background: #666;
}

/* SVG icon sizing */
.satmag-share-link svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

/* Integration with existing action buttons */
.satmag-magazine-actions .satmag-share-buttons {
	margin-left: 0;
}

/* Align button style with existing action buttons */
.satmag-magazine-actions .satmag-share-native.satmag-share-button-style {
	width: auto;
	min-width: 42px;
	height: 42px;
	max-height: 42px;
	padding: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* Archive block grid layout integration */
.satmag-magazine-card {
	overflow: visible !important;
}

.satmag-magazine-card .satmag-magazine-actions {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}

/* Archive block list layout integration */
.satmag-archive-list-actions .satmag-share-buttons .satmag-share-native.satmag-share-link-style {
	font-size: 14px;
}

/* Magazine list block integration */
.satmag-list-actions .satmag-share-buttons .satmag-share-native.satmag-share-link-style {
	font-size: 14px;
}

/* Single magazine block integration */
.satmag-single-magazine-block .satmag-magazine-actions {
	display: flex;
	gap: 12px;
	align-items: center;
	flex-wrap: wrap;
}

.satmag-single-magazine-block .satmag-share-buttons {
	margin-left: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.satmag-share-buttons {
		gap: 6px;
	}

	.satmag-share-native.satmag-share-button-style {
		width: 28px;
		height: 28px;
	}

	.satmag-share-link {
		width: 28px;
		height: 28px;
	}

	.satmag-share-link svg {
		width: 16px;
		height: 16px;
	}
}

/* Accessibility - Focus states */
.satmag-share-native:focus,
.satmag-share-link:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.satmag-share-native {
		border: 2px solid #000;
	}

	.satmag-share-link {
		border: 2px solid #fff;
	}
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
	.satmag-share-native,
	.satmag-share-link {
		transition: none;
	}

	.satmag-share-native:hover,
	.satmag-share-link:hover {
		transform: none;
	}
}
