/* =============================================
   TP4R Wishlist Extension Styles
   ============================================= */

/* Wishlist Icon Active State (product cards) */
.tp4r-icon--wishlist.is-active .dashicons {
	color: var(--tp4r-wl-active-color, #ef4444);
}

.tp4r-icon--wishlist.is-active {
	background: #fef2f2 !important;
}

/* =============================================
   Trigger Icon (header/menu)
   ============================================= */
.tp4r-wl-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: relative;
	text-decoration: none;
	color: var(--tp4r-wl-icon-color, #9ca3af);
	transition: color 0.2s ease;
}

.tp4r-wl-trigger:hover {
	color: var(--tp4r-wl-icon-color-active, #ef4444);
}

.tp4r-wl-trigger__icon {
	display: flex;
	align-items: center;
	justify-content: center;
}

.tp4r-wl-trigger__icon svg {
	width: 24px;
	height: 24px;
}

.tp4r-wl-trigger__count {
	position: absolute;
	top: -6px;
	right: -8px;
	background: var(--tp4r-wl-icon-color-active, #ef4444);
	color: #fff;
	font-size: 10px;
	font-weight: 600;
	min-width: 18px;
	height: 18px;
	line-height: 18px;
	text-align: center;
	border-radius: 50%;
	padding: 0 4px;
}

[dir="ltr"] .tp4r-wl-trigger__count {
	right: auto;
	left: -8px;
}

.tp4r-wl-trigger__count[data-count="0"] {
	display: none;
}

/* =============================================
   Add to Wishlist Button (product page)
   ============================================= */
.tp4r-wl-add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px;
	border: 1px solid #e5e7eb;
	background: #fff;
	border-radius: 8px;
	cursor: pointer;
	color: var(--tp4r-wl-icon-color, #9ca3af);
	transition: all 0.2s ease;
	font-size: 14px;
}

.tp4r-wl-add:hover {
	border-color: var(--tp4r-wl-icon-color-active, #ef4444);
	color: var(--tp4r-wl-icon-color-active, #ef4444);
}

.tp4r-wl-add.is-active {
	color: var(--tp4r-wl-icon-color-active, #ef4444);
	background: #fef2f2;
	border-color: var(--tp4r-wl-icon-color-active, #ef4444);
}

.tp4r-wl-add.is-active svg {
	fill: var(--tp4r-wl-icon-color-active, #ef4444);
}

.tp4r-wl-add__icon {
	display: flex;
	align-items: center;
	justify-content: center;
}

.tp4r-wl-add__icon svg {
	width: 20px;
	height: 20px;
	transition: fill 0.2s ease;
}

/* Icon only style */
.tp4r-wl-add--icon {
	padding: 8px;
}

/* Button style */
.tp4r-wl-add--button {
	padding: 10px 20px;
}

/* Icon + text style */
.tp4r-wl-add--icon_text {
	padding: 10px 16px;
}

/* =============================================
   Click Animations
   ============================================= */

/* Pulse Animation - heartbeat effect */
.tp4r-wl-add.tp4r-wl-animate-pulse .tp4r-wl-add__icon,
.tp4r-icon--wishlist.tp4r-wl-animate-pulse {
	animation: tp4r-wl-pulse 0.6s ease-in-out;
}

@keyframes tp4r-wl-pulse {
	0% { transform: scale(1); }
	25% { transform: scale(1.3); }
	50% { transform: scale(0.95); }
	75% { transform: scale(1.15); }
	100% { transform: scale(1); }
}

/* Pop Animation - quick pop effect */
.tp4r-wl-add.tp4r-wl-animate-pop .tp4r-wl-add__icon,
.tp4r-icon--wishlist.tp4r-wl-animate-pop {
	animation: tp4r-wl-pop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes tp4r-wl-pop {
	0% { transform: scale(1); }
	50% { transform: scale(1.5); }
	100% { transform: scale(1); }
}

/* Shake Animation */
.tp4r-wl-add.tp4r-wl-animate-shake .tp4r-wl-add__icon,
.tp4r-icon--wishlist.tp4r-wl-animate-shake {
	animation: tp4r-wl-shake 0.5s ease-in-out;
}

@keyframes tp4r-wl-shake {
	0%, 100% { transform: rotate(0deg); }
	15% { transform: rotate(-15deg); }
	30% { transform: rotate(15deg); }
	45% { transform: rotate(-10deg); }
	60% { transform: rotate(10deg); }
	75% { transform: rotate(-5deg); }
	90% { transform: rotate(5deg); }
}

/* Glow Animation - halo/glow effect */
.tp4r-wl-add.tp4r-wl-animate-glow .tp4r-wl-add__icon,
.tp4r-icon--wishlist.tp4r-wl-animate-glow {
	animation: tp4r-wl-glow 0.6s ease-out;
}

@keyframes tp4r-wl-glow {
	0% {
		filter: drop-shadow(0 0 0 transparent);
		transform: scale(1);
	}
	50% {
		filter: drop-shadow(0 0 12px var(--tp4r-wl-icon-color-active, #ef4444));
		transform: scale(1.15);
	}
	100% {
		filter: drop-shadow(0 0 0 transparent);
		transform: scale(1);
	}
}

/* =============================================
   Popup Styles
   ============================================= */
.tp4r-wl-popup {
	position: fixed;
	inset: 0;
	z-index: 999998;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tp4r-wl-popup.is-open {
	opacity: 1;
	visibility: visible;
}

.tp4r-wl-popup__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

.tp4r-wl-popup__container {
	position: absolute;
	top: 0;
	bottom: 0;
	right: 0;
	width: 380px;
	max-width: 100%;
	background: #fff;
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.3s ease;
	box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}

[dir="ltr"] .tp4r-wl-popup__container {
	right: auto;
	left: 0;
	transform: translateX(-100%);
}

.tp4r-wl-popup.is-open .tp4r-wl-popup__container {
	transform: translateX(0);
}

.tp4r-wl-popup__header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 16px 20px;
	border-bottom: 1px solid #e5e7eb;
}

.tp4r-wl-popup__title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
}

.tp4r-wl-popup__count {
	background: #ef4444;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 20px;
	min-width: 20px;
	text-align: center;
}

.tp4r-wl-popup__close {
	margin-right: auto;
	width: 32px;
	height: 32px;
	border: none;
	background: #f3f4f6;
	border-radius: 50%;
	font-size: 20px;
	cursor: pointer;
	color: #374151;
	transition: background 0.2s ease;
}

[dir="ltr"] .tp4r-wl-popup__close {
	margin-right: 0;
	margin-left: auto;
}

.tp4r-wl-popup__close:hover {
	background: #e5e7eb;
}

.tp4r-wl-popup__content {
	flex: 1;
	overflow-y: auto;
	padding: 16px;

	/* Firefox scrollbar */
	scrollbar-width: thin;
	scrollbar-color: #d1d5db transparent;
}

/* Webkit (Chrome, Safari, Edge) scrollbar */
.tp4r-wl-popup__content::-webkit-scrollbar {
	width: 6px;
}

.tp4r-wl-popup__content::-webkit-scrollbar-track {
	background: transparent;
}

.tp4r-wl-popup__content::-webkit-scrollbar-thumb {
	background-color: #d1d5db;
	border-radius: 20px;
	transition: background-color 0.2s ease;
}

.tp4r-wl-popup__content::-webkit-scrollbar-thumb:hover {
	background-color: #9ca3af;
}

.tp4r-wl-popup__loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px;
}

.tp4r-wl-popup__loading .dashicons {
	font-size: 24px;
	width: 24px;
	height: 24px;
	animation: tp4r-wl-spin 1s linear infinite;
}

@keyframes tp4r-wl-spin {
	100% { transform: rotate(360deg); }
}

.tp4r-wl-popup__empty {
	text-align: center;
	padding: 40px 20px;
	color: #6b7280;
}

.tp4r-wl-popup__empty .dashicons {
	font-size: 48px;
	width: 48px;
	height: 48px;
	color: #d1d5db;
}

/* Wishlist Item */
.tp4r-wl-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px;
	background: #f9fafb;
	border-radius: 10px;
	margin-bottom: 8px;
}

.tp4r-wl-item__img {
	width: 60px;
	height: 60px;
	border-radius: 8px;
	overflow: hidden;
	flex-shrink: 0;
}

.tp4r-wl-item__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tp4r-wl-item__info {
	flex: 1;
	min-width: 0;
}

.tp4r-wl-item__title {
	display: block;
	font-weight: 600;
	font-size: 14px;
	color: #111827;
	text-decoration: none;
	margin-bottom: 4px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tp4r-wl-item__title:hover {
	color: #3b82f6;
}

.tp4r-wl-item__price {
	font-size: 13px;
	color: #6b7280;
	margin-bottom: 6px;
}

/* Move to cart / View product actions */
.tp4r-wl-item__action {
	display: inline-block;
	padding: 6px 12px;
	font-size: 12px;
	font-weight: 500;
	border-radius: 6px;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.2s ease;
}

.tp4r-wl-item__action--cart {
	background: #000;
	color: #fff;
	border: none;
}

.tp4r-wl-item__action--cart:hover {
	background: #333;
}

.tp4r-wl-item__action--cart.is-loading {
	opacity: 0.7;
	pointer-events: none;
}

.tp4r-wl-item__action--link {
	background: #f3f4f6;
	color: #374151;
}

.tp4r-wl-item__action--link:hover {
	background: #e5e7eb;
	color: #111827;
}

.tp4r-wl-item__remove {
	width: 28px;
	height: 28px;
	border: none;
	background: #fee2e2;
	color: #ef4444;
	border-radius: 50%;
	font-size: 18px;
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.2s ease;
}

.tp4r-wl-item__remove:hover {
	background: #fecaca;
}

/* =============================================
   Wishlist Page
   ============================================= */
.tp4r-wl-page__loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 40px;
	color: #6b7280;
}

.tp4r-wl-page__loading .dashicons {
	animation: tp4r-wl-spin 1s linear infinite;
}

.tp4r-wl-page__empty {
	text-align: center;
	padding: 60px 20px;
	color: #6b7280;
}

.tp4r-wl-page__empty .dashicons {
	font-size: 64px;
	width: 64px;
	height: 64px;
	color: #d1d5db;
	margin-bottom: 16px;
}

.tp4r-wl-page__empty p {
	font-size: 18px;
	margin-bottom: 20px;
}

.tp4r-wl-page__content .tp4r-wl-item {
	max-width: 600px;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 480px) {
	.tp4r-wl-popup__container {
		width: 100%;
	}

	.tp4r-wl-item {
		flex-wrap: wrap;
	}

	.tp4r-wl-item__info {
		flex: 1 1 calc(100% - 80px);
	}

	.tp4r-wl-item__remove {
		position: absolute;
		top: 8px;
		left: 8px;
	}

	[dir="ltr"] .tp4r-wl-item__remove {
		left: auto;
		right: 8px;
	}

	.tp4r-wl-item {
		position: relative;
		padding-left: 40px;
	}

	[dir="ltr"] .tp4r-wl-item {
		padding-left: 12px;
		padding-right: 40px;
	}
}

