/**
 * Pretpot Animated Download Button - CSS
 */

.pretpot-adb-wrapper {
	display: inline-block;
}

.pretpot-adb-button {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border: none;
	outline: none;
	overflow: hidden;
	transition: all 0.3s ease;
	font-family: inherit;
	-webkit-tap-highlight-color: transparent;
}

/* Button Types */
.pretpot-adb-text-button {
	padding: 15px 30px;
	border-radius: 8px;
}

.pretpot-adb-icon-only {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	padding: 0;
}

/* Background Types */
.pretpot-adb-bg-glass {
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 255, 255, 0.2);
}

.pretpot-adb-bg-solid {
	border: 1px solid transparent;
}

.pretpot-adb-bg-gradient {
	border: 1px solid transparent;
}

/* Icon & Text Layout */
.pretpot-adb-button i,
.pretpot-adb-button svg {
	display: inline-block;
	vertical-align: middle;
	transition: transform 0.3s ease;
}

.pretpot-adb-text {
	display: inline-block;
	position: relative;
	z-index: 2;
}

/* Hover State */
.pretpot-adb-button:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.pretpot-adb-button:hover i,
.pretpot-adb-button:hover svg {
	transform: scale(1.1);
}

.pretpot-adb-button:active {
	transform: translateY(0);
}

/* Disabled State During Animation */
.pretpot-adb-button.is-downloading {
	pointer-events: none;
}

/* ========================================
   ANIMATION 1: FILL PROGRESS
   ======================================== */
.pretpot-adb-progress {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 0;
	height: 100%;
	background-color: #00ff88;
	transition: width linear;
	z-index: 1;
	border-radius: inherit;
}

.pretpot-adb-button.is-downloading .pretpot-adb-progress {
	animation: fillProgress linear forwards;
}

@keyframes fillProgress {
	from {
		width: 0;
	}
	to {
		width: 100%;
	}
}

/* ========================================
   ANIMATION 2: BORDER LINE
   ======================================== */
.pretpot-adb-border-line {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 3px solid transparent;
	border-radius: inherit;
	opacity: 0;
	z-index: 3;
	pointer-events: none;
}

.pretpot-adb-button.is-downloading .pretpot-adb-border-line {
	opacity: 1;
	animation: borderLineTrace linear forwards;
}

@keyframes borderLineTrace {
	0% {
		border-top-color: currentColor;
		border-right-color: transparent;
		border-bottom-color: transparent;
		border-left-color: transparent;
		clip-path: polygon(0 0, 0% 0, 0% 0, 0 0);
	}
	25% {
		border-top-color: currentColor;
		border-right-color: currentColor;
		border-bottom-color: transparent;
		border-left-color: transparent;
		clip-path: polygon(0 0, 100% 0, 100% 0%, 0 0);
	}
	50% {
		border-top-color: currentColor;
		border-right-color: currentColor;
		border-bottom-color: currentColor;
		border-left-color: transparent;
		clip-path: polygon(0 0, 100% 0, 100% 100%, 0 0);
	}
	75% {
		border-top-color: currentColor;
		border-right-color: currentColor;
		border-bottom-color: currentColor;
		border-left-color: currentColor;
		clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
	}
	100% {
		border-top-color: currentColor;
		border-right-color: currentColor;
		border-bottom-color: currentColor;
		border-left-color: currentColor;
		clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
	}
}

/* Alternative border trace animation using pseudo-elements for smoother effect */
.pretpot-adb-button[data-animation="border"]::before {
	content: '';
	position: absolute;
	top: -3px;
	left: -3px;
	right: -3px;
	bottom: -3px;
	background: linear-gradient(90deg, var(--border-color, #00ff88) 50%, transparent 50%);
	background-size: 200% 100%;
	border-radius: inherit;
	opacity: 0;
	z-index: 1;
	mask: 
		linear-gradient(#fff 0 0) content-box, 
		linear-gradient(#fff 0 0);
	mask-composite: exclude;
	-webkit-mask: 
		linear-gradient(#fff 0 0) content-box, 
		linear-gradient(#fff 0 0);
	-webkit-mask-composite: xor;
	padding: 3px;
}

.pretpot-adb-button.is-downloading[data-animation="border"]::before {
	opacity: 1;
	animation: borderSweep linear forwards;
}

@keyframes borderSweep {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

/* ========================================
   ANIMATION 3: THANK YOU TEXT
   ======================================== */
.pretpot-adb-thank-you {
	position: absolute;
	top: 50%;
	left: -100%;
	transform: translateY(-50%);
	white-space: nowrap;
	font-weight: 600;
	opacity: 0;
	z-index: 10;
	color: #00ff88;
	transition: all 0.3s ease;
}

.pretpot-adb-button.is-downloading .pretpot-adb-thank-you {
	animation: slideThankYou ease-in-out forwards;
}

.pretpot-adb-button.is-downloading .pretpot-adb-text,
.pretpot-adb-button.is-downloading i,
.pretpot-adb-button.is-downloading svg {
	opacity: 0;
	transition: opacity 0.2s ease;
}

@keyframes slideThankYou {
	0% {
		left: -100%;
		opacity: 0;
	}
	15% {
		opacity: 1;
	}
	50% {
		left: 50%;
		transform: translate(-50%, -50%);
		opacity: 1;
	}
	85% {
		opacity: 1;
	}
	100% {
		left: 150%;
		opacity: 0;
	}
}

/* Reset after animation */
.pretpot-adb-button.animation-complete .pretpot-adb-text,
.pretpot-adb-button.animation-complete i,
.pretpot-adb-button.animation-complete svg {
	opacity: 1;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
	.pretpot-adb-text-button {
		padding: 12px 24px;
	}
	
	.pretpot-adb-icon-only {
		width: 50px;
		height: 50px;
	}
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
.pretpot-adb-button:focus {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.pretpot-adb-button:focus:not(:focus-visible) {
	outline: none;
}

/* Screen reader only text */
.pretpot-adb-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}