/**
 * Frontend styles for Tool Link Groups
 * Individual modals for each link with dynamic colors
 * All selectors are scoped with .tlp- prefix
 * No global selectors to avoid theme breakage
 * 
 * Professional CSS isolation to prevent conflicts with Bootstrap, themes, etc.
 */

/* CSS Reset for modal elements to prevent theme interference */
.tlp-modal *,
.tlp-modal *::before,
.tlp-modal *::after {
	box-sizing: border-box;
}

.tlp-widget-container {
	margin: 40px auto;
	padding: 20px 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	position: relative;
	clear: both;
	width: 80% !important;
	max-width: 100% !important;
}

.tlp-widget-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 12px;
	margin: 0;
	padding: 0;
}

.tlp-widget-item {
	margin: 0;
	padding: 0;
	position: relative;
}

/* Shimmer animation for gradient bar */
@keyframes tlp-shimmer {
	0% {
		left: -100%;
	}
	100% {
		left: 100%;
	}
}

/* Card entrance animation */
@keyframes tlp-card-fade-in {
	from {
		opacity: 0;
		transform: translateY(20px) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

body .tlp-widget-item {
	animation: tlp-card-fade-in 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

body .tlp-widget-item:nth-child(1) { animation-delay: 0.05s; }
body .tlp-widget-item:nth-child(2) { animation-delay: 0.1s; }
body .tlp-widget-item:nth-child(3) { animation-delay: 0.15s; }
body .tlp-widget-item:nth-child(4) { animation-delay: 0.2s; }
body .tlp-widget-item:nth-child(5) { animation-delay: 0.25s; }
body .tlp-widget-item:nth-child(6) { animation-delay: 0.3s; }
body .tlp-widget-item:nth-child(7) { animation-delay: 0.35s; }
body .tlp-widget-item:nth-child(8) { animation-delay: 0.4s; }
body .tlp-widget-item:nth-child(n+9) { animation-delay: 0.45s; }

body .tlp-widget-button {
	all: unset !important;
	display: block !important;
	width: 100% !important;
	background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%) !important;
	border-radius: 16px !important;
	cursor: pointer !important;
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
	box-sizing: border-box !important;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04) !important;
	border: 1px solid rgba(0, 0, 0, 0.08) !important;
	overflow: hidden !important;
	text-align: left !important;
	position: relative !important;
	visibility: visible !important;
	text-decoration: none !important;
}

body .tlp-widget-button::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
	transition: left 0.5s;
	z-index: 1;
}

body .tlp-widget-button:hover {
	transform: translateY(-4px) scale(1.02) !important;
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08) !important;
	border-color: rgba(0, 0, 0, 0.12) !important;
	text-decoration: none !important;
}

body .tlp-widget-button:hover::before {
	left: 100%;
}

body .tlp-widget-button:active {
	transform: translateY(-2px) scale(1.01) !important;
	transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body .tlp-widget-button:visited {
	color: inherit !important;
	text-decoration: none !important;
}

body .tlp-widget-button:active {
	-webkit-transform: translateY(0) !important;
	transform: translateY(0) !important;
}


body .tlp-widget-icon {
	display: flex !important;
	justify-content: center !important;
	align-items: center !important;
	width: 48px !important;
	height: 48px !important;
	margin: 0 auto 14px auto !important;
	border-radius: 12px !important;
	font-size: 20px !important;
	font-weight: normal !important;
	visibility: visible !important;
	flex-shrink: 0 !important;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1) !important;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
	position: relative !important;
	overflow: hidden !important;
}

