/**
 * ChangelogWP Frontend Styles
 *
 * Badge system inspired by EDD Changelog Badges by Very Good Plugins.
 * https://verygoodplugins.com/
 *
 * @package ChangelogWP
 */

.changelogwp-changelog {
	display: flex;
	flex-direction: column;
	gap: 1.5em;
}

.changelogwp-changelog h4 {
	margin: 1.5em 0 0.75em;
	padding-bottom: 0.5em;
	border-bottom: 1px solid #e2e4e7;
	font-size: 1.1em;
	font-weight: 600;
}

.changelogwp-changelog h4:first-child {
	margin-top: 0;
}

.changelogwp-changelog h4.anchoring,
.changelogwp-changelog h1.anchoring,
.changelogwp-changelog h2.anchoring,
.changelogwp-changelog h3.anchoring,
.changelogwp-changelog h5.anchoring,
.changelogwp-changelog h6.anchoring {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.5em;
}

.changelogwp-changelog h4.anchoring .changelogwp-copy-link,
.changelogwp-changelog h1.anchoring .changelogwp-copy-link,
.changelogwp-changelog h2.anchoring .changelogwp-copy-link,
.changelogwp-changelog h3.anchoring .changelogwp-copy-link,
.changelogwp-changelog h5.anchoring .changelogwp-copy-link,
.changelogwp-changelog h6.anchoring .changelogwp-copy-link {
	opacity: 0.5;
	transition: opacity 0.2s ease;
}

.changelogwp-changelog h4.anchoring:hover .changelogwp-copy-link,
.changelogwp-changelog h1.anchoring:hover .changelogwp-copy-link,
.changelogwp-changelog h2.anchoring:hover .changelogwp-copy-link,
.changelogwp-changelog h3.anchoring:hover .changelogwp-copy-link,
.changelogwp-changelog h5.anchoring:hover .changelogwp-copy-link,
.changelogwp-changelog h6.anchoring:hover .changelogwp-copy-link {
	opacity: 1;
}

.changelogwp-changelog ul {
	margin: 0 0 1.5em 0;
	padding: 0;
	list-style: none;
}

.changelogwp-changelog ul li {
	display: flex;
	align-items: flex-start;
	gap: 15px;
	padding: 0.5em 0;
	margin: 0;
	border-bottom: 1px solid #f0f0f1;
}

.changelogwp-changelog ul li:last-child {
	border-bottom: none;
}

.changelogwp-item-text {
	flex: 1;
	min-width: 0; /* Allows text to wrap properly in flexbox */
	line-height: 22px;
}

/* Badge Base Styles */
.changelogwp-badge {
	display: inline-block;
	flex-shrink: 0;
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 11px;
	line-height: 1;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	line-height: 1.8;
	width: 100px;
	text-align: center;
	color: #fff;
	white-space: nowrap;
	box-sizing: border-box;
}

/* Badge Styles */
.badge-style-rounded .changelogwp-badge {
	border-radius: 4px;
}

.badge-style-square .changelogwp-badge {
	border-radius: 0;
}

.badge-style-pill .changelogwp-badge {
	border-radius: 9999px;
	padding: 2px 12px;
}

/* Badge Position - Left (default) */
/* Flexbox handles alignment automatically */

/* Badge Position - Inline */
.badge-position-inline .changelogwp-badge,
.changelogwp-changelog.badge-position-inline .changelogwp-badge {
	width: auto;
}

/* Badge Types */
.changelogwp-badge.added,
.changelogwp-badge.new {
	background-color: #0e7a2a;
}

.changelogwp-badge.improved {
	background-color: #0a4c7f;
}

.changelogwp-badge.fixed,
.changelogwp-badge.fix {
	background-color: #a93800;
}

.changelogwp-badge.security {
	background-color: #8b0000;
}

.changelogwp-badge.dev,
.changelogwp-badge.developer {
	background-color: #1f262b;
}

.changelogwp-badge.deprecated {
	background-color: #6b7280;
}

.changelogwp-badge.removed {
	background-color: #dc2626;
}

.changelogwp-badge.tweak {
	background-color: #7c3aed;
}

/* Changelog Meta */
.changelogwp-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 1em;
	padding: 1em;
	background: #f8f9fa;
	border-radius: 6px;
	font-size: 0.9em;
}

