/* ==========================================================
 * 歡喜緣 追蹤清單 — 前台
 * Figma：愛心 20px + 16px Bold 文字、60% 透明；卡片愛心 32px
 * ========================================================== */
.twh-wl-btn,
.twh-wl-modal,
.twh-wl-account {
	--twh-wl-white: #ffffff !important;
	--twh-wl-ink: #292421 !important;      /* 主-木墨黑 */
	--twh-wl-gold: #b58a45;     /* 主-古銅金 */
	--twh-wl-gold-a: #b67b19;
	--twh-wl-gold-b: #d1a64f !important;
	--twh-wl-gold-c: #a96f14 !important;
	--twh-wl-red: #7c2f29 !important;      /* 主-歡喜朱紅 */
	--twh-wl-green: #5b684f;    /* 輔-苔墨綠 */
	font-family: "Noto Serif TC", serif;
}

/* ---------- 共用按鈕 ---------- */
.twh-wl-btn {
	--twh-wl-fill: transparent !important;
	display: inline-flex !important;
	align-items: center !important;
	gap: 8px !important;
	margin: 0 !important;
	padding: 0 !important;
	font-family: inherit !important;
	font-size: 16px !important;
	font-weight: 700 !important;
	line-height: 1.4 !important;
	color: var(--twh-wl-white) !important;
	background: none !important;
	border: 0 !important;
	box-shadow: none !important;
	cursor: pointer !important;
	transition: opacity 0.2s ease, color 0.2s ease !important;
}

.twh-wl-btn:hover,
.twh-wl-btn:focus {
	color: var(--twh-wl-white) !important;
	background: none !important;
}

.twh-wl-btn:focus-visible {
	outline: 2px solid var(--twh-wl-gold-b) !important;
	outline-offset: 3px !important;
}

.twh-wl-btn__icon {
	flex-shrink: 0 !important;
	width: 20px !important;
	height: 20px !important;
	transition: transform 0.2s ease !important;
}

/* 愛心填色由 CSS 控制（SVG 屬性不能讀 CSS 變數） */
.twh-wl-btn__icon path {
	fill: var(--twh-wl-fill) !important;
	transition: fill 0.2s ease !important;
}

/* 已追蹤：實心金色 */
.twh-wl-btn.is-active {
	--twh-wl-fill: var(--twh-wl-gold-b) !important;
	color: var(--twh-wl-gold-b) !important;
}

.twh-wl-btn.is-active .twh-wl-btn__icon {
	transform: scale(1.05) !important;
}

.twh-wl-btn.is-loading {
	opacity: 0.4 !important;
	pointer-events: none !important;
}

/* inline：單頁用，預設 60% 透明 */
.twh-wl-btn--inline {
	opacity: 0.6 !important;
}

.twh-wl-btn--inline:hover,
.twh-wl-btn--inline.is-active {
	opacity: 1 !important;
}

/* icon：商品卡片右上角圓形愛心 32px */
li.product:has(> .twh-wl-btn--icon),
.product:has(> .twh-wl-btn--icon) {
	position: relative !important;
}

.twh-wl-btn--icon {
	position: absolute !important;
	top: 16px !important;
	right: 16px !important;
	z-index: 3 !important;
	justify-content: center !important;
	width: 32px !important;
	height: 32px !important;
	background: rgba(41, 36, 33, 0.6) !important;
	border: 1px solid rgba(255, 255, 255, 0.6) !important;
	border-radius: 50% !important;
}

.twh-wl-btn--icon .twh-wl-btn__icon {
	width: 16px !important;
	height: 16px !important;
}

.twh-wl-btn--icon:hover,
.twh-wl-btn--icon:focus {
	background: rgba(41, 36, 33, 0.85) !important;
	border-color: var(--twh-wl-white) !important;
}

.twh-wl-btn--icon.is-active {
	border-color: var(--twh-wl-gold-b) !important;
}

/* ---------- 登入彈窗 ---------- */
body.twh-wl-modal-open {
	overflow: hidden;
}

.twh-wl-modal[hidden] {
	display: none;
}

.twh-wl-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.twh-wl-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
}

.twh-wl-modal__dialog {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 440px;
	padding: 48px 32px 32px;
	text-align: center;
	color: var(--twh-wl-white);
	background: var(--twh-wl-ink);
	border: 1px solid var(--twh-wl-gold-a);
	box-shadow: inset 0 0 0 4px var(--twh-wl-ink), inset 0 0 0 5px rgba(182, 123, 25, 0.6), 0 2px 20px #000;
	outline: none;
}

.twh-wl-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	color: var(--twh-wl-white);
	background: none;
	border: 0;
	opacity: 0.6;
	cursor: pointer;
}

