/**
 * Frontend styles for wishlist
 *
 * @package TTE_Wishlist
 */

/* ============================================================
   Shared button reset
   ============================================================ */
.tte-wishlist-button-wrapper {
	display: block;
	margin: 0;
}

.tte-wishlist-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	cursor: pointer;
	transition: opacity 0.2s ease, transform 0.2s ease;
	line-height: 1;
	padding: 0;
}

.tte-wishlist-btn:focus-visible {
	outline: 2px solid #e53935;
	outline-offset: 2px;
}

.tte-wishlist-btn.loading {
	opacity: 0.5;
	cursor: not-allowed;
}

.tte-wishlist-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* Heart icon — SVG outline by default, filled when .in-wishlist */
.tte-wishlist-heart {
	display: inline-flex;
	line-height: 0;
	pointer-events: none;
}

.tte-wishlist-heart-svg {
	display: block;
	width: 22px;
	height: 22px;
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
}

.tte-wishlist-heart-filled {
	display: none;
}

.tte-wishlist-btn.in-wishlist .tte-wishlist-heart-outline {
	display: none;
}

.tte-wishlist-btn.in-wishlist .tte-wishlist-heart-filled {
	display: block;
}

/* ============================================================
   Shop / archive context — icon overlaid on product image
   ============================================================ */

/* Ensure the product card is a positioning parent.
   Covers standard WooCommerce li.product and Blocksy's card variants. */
.woocommerce ul.products li.product,
.wc-block-grid__product,
.ct-woo-card-wrapper,
li.product {
	position: relative;
}

/* The wrapper sits as first child of li.product (priority 9, before the
   <a> link opens at priority 10) so it is always a direct sibling to the
   image — not nested inside the anchor. */
.tte-wishlist-context-shop {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 20;
	margin: 0;
	padding: 0;
	pointer-events: auto;
	overflow: visible;
}

.tte-wishlist-context-shop .tte-wishlist-btn {
	padding: 0;
	opacity: 0;
	transform: scale(0.9);
	transform-origin: top left;
	transition: opacity 0.2s ease, transform 0.2s ease;
	overflow: visible;
}

.tte-wishlist-context-shop .tte-wishlist-heart {
	overflow: visible;
}

.tte-wishlist-context-shop .tte-wishlist-heart-svg {
	width: 20px;
	height: 20px;
	overflow: visible;
	filter: none;
}

.tte-wishlist-context-shop .tte-wishlist-btn.in-wishlist {
	opacity: 1;
	transform: scale(1);
}

/* Reveal on card hover */
li.product:hover .tte-wishlist-context-shop .tte-wishlist-btn,
.woocommerce ul.products li.product:hover .tte-wishlist-context-shop .tte-wishlist-btn,
.wc-block-grid__product:hover .tte-wishlist-context-shop .tte-wishlist-btn {
	opacity: 1;
	transform: scale(1);
}

/* ============================================================
   Single product gallery context — overlaid on main product image
   ============================================================ */

/* woocommerce_product_thumbnails fires inside .woocommerce-product-gallery.
   Position the button absolutely within that container. */
.woocommerce-product-gallery {
	position: relative;
}

.tte-wishlist-context-gallery {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 20;
	margin: 0;
}

.tte-wishlist-context-gallery .tte-wishlist-btn {
	width: 42px;
	height: 42px;
	/* Always visible on single product page */
	opacity: 1;
	transform: scale(1);
}

.tte-wishlist-context-gallery .tte-wishlist-btn:hover {
	opacity: 1;
}

.tte-wishlist-context-gallery .tte-wishlist-btn.in-wishlist {
	opacity: 1;
}

.tte-wishlist-context-gallery .tte-wishlist-heart-svg {
	width: 24px;
	height: 24px;
}

/* Wishlist Table */
.tte-wishlist-container {
	margin: 20px 0;
}

.tte-wishlist-empty {
	text-align: center;
	padding: 40px 20px;
	background-color: #f9f9f9;
	border-radius: 4px;
}

.tte-wishlist-empty p {
	margin-bottom: 20px;
	color: #666;
}

.tte-wishlist-login-required {
	text-align: center;
	padding: 20px;
	margin-bottom: 20px;
	background-color: #fff8e1;
	border: 1px solid #ffe082;
	border-radius: 4px;
}

.tte-wishlist-login-required p {
	margin: 0;
	color: #5d4037;
}

.tte-wishlist-table {
	width: 100%;
	border-collapse: collapse;
	margin: 20px 0;
}

.tte-wishlist-table thead th {
	background-color: #f5f5f5;
	padding: 12px;
	text-align: left;
	border-bottom: 2px solid #ddd;
	font-weight: 600;
	font-size: 13px;
}

.tte-wishlist-table tbody td {
	padding: 12px;
	border-bottom: 1px solid #eee;
	vertical-align: middle;
}

.tte-wishlist-table tbody tr:hover {
	background-color: #fafafa;
}

.tte-wishlist-image {
	width: 80px;
}

.tte-wishlist-image img {
	max-width: 100%;
	height: auto;
	border-radius: 4px;
}

.tte-wishlist-name a {
	color: #0073aa;
	text-decoration: none;
}

.tte-wishlist-name a:hover {
	text-decoration: underline;
}

.tte-wishlist-price {
	font-weight: 600;
	color: #28a745;
}

.tte-wishlist-in-stock {
	color: #28a745;
	font-weight: 600;
}

.tte-wishlist-out-of-stock {
	color: #dc3545;
	font-weight: 600;
}

.tte-wishlist-date {
	font-size: 12px;
	color: #666;
}

.tte-wishlist-remove-btn {
	padding: 6px 12px;
	font-size: 12px;
	background-color: #dc3545;
	color: white;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.2s;
}

.tte-wishlist-remove-btn:hover {
	background-color: #c82333;
}

/* Mini Wishlist Widget */
.tte-mini-wishlist {
	padding: 15px;
	background-color: #f9f9f9;
	border-radius: 4px;
}

.tte-mini-wishlist-items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tte-mini-wishlist-item {
	display: flex;
	gap: 10px;
	margin-bottom: 10px;
	padding-bottom: 10px;
	border-bottom: 1px solid #eee;
}

.tte-mini-wishlist-item:last-child {
	border-bottom: none;
	margin-bottom: 0;
	padding-bottom: 0;
}

.tte-mini-wishlist-image {
	flex-shrink: 0;
	width: 60px;
}

.tte-mini-wishlist-image img {
	max-width: 100%;
	height: auto;
	border-radius: 4px;
}

.tte-mini-wishlist-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.tte-mini-wishlist-name {
	display: block;
	margin: 0;
	color: #0073aa;
	text-decoration: none;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
}

.tte-mini-wishlist-name:hover {
	text-decoration: underline;
}

.tte-mini-wishlist-footer {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid #eee;
}

.tte-mini-wishlist-view-all {
	width: 100%;
	text-align: center;
	font-size: 12px;
}