.changelogwp-meta-item {
	display: flex;
	align-items: center;
	gap: 0.5em;
}

.changelogwp-meta-label {
	font-weight: 600;
	color: #50575e;
}

.changelogwp-meta-value {
	color: #1d2327;
}

/* Version Header */
.changelogwp-version-header {
	display: flex;
	align-items: baseline;
	gap: 1em;
}

.changelogwp-version-date {
	font-size: 0.85em;
	color: #757575;
	font-weight: normal;
}

/* Responsive */
@media screen and (max-width: 600px) {
	.changelogwp-changelog.badge-position-left ul li {
		flex-direction: column;
		gap: 6px;
	}

	.changelogwp-changelog.badge-position-left .changelogwp-badge {
		width: auto;
		align-self: flex-start;
	}

	.changelogwp-meta {
		flex-direction: column;
		gap: 0.5em;
	}

	.changelogwp-item-text { 
		display: block; 
	}
}

/* Search */
.changelogwp-search {
	/* Spacing handled by parent gap */
}

.changelogwp-search-input {
	width: 100%;
	padding: 0.75em;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 1em;
}

.changelogwp-search-input:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

/* Badge Filters */
.changelogwp-badge-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
}

.changelogwp-filter-btn {
	padding: 0.5em 1em;
	border: 1px solid #ddd;
	border-radius: 4px;
	color: #fff !important;
	cursor: pointer;
	font-size: 0.9em;
	transition: all 0.2s ease;
	opacity: 1;
}

/* When showing all (no specific filter), all buttons are full opacity */
.changelogwp-badge-filters.showing-all .changelogwp-filter-btn {
	opacity: 1;
}

/* When a specific filter is active, non-active buttons are dimmed */
.changelogwp-badge-filters:not(.showing-all) .changelogwp-filter-btn:not(.active) {
	opacity: 0.6;
}

.changelogwp-filter-btn:hover {
	opacity: 0.8;
}

.changelogwp-badge-filters.showing-all .changelogwp-filter-btn:hover {
	opacity: 1;
}

.changelogwp-filter-btn:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
	opacity: 0.8;
}

.changelogwp-badge-filters.showing-all .changelogwp-filter-btn:focus {
	opacity: 1;
}

.changelogwp-filter-btn.active {
	opacity: 1;
	border-color: rgba(255, 255, 255, 0.5);
}

/* Copy Link Button */
.changelogwp-copy-link {
	background: transparent !important;
	border: none !important;
	cursor: pointer;
	padding: 0 !important;
	margin: 0 !important;
	font-size: 0.85em;
	display: inline-flex;
	align-items: center;
	line-height: 1;
	color: #666 !important;
	transition: color 0.2s ease;
	box-shadow: none !important;
	outline: none !important;
	text-decoration: none !important;
	vertical-align: baseline;
	position: relative;
}

.changelogwp-copy-link:hover {
	color: #666 !important;
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
}

.changelogwp-copy-link:focus {
	color: #666 !important;
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
	outline: 2px solid #2271b1 !important;
	outline-offset: 2px !important;
}

.changelogwp-copy-link:active {
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
}

.changelogwp-link-icon {
	display: inline-flex;
	align-items: center;
	transition: opacity 0.2s ease;
}

.changelogwp-link-icon svg {
	width: 16px;
	height: 16px;
	fill: #666 !important;
	vertical-align: middle;
}

.changelogwp-copy-link.copied .changelogwp-link-icon {
	opacity: 0;
}

.changelogwp-copied-text {
	display: none !important;
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%);
	margin-bottom: 8px;
	padding: 4px 8px;
	background: #333;
	color: #fff;
	border-radius: 4px;
	font-weight: 600;
	font-size: 0.75em;
	white-space: nowrap;
	z-index: 1000;
	pointer-events: none;
}

.changelogwp-copied-text::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: #333;
}

/* Screen reader text (WordPress standard class) */
.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	position: absolute !important;
	height: 1px;
	width: 1px;
	overflow: hidden;
	word-wrap: normal !important;
}

.changelogwp-copy-link.copied .changelogwp-copied-text {
	display: block !important;
}