.twh-wl-modal__close:hover,
.twh-wl-modal__close:focus {
	color: var(--twh-wl-white);
	background: none;
	opacity: 1;
}

.twh-wl-modal__title {
	margin: 0 0 12px;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.4;
	color: transparent;
	background: linear-gradient(180deg, var(--twh-wl-gold-a) 0%, var(--twh-wl-gold-b) 50%, var(--twh-wl-gold-c) 100%);
	-webkit-background-clip: text;
	background-clip: text;
}

.twh-wl-modal__desc {
	margin: 0 0 28px;
	font-size: 16px;
	line-height: 1.6;
	opacity: 0.8;
}

.twh-wl-modal__actions {
	display: flex;
	gap: 12px;
}

.twh-wl-modal__btn {
	display: inline-flex;
	flex: 1;
	align-items: center;
	justify-content: center;
	height: 48px;
	padding: 0 16px;
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
	text-decoration: none;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.twh-wl-modal__btn--ghost {
	color: var(--twh-wl-white);
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.6);
}

.twh-wl-modal__btn--ghost:hover,
.twh-wl-modal__btn--ghost:focus {
	color: var(--twh-wl-white);
	background: rgba(255, 255, 255, 0.08);
}

.twh-wl-modal__btn--primary,
.twh-wl-modal__btn--primary:visited {
	color: var(--twh-wl-white);
	background: var(--twh-wl-gold);
	border: 1px solid var(--twh-wl-gold);
}

.twh-wl-modal__btn--primary:hover,
.twh-wl-modal__btn--primary:focus {
	color: var(--twh-wl-white);
	background: var(--twh-wl-gold-c);
	border-color: var(--twh-wl-gold-c);
}

/* ==========================================================
 * 我的帳號 → 追蹤清單（會員中心為白底）
 * 前綴加上 .twh-wl-account 提高權重，避免被 Astra / Elementor 的
 * 全站 a、button、ul 樣式蓋掉
 * ========================================================== */
.twh-wl-account {
	--twh-wl-text: #292421;
	--twh-wl-muted: #8a7f74;
	--twh-wl-line: #ece4d6;      /* 淡金分隔線 */
	--twh-wl-paper: #fbf8f2;     /* 米白底 */
	color: var(--twh-wl-text);
}

