/**
 * WP Copy Text Button - Frontend Styles
 *
 * All selectors prefixed with wctb- to ensure zero conflicts with active theme.
 */

/* Default CSS custom property fallback tokens */
:root {
	--wctb-bg: #2563eb;
	--wctb-color: #ffffff;
	--wctb-hover-bg: #1d4ed8;
	--wctb-hover-color: #ffffff;
	--wctb-border-color: #2563eb;
	--wctb-border-width: 0px;
	--wctb-border-radius: 6px;
	--wctb-font-size: 13px;
	--wctb-font-weight: 500;
	--wctb-font-family: inherit;
	--wctb-padding-v: 6px;
	--wctb-padding-h: 12px;
	--wctb-width: auto;
	--wctb-height: auto;
	--wctb-margin-h: 8px;
	--wctb-margin-v: 4px;
	--wctb-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05), 0 1px 3px 0 rgba(0, 0, 0, 0.08);
	--wctb-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Copy Button */
.wctb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	background-color: var(--wctb-bg);
	color: var(--wctb-color);
	border: var(--wctb-border-width) solid var(--wctb-border-color);
	border-radius: var(--wctb-border-radius);
	font-size: var(--wctb-font-size);
	font-weight: var(--wctb-font-weight);
	font-family: var(--wctb-font-family);
	padding: var(--wctb-padding-v) var(--wctb-padding-h);
	width: var(--wctb-width);
	height: var(--wctb-height);
	box-shadow: var(--wctb-box-shadow);
	transition: var(--wctb-transition);
	cursor: pointer;
	line-height: 1.35;
	text-decoration: none;
	vertical-align: middle;
	user-select: none;
	-webkit-user-select: none;
	box-sizing: border-box;
	white-space: nowrap;
	outline: none;
	-webkit-tap-highlight-color: transparent;
	margin-top: var(--wctb-margin-v);
	margin-bottom: var(--wctb-margin-v);
}

/* Horizontal positioning */
.wctb-btn.wctb-pos-adjacent,
.wctb-btn.wctb-pos-after {
	margin-left: var(--wctb-margin-h);
}

.wctb-btn.wctb-pos-inline-start,
.wctb-btn.wctb-pos-before {
	margin-right: var(--wctb-margin-h);
}

.wctb-btn.wctb-pos-adjacent,
.wctb-btn.wctb-pos-inline-start {
	vertical-align: middle;
	display: inline-flex;
}

/* Display Modes */
.wctb-btn.wctb-display-block {
	display: flex;
	margin-left: 0;
	margin-right: 0;
	width: fit-content;
}

.wctb-btn.wctb-display-inline-flex {
	display: inline-flex;
}

/* Hover State */
.wctb-btn:hover {
	background-color: var(--wctb-hover-bg);
	color: var(--wctb-hover-color);
	transform: translateY(-1px);
}

/* Active State */
.wctb-btn:active {
	transform: translateY(0);
	filter: brightness(0.96);
}

/* Focus Visible for Accessibility */
.wctb-btn:focus-visible {
	outline: 2px solid var(--wctb-hover-bg);
	outline-offset: 2px;
}

/* Disabled State */
.wctb-btn:disabled {
	opacity: 0.65;
	cursor: not-allowed;
	transform: none !important;
}

/* Copied State Feedback */
.wctb-btn[data-wctb-state="copied"] {
	filter: brightness(1.03);
}

.wctb-btn[data-wctb-state="copied"] .wctb-btn-icon svg {
	transform: scale(1.1);
	transition: transform 0.15s ease-in-out;
}

/* Failed State Feedback */
.wctb-btn[data-wctb-state="failed"] {
	border-color: #ef4444;
}

/* Icon Container */
.wctb-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	flex-shrink: 0;
	width: 1.1em;
	height: 1.1em;
}

.wctb-btn-icon svg {
	width: 100%;
	height: 100%;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	vertical-align: middle;
}

/* Button Text */
.wctb-btn-text {
	display: inline-block;
	line-height: inherit;
}

/* Hover Reveal Mode */
.wctb-hover-reveal {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.22s ease-in-out, visibility 0.22s ease-in-out, transform 0.2s ease-in-out;
}

.wctb-hover-reveal.wctb-hover-active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* Sibling hover fallback for hover-reveal */
:hover + .wctb-hover-reveal,
.wctb-hover-reveal:hover {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* Touch devices fallback for hover-reveal: Always visible on touchscreens */
@media (hover: none) and (pointer: coarse) {
	.wctb-hover-reveal {
		opacity: 1 !important;
		visibility: visible !important;
		pointer-events: auto !important;
	}
}

/* Accessibility: Respect Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
	.wctb-btn,
	.wctb-hover-reveal,
	.wctb-btn-icon svg {
		transition: none !important;
		transform: none !important;
		animation: none !important;
	}
}