body .tlp-widget-button:hover .tlp-widget-icon {
	transform: scale(1.1) rotate(5deg) !important;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

body .tlp-widget-button:hover .tlp-widget-icon::before {
	width: 100px !important;
	height: 100px !important;
}

body .tlp-widget-icon i {
	color: #ffffff !important;
	display: block !important;
	line-height: 1 !important;
	font-style: normal !important;
	position: relative !important;
	z-index: 1 !important;
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body .tlp-widget-button:hover .tlp-widget-icon i {
	transform: scale(1.15) !important;
}

body .tlp-widget-label {
	text-align: center !important;
	font-size: 12px !important;
	font-weight: 600 !important;
	line-height: 1.4 !important;
	margin: 0 !important;
	padding: 0 !important;
	word-wrap: break-word !important;
	overflow-wrap: break-word !important;
	hyphens: auto !important;
	visibility: visible !important;
}

.tlp-widget-button:active {
	-webkit-transform: translateY(-1px) !important;
	transform: translateY(-1px) !important;
}

.tlp-widget-button:focus {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* Modal Styles - Card-like Design */
/* Maximum specificity with body prefix to override theme/Bootstrap */
body .tlp-modal {
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	z-index: 99999 !important;
	display: none !important;
	visibility: hidden !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 20px !important;
	margin: 0 !important;
	width: 100% !important;
	height: 100% !important;
	overflow: hidden !important;
}

body .tlp-modal[aria-hidden="false"] {
	display: flex !important;
	visibility: visible !important;
}

body .tlp-modal-backdrop {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100% !important;
	height: 100% !important;
	background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.5) 100%) !important;
	backdrop-filter: blur(8px) saturate(180%) !important;
	-webkit-backdrop-filter: blur(8px) saturate(180%) !important;
	animation: tlp-fade-in 0.3s ease !important;
	margin: 0 !important;
	padding: 0 !important;
	display: block !important;
	visibility: visible !important;
}

@keyframes tlp-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

body .tlp-modal-content {
	position: relative !important;
	width: 90% !important;
	max-width: 320px !important;
	border-radius: 16px !important;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.1) !important;
	overflow: hidden !important;
	animation: tlp-modal-slide-up 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
	z-index: 1 !important;
	/* background-color and border are set dynamically via inline styles from PHP/JS */
	padding: 0 !important;
	margin: 0 auto !important;
	/* border is set dynamically via inline styles from PHP/JS */
	display: block !important;
	visibility: visible !important;
	/* Reset any theme/Bootstrap overrides */
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
	font-size: 14px !important;
	line-height: 1.5 !important;
	color: #1d2327 !important;
}

body .tlp-modal[aria-hidden="false"] .tlp-modal-content {
	animation: tlp-modal-slide-up 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body .tlp-modal[aria-hidden="false"] .tlp-modal-icon {
	animation: tlp-icon-bounce 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s !important;
}

/* Ensure modal content is visible when modal is open */
body .tlp-modal[aria-hidden="false"] .tlp-modal-content {
	display: block !important;
	visibility: visible !important;
}

@keyframes tlp-modal-slide-up {
	from {
		opacity: 0;
		-webkit-transform: translateY(30px) scale(0.9);
		transform: translateY(30px) scale(0.9);
	}
	to {
		opacity: 1;
		-webkit-transform: translateY(0) scale(1);
		transform: translateY(0) scale(1);
	}
}

@keyframes tlp-modal-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes tlp-icon-bounce {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.1);
	}
}

.tlp-modal-icon-wrapper {
	display: flex !important;
	justify-content: center !important;
	align-items: center !important;
	padding: 32px 20px 20px 20px !important;
	margin: 0 !important;
}

.tlp-modal-icon {
	width: 64px !important;
	height: 64px !important;
	border-radius: 16px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	font-size: 28px !important;
	font-weight: bold !important;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
	margin: 0 auto !important;
	background-color: #0073aa !important; /* Fallback color, overridden by inline style */
	color: #ffffff !important;
	/* Reset any button/input styles */
	border: none !important;
	padding: 0 !important;
	cursor: default !important;
}

.tlp-modal-icon span {
	color: #ffffff !important;
	display: block !important;
	line-height: 1 !important;
}

.tlp-modal-title {
	margin: 0 0 24px 0 !important;
	font-size: 16px !important;
	font-weight: 600 !important;
	line-height: 1.4 !important;
	word-wrap: break-word !important;
	text-align: center !important;
	color: #1d2327 !important; /* Fallback color, overridden by inline style */
	padding: 0 !important;
	/* Reset any h3 styles from theme */
	font-family: inherit !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}