/* ---------- 清單 ---------- */
.twh-wl-account .twh-wl-account__grid {
	display: flex;
	flex-direction: column;
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* 每一列：圖 / 資訊 / 按鈕 */
.twh-wl-account .twh-wl-account__item {
	display: grid;
	grid-template-columns: 120px minmax(0, 1fr) auto;
	gap: 24px;
	align-items: center;
	margin: 0;
	padding: 16px 24px 16px 16px;
	list-style: none;
	background: #ffffff;
	border: 1px solid var(--twh-wl-line);
	border-radius: 6px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.twh-wl-account .twh-wl-account__item::marker {
	content: none;
}

.twh-wl-account .twh-wl-account__item:hover {
	border-color: rgba(181, 138, 69, 0.6);
	box-shadow: 0 4px 16px rgba(41, 36, 33, 0.06);
}

/* 商品圖：正方形、細金框 */
.twh-wl-account .twh-wl-account__thumb {
	display: block;
	overflow: hidden;
	background: var(--twh-wl-paper);
	border: 1px solid rgba(181, 138, 69, 0.4);
	border-radius: 4px;
}

.twh-wl-account .twh-wl-account__thumb img {
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.twh-wl-account .twh-wl-account__item:hover .twh-wl-account__thumb img {
	transform: scale(1.04);
}

/* 資訊 */
.twh-wl-account .twh-wl-account__info {
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-width: 0;
}

/* 名稱最多兩行，超過用 … */
.twh-wl-account .twh-wl-account__name {
	display: -webkit-box;
	overflow: hidden;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.6;
	color: var(--twh-wl-text);
	text-decoration: none;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.twh-wl-account .twh-wl-account__name:hover,
.twh-wl-account .twh-wl-account__name:focus {
	color: var(--twh-wl-gold);
}

.twh-wl-account .twh-wl-account__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	align-items: center;
}

.twh-wl-account .twh-wl-account__price {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--twh-wl-red);
}

.twh-wl-account .twh-wl-account__price del {
	margin-right: 6px;
	font-size: 14px;
	font-weight: 400;
	color: var(--twh-wl-muted);
}

.twh-wl-account .twh-wl-account__price ins {
	text-decoration: none;
}

/* 庫存標籤 */
.twh-wl-account .twh-wl-account__stock {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 2px 10px;
	font-size: 13px;
	line-height: 1.6;
	color: var(--twh-wl-green);
	background: rgba(91, 104, 79, 0.1);
	border-radius: 999px;
}

.twh-wl-account .twh-wl-account__stock::before {
	content: "";
	width: 6px;
	height: 6px;
	background: currentColor;
	border-radius: 50%;
}

.twh-wl-account .twh-wl-account__stock.is-out {
	color: var(--twh-wl-red);
	background: rgba(124, 47, 41, 0.08);
}

/* 按鈕 */
.twh-wl-account .twh-wl-account__actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 132px;
}

.twh-wl-account .twh-wl-account__view,
.twh-wl-account .twh-wl-account__remove {
	box-sizing: border-box;
	display: inline-flex;
	gap: 6px;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 40px;
	margin: 0;
	padding: 0 16px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.05em;
	text-decoration: none;
	border-radius: 4px;
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* 查看商品：古銅金實心 */
.twh-wl-account .twh-wl-account__view,
.twh-wl-account .twh-wl-account__view:visited {
	color: #ffffff;
	background: var(--twh-wl-gold);
	border: 1px solid var(--twh-wl-gold);
}

.twh-wl-account .twh-wl-account__view:hover,
.twh-wl-account .twh-wl-account__view:focus {
	color: #ffffff;
	background: var(--twh-wl-gold-c);
	border-color: var(--twh-wl-gold-c);
}

/* 移除：淡色線框，hover 轉朱紅 */
.twh-wl-account .twh-wl-account__remove {
	color: var(--twh-wl-muted);
	background: transparent;
	border: 1px solid var(--twh-wl-line);
}

.twh-wl-account .twh-wl-account__remove:hover,
.twh-wl-account .twh-wl-account__remove:focus {
	color: var(--twh-wl-red);
	background: rgba(124, 47, 41, 0.05);
	border-color: rgba(124, 47, 41, 0.4);
}

.twh-wl-account .twh-wl-account__remove:disabled {
	opacity: 0.4;
	cursor: wait;
}

.twh-wl-account .twh-wl-account__view:focus-visible,
.twh-wl-account .twh-wl-account__remove:focus-visible,
.twh-wl-account .twh-wl-account__name:focus-visible {
	outline: 2px solid var(--twh-wl-gold-b);
	outline-offset: 2px;
}

/* ---------- 空狀態 ---------- */
.twh-wl-account .twh-wl-account__empty[hidden] {
	display: none;
}

.twh-wl-account .twh-wl-account__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 56px 24px;
	text-align: center;
	background: var(--twh-wl-paper);
	border: 1px dashed rgba(181, 138, 69, 0.5);
	border-radius: 6px;
}

.twh-wl-account .twh-wl-account__empty-icon {
	margin-bottom: 16px;
	color: var(--twh-wl-gold);
}

.twh-wl-account .twh-wl-account__empty-text {
	margin: 0 0 8px;
	font-size: 18px;
	font-weight: 700;
	color: var(--twh-wl-text);
}

.twh-wl-account .twh-wl-account__empty-desc {
	margin: 0 0 24px;
	font-size: 14px;
	line-height: 1.7;
	color: var(--twh-wl-muted);
}

.twh-wl-account .twh-wl-account__empty-btn,
.twh-wl-account .twh-wl-account__empty-btn:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 44px;
	padding: 0 32px;
	font-size: 15px;
	font-weight: 700;
	color: #ffffff;
	text-decoration: none;
	background: var(--twh-wl-gold);
	border-radius: 4px;
	transition: background-color 0.2s ease;
}

.twh-wl-account .twh-wl-account__empty-btn:hover,
.twh-wl-account .twh-wl-account__empty-btn:focus {
	color: #ffffff;
	background: var(--twh-wl-gold-c);
}

/* ---------- RWD ---------- */
@media (max-width: 768px) {
	.twh-wl-btn--icon {
		top: 10px !important;
		right: 10px !important;
	}

	.twh-wl-modal__dialog {
		padding: 44px 20px 24px;
	}

	.twh-wl-modal__actions {
		flex-direction: column-reverse;
	}

	/* 手機：左圖右資訊，按鈕在下方並排 */
	.twh-wl-account .twh-wl-account__item {
		grid-template-columns: 88px minmax(0, 1fr);
		gap: 12px 16px;
		padding: 12px;
	}

	.twh-wl-account .twh-wl-account__name {
		font-size: 15px;
	}

	.twh-wl-account .twh-wl-account__price {
		font-size: 16px;
	}

	.twh-wl-account .twh-wl-account__actions {
		flex-direction: row;
		grid-column: 1 / -1;
		min-width: 0;
	}

	.twh-wl-account .twh-wl-account__view,
	.twh-wl-account .twh-wl-account__remove {
		flex: 1;
	}
}
