/* =============================================================
   Product Detail Widget
   ============================================================= */

.pdw-wrapper {
	width: 100%;
	box-sizing: border-box;
}

/* ── 两列布局 ───────────────────────────────────────── */
.pdw-layout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 60px;
	align-items: start;
}

/* ── 左：画廊 ───────────────────────────────────────── */
.pdw-gallery {
	min-width: 0;
}

.pdw-main-image {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	background-color: #f5f5f5;
	overflow: hidden;
	margin-bottom: 12px;
}

.pdw-main-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: opacity 0.2s ease;
}

.pdw-main-img.pdw-fade {
	opacity: 0;
}

.pdw-img-placeholder {
	width: 100%;
	height: 100%;
	background-color: #eeeeee;
}

.pdw-thumbnails {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 8px;
}

.pdw-thumb {
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background-color: #f5f5f5;
	cursor: pointer;
	border: 2px solid transparent;
	transition: border-color 0.15s ease;
}

.pdw-thumb:hover {
	border-color: #c4c4c4;
}

.pdw-thumb.pdw-active {
	border-color: #1d1d1f;
}

.pdw-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ── 右：信息 ───────────────────────────────────────── */
.pdw-info {
	min-width: 0;
}

.pdw-title {
	margin: 0 0 16px;
	font-size: 26px;
	font-weight: 500;
	line-height: 1.3;
	color: #1d1d1f;
}

.pdw-price {
	font-size: 18px;
	color: #1d1d1f;
	margin-bottom: 28px;
	display: flex;
	align-items: baseline;
	gap: 6px;
	flex-wrap: wrap;
}

.pdw-price .woocommerce-Price-amount {
	color: inherit;
	font-weight: 500;
}

.pdw-price del {
	color: #999;
	font-size: 0.9em;
	margin-right: 4px;
}

.pdw-price ins {
	text-decoration: none;
}

.pdw-currency {
	font-size: 0.95em;
	color: inherit;
}

.pdw-section {
	margin-bottom: 22px;
}

.pdw-label {
	display: block;
	font-size: 13px;
	color: #1d1d1f;
	margin-bottom: 10px;
	letter-spacing: 0.2px;
}

/* ── 变体属性按钮样式 ─────────────────── */
.pdw-attr-options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.pdw-attr-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 48px;
	height: 36px;
	padding: 0 16px;
	font-size: 13px;
	color: #1d1d1f;
	background-color: #ffffff;
	border: 1px solid #d4d4d4;
	border-radius: 24px;
	cursor: pointer;
	user-select: none;
	transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.pdw-attr-btn:hover {
	border-color: #1d1d1f;
}

.pdw-attr-btn:focus-visible {
	outline: 2px solid #1d1d1f;
	outline-offset: 2px;
}

.pdw-attr-btn.pdw-selected {
	background-color: #1d1d1f;
	color: #ffffff;
	border-color: #1d1d1f;
}

.pdw-attr-btn.pdw-disabled {
	opacity: 0.35;
	cursor: not-allowed;
	pointer-events: none;
}

/* ── 数量 ──────────────────────────────────────────── */
.pdw-qty {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid #d4d4d4;
	border-radius: 4px;
	overflow: hidden;
	height: 40px;
}

.pdw-qty-btn {
	background: transparent;
	border: none;
	padding: 0 14px;
	font-size: 16px;
	color: #1d1d1f;
	cursor: pointer;
	line-height: 1;
	box-shadow: none !important;
}

.pdw-qty-btn:hover,
.pdw-qty-btn:focus {
	background-color: #f5f5f5;
	outline: none;
}

.pdw-qty-input {
	width: 56px;
	height: 100%;
	border: none;
	border-left: 1px solid #d4d4d4;
	border-right: 1px solid #d4d4d4;
	border-radius: 0;
	padding: 0;
	text-align: center;
	font-size: 14px;
	color: #1d1d1f;
	background: transparent;
	-moz-appearance: textfield;
	appearance: textfield;
	box-shadow: none !important;
}

.pdw-qty-input:focus {
	outline: none;
	box-shadow: none;
}

.pdw-qty-input::-webkit-outer-spin-button,
.pdw-qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* ── 操作按钮 ──────────────────────────────────────── */
.pdw-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 28px;
}

.pdw-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 50px;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.3px;
	cursor: pointer;
	user-select: none;
	border: 1px solid #1d1d1f;
	border-radius: 2px;
	transition: opacity 0.15s ease, transform 0.05s ease;
}

.pdw-btn:hover {
	opacity: 0.85;
}

.pdw-btn:active {
	transform: translateY(1px);
}

.pdw-btn.pdw-add-to-cart {
	background-color: #ffffff;
	color: #1d1d1f;
}

.pdw-btn.pdw-buy-now {
	background-color: #1d1d1f;
	color: #ffffff;
}

.pdw-btn.pdw-loading {
	opacity: 0.65;
	pointer-events: none;
	cursor: wait;
}

.pdw-btn.pdw-success {
	background-color: #10b981 !important;
	color: #ffffff !important;
	border-color: #10b981 !important;
	pointer-events: none;
}