/* Floating Button */
.tte-wishlist-floating-button {
	position: fixed;
	bottom: 30px;
	right: 30px;
	z-index: 999;
	animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
	from {
		transform: translateY(100px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

.tte-wishlist-float-link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 50px;
	height: 50px;
	background-color: #e53935;
	color: white;
	border-radius: 50%;
	text-decoration: none;
	font-size: 24px;
	position: relative;
	transition: all 0.3s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tte-wishlist-float-link:hover {
	background-color: #c62828;
	transform: scale(1.1);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.tte-wishlist-float-count {
	position: absolute;
	top: -5px;
	right: -5px;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 4px;
	background-color: #ff6b6b;
	color: white;
	border-radius: 10px;
	font-size: 11px;
	font-weight: bold;
}

.tte-wishlist-float-count.is-empty {
	display: none;
}

.tte-wishlist-float-link .tte-wishlist-header-icon__heart {
	display: inline-flex;
	line-height: 0;
}

.tte-wishlist-float-link .tte-wishlist-header-icon__svg {
	width: 24px;
	height: 24px;
}

/* Header / menu wishlist icon */
.tte-wishlist-icon-wrapper {
	display: inline-block;
	vertical-align: middle;
}

.tte-wishlist-header-icon {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	color: inherit;
	transition: color 0.2s ease;
	line-height: 1;
}

.tte-wishlist-header-icon:hover {
	color: #e53935;
	text-decoration: none;
}

.tte-wishlist-header-icon__heart {
	display: inline-flex;
	line-height: 0;
	pointer-events: none;
}

.tte-wishlist-header-icon__svg {
	display: block;
	width: 22px;
	height: 22px;
}

.tte-wishlist-header-icon__badge {
	position: absolute;
	top: -6px;
	right: -8px;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	background-color: #e53935;
	color: #fff;
	border-radius: 999px;
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
	pointer-events: none;
}

.tte-wishlist-header-icon__badge.is-empty {
	display: none;
}

.tte-wishlist-header-icon--injected {
	margin-inline-end: 0.65em;
}

.menu-item.tte-wishlist-menu-icon-item > a,
.menu-item.tte-wishlist-menu-icon-item > .tte-wishlist-header-icon {
	display: inline-flex;
	align-items: center;
	padding-top: 0;
	padding-bottom: 0;
}

.menu-item.tte-wishlist-menu-icon-item > a:hover,
.menu-item.tte-wishlist-menu-icon-item > .tte-wishlist-header-icon:hover {
	text-decoration: none;
}

/* Guest Notice Banner */
.tte-wishlist-guest-notice-banner {
	position: relative;
	background-color: #e7f3ff;
	border-left: 4px solid #0073aa;
	padding: 15px 20px;
	margin: 20px 0;
	border-radius: 4px;
	animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
	from {
		transform: translateY(-20px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

.tte-wishlist-guest-notice-inner {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 15px;
}

.tte-wishlist-guest-notice-text {
	margin: 0;
	color: #003d5c;
	font-size: 14px;
}

.tte-wishlist-guest-close {
	flex-shrink: 0;
	background: none;
	border: none;
	padding: 0;
	font-size: 24px;
	color: #999;
	cursor: pointer;
	transition: color 0.2s;
}

.tte-wishlist-guest-close:hover {
	color: #333;
}

/* Inline toast inside product image area */
.tie-variation-product-image,
.woocommerce-product-gallery__wrapper,
.woocommerce-product-gallery .flex-viewport {
	position: relative;
}

.tte-wishlist-toast {
	position: absolute;
	top: 50%;
	left: 50%;
	bottom: auto;
	transform: translate(-50%, -50%);
	background: rgba(0, 0, 0, 0.72);
	color: #fff;
	padding: 5px 14px;
	border-radius: 20px;
	font-size: 12px;
	line-height: 1.4;
	z-index: 30;
	pointer-events: none;
	white-space: nowrap;
}

.tte-wishlist-toast--error {
	background: rgba(198, 40, 40, 0.9);
}

/* Messages/Notices */
.woocommerce-success,
.woocommerce-error,
.woocommerce-info {
	padding: 12px 15px;
	margin: 15px 0;
	border-radius: 4px;
	animation: slideDown 0.3s ease-out;
}

.woocommerce-success {
	background-color: #d4edda;
	border: 1px solid #c3e6cb;
	color: #155724;
}

.woocommerce-error {
	background-color: #f8d7da;
	border: 1px solid #f5c6cb;
	color: #721c24;
}

/* Responsive */
@media (max-width: 768px) {
	.tte-wishlist-table {
		font-size: 13px;
	}

	.tte-wishlist-table thead th,
	.tte-wishlist-table tbody td {
		padding: 8px;
	}

	.tte-wishlist-floating-button {
		bottom: 20px;
		right: 20px;
	}

	.tte-wishlist-float-link {
		width: 45px;
		height: 45px;
		font-size: 20px;
	}
}

@media (max-width: 480px) {
	.tte-wishlist-table {
		display: block;
		overflow-x: auto;
	}

	.tte-mini-wishlist-item {
		gap: 8px;
	}

	.tte-mini-wishlist-image {
		width: 50px;
	}
}