body .tlp-modal-status {
	position: absolute !important;
	top: 12px !important;
	right: 12px !important;
	display: inline-block !important;
	padding: 5px 12px !important;
	border-radius: 20px !important;
	font-size: 10px !important;
	font-weight: 700 !important;
	text-transform: uppercase !important;
	letter-spacing: 0.5px !important;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
	z-index: 10 !important;
	margin: 0 !important;
	background-color: #0073aa !important; /* Fallback color, overridden by inline style */
	color: #ffffff !important;
	visibility: visible !important;
	/* Reset any span/a styles */
	text-decoration: none !important;
	border: none !important;
}

body .tlp-modal-close {
	all: unset !important;
	cursor: pointer !important;
	font-size: 24px !important;
	line-height: 1 !important;
	width: 32px !important;
	height: 32px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	border-radius: 50% !important;
	transition: all 0.2s ease !important;
	opacity: 0.5 !important;
	position: absolute !important;
	top: 12px !important;
	left: 12px !important;
	z-index: 10 !important;
	background-color: rgba(255, 255, 255, 0.9) !important;
	color: #1d2327 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
	visibility: visible !important;
}

.tlp-modal-close:hover {
	background-color: rgba(0, 0, 0, 0.1);
	opacity: 1;
}

.tlp-modal-close:focus {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.tlp-modal-body {
	padding: 0 24px 28px 24px !important;
	text-align: center !important;
	margin: 0 !important;
}

body .tlp-modal-link {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 8px !important;
	padding: 12px 24px !important;
	border-radius: 8px !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	text-decoration: none !important;
	cursor: pointer !important;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1) !important;
	width: 100% !important;
	box-sizing: border-box !important;
	margin: 0 !important;
	border: none !important;
	background-color: #0073aa !important; /* Fallback color, overridden by inline style */
	color: #ffffff !important;
	visibility: visible !important;
	position: relative !important;
	overflow: hidden !important;
	/* Reset any link styles from theme/Bootstrap */
	font-family: inherit !important;
	line-height: 1.5 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}

body .tlp-modal-link::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.3);
	transform: translate(-50%, -50%);
	transition: width 0.6s, height 0.6s;
}

body .tlp-modal-link:hover {
	transform: translateY(-2px) !important;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25), 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

body .tlp-modal-link:hover::before {
	width: 300px;
	height: 300px;
}

.tlp-modal-link:visited {
	color: #ffffff !important;
}

.tlp-modal-link:hover {
	color: #ffffff !important;
	text-decoration: none !important;
	opacity: 0.95 !important;
}

.tlp-modal-link:focus {
	outline: 2px solid currentColor !important;
	outline-offset: 2px !important;
}

.tlp-modal-link:hover {
	-webkit-transform: translateY(-2px) !important;
	transform: translateY(-2px) !important;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
	opacity: 0.95 !important;
}

.tlp-modal-link:focus {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.tlp-modal-link-arrow {
	font-size: 16px;
	transition: transform 0.2s ease;
}

.tlp-modal-link:hover .tlp-modal-link-arrow {
	-webkit-transform: translateX(4px) !important;
	transform: translateX(4px) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.tlp-widget-container {
		width: 95% !important;
	}
	
	.tlp-widget-grid {
		grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
		gap: 10px;
	}

	.tlp-widget-button {
		padding: 12px 14px;
		font-size: 13px;
	}

	.tlp-modal-content {
		width: 95%;
		max-width: 380px;
	}

	.tlp-modal-header {
		padding: 16px;
		gap: 10px;
	}

	.tlp-modal-icon {
		width: 40px;
		height: 40px;
		font-size: 18px;
	}

	.tlp-modal-title {
		font-size: 16px;
	}

	.tlp-modal-body {
		padding: 0 16px 20px 16px;
	}
}

@media (max-width: 480px) {
	.tlp-widget-container {
		width: 100% !important;
		padding: 10px !important;
	}
	
	.tlp-widget-grid {
		grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
		gap: 8px;
	}

	.tlp-modal {
		padding: 10px;
	}

	.tlp-modal-content {
		width: 100%;
		max-width: 100%;
		border-radius: 8px;
	}
}