.pdw-btn.pdw-error {
	background-color: #dc2626 !important;
	color: #ffffff !important;
	border-color: #dc2626 !important;
	pointer-events: none;
}

/* ── 响应式 ───────────────────────────────────────── */
@media (max-width: 1024px) {
	.pdw-layout {
		gap: 40px;
	}
	.pdw-thumbnails {
		grid-template-columns: repeat(5, 1fr);
	}
}

@media (max-width: 768px) {
	.pdw-layout {
		grid-template-columns: 1fr;
		gap: 24px;
	}
	.pdw-thumbnails {
		grid-template-columns: repeat(6, 1fr);
		gap: 6px;
	}
	.pdw-title {
		font-size: 20px;
	}
	.pdw-price {
		font-size: 16px;
		margin-bottom: 20px;
	}
	.pdw-btn {
		height: 46px;
	}
}

@media (max-width: 480px) {
	.pdw-thumbnails {
		grid-template-columns: repeat(5, 1fr);
	}
}

/* =============================================================
   加入购物车成功后的下拉弹窗（顶部下滑）
   ============================================================= */
.pdw-cart-popup {
	position: fixed;
	top: 0;
	right: 0;
	left: auto;
	width: 100%;
	max-width: 440px;
	z-index: 99999;
	transform: translateY(-12px);
	opacity: 0;
	visibility: hidden;
	transition: transform 0.3s ease, opacity 0.25s ease, visibility 0s linear 0.25s;
	pointer-events: none;
	box-sizing: border-box;
	padding: 0 16px;
}

.pdw-cart-popup.pdw-open {
	transform: translateY(0);
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
	            opacity 0.25s ease,
	            visibility 0s linear 0s;
}

.pdw-cart-popup-inner {
	background-color: #ffffff;
	border: 1px solid #ececec;
	box-shadow: 0 14px 38px rgba(0, 0, 0, 0.12);
	padding: 20px 24px 22px;
	margin-top: 0;
	border-radius: 2px;
	font-family: inherit;
}

/* 头部 */
.pdw-cart-popup-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 18px;
}

.pdw-cart-popup-title {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 500;
	color: #1d1d1f;
	letter-spacing: 0.2px;
}

.pdw-cart-popup-check {
	flex-shrink: 0;
	color: #1d1d1f;
}

.pdw-cart-popup-close {
	background: transparent;
	border: 0;
	padding: 4px;
	margin: -4px;
	cursor: pointer;
	color: #1d1d1f;
	line-height: 0;
	border-radius: 2px;
	transition: opacity 0.15s ease, background-color 0.15s ease;
}

.pdw-cart-popup-close:hover {
	opacity: 0.7;
}

.pdw-cart-popup-close:focus-visible {
	outline: 2px solid #1d1d1f;
	outline-offset: 2px;
}

/* 商品行 */
.pdw-cart-popup-product {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	margin-bottom: 22px;
}

.pdw-cart-popup-thumb-wrap {
	flex-shrink: 0;
	width: 64px;
	height: 80px;
	background-color: #f5f5f5;
	overflow: hidden;
}

.pdw-cart-popup-thumb {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pdw-cart-popup-info {
	flex: 1;
	min-width: 0;
	padding-top: 2px;
}

.pdw-cart-popup-name {
	margin: 0 0 4px;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.4;
	color: #1d1d1f;
	word-break: break-word;
}

.pdw-cart-popup-meta-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.pdw-cart-popup-meta {
	font-size: 13px;
	line-height: 1.5;
	color: #6b6b6b;
}

/* 操作按钮 */
.pdw-cart-popup-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.pdw-cart-popup-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 46px;
	font-size: 14px;
	font-weight: 400;
	letter-spacing: 0.2px;
	cursor: pointer;
	user-select: none;
	border: 1px solid #1d1d1f;
	border-radius: 2px;
	text-decoration: none !important;
	box-sizing: border-box;
	transition: opacity 0.15s ease;
}

.pdw-cart-popup-btn:hover,
.pdw-cart-popup-btn:focus,
.pdw-cart-popup-btn:visited {
	text-decoration: none !important;
}

.pdw-cart-popup-btn:hover {
	opacity: 0.85;
}

.pdw-cart-popup-btn-cart {
	background-color: #ffffff;
	color: #1d1d1f !important;
}

.pdw-cart-popup-btn-checkout {
	background-color: #1d1d1f;
	color: #ffffff !important;
}

.pdw-cart-popup-continue {
	background: transparent;
	border: 0;
	padding: 8px 4px 0;
	font-size: 13px;
	color: #1d1d1f;
	text-align: center;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
	font-family: inherit;
}

.pdw-cart-popup-continue:hover {
	opacity: 0.7;
}

/* 移动端：占满宽度 */
@media (max-width: 480px) {
	.pdw-cart-popup {
		max-width: 100%;
		padding: 0;
	}
	.pdw-cart-popup-inner {
		padding: 16px 18px 20px;
		border-left: 0;
		border-right: 0;
		border-radius: 0;
	}
}
