:root {
	--mw-bg: #F5F5F5;
	--mw-card: #ffffff;
	--mw-text: #1B1B1F;
	--mw-muted: #71717A;
	--mw-line: #DEDEE0;
	--mw-primary: #1DC3E3;
	--mw-danger: #FF5F5F;
	--mw-ok-bg: #F4FDE6;
	--mw-radius: 16px;
}

body.woocommerce-cart { background: var(--mw-bg); }

.mw-cart {
	transition: opacity .15s;
}
.mw-cart.is-busy { opacity: .55; pointer-events: none; }
.mw-cart * { box-sizing: border-box; }
.mw-loading { text-align: center; padding: 80px 0; color: var(--mw-muted) !important; }
.mw-error { text-align: center; color: var(--mw-danger) !important; padding: 60px 0; }

/* หัวหน้า */
.mw-back {
	display: inline-flex; align-items: center; gap: 4px;
	padding: 8px 16px 5px 12px;
	border: 1px solid var(--mw-line); border-radius: 999px;
	color: var(--mw-text) !important; font-weight: 400 !important; text-decoration: none;
}
.mw-back:hover { background: var(--mw-line); }
.mw-title { margin: 24px 0 40px; }

/* โครงสองคอลัมน์ */
.mw-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
	gap: 40px; align-items: start;
}
.mw-main { display: grid; gap: 24px; }
.mw-side { position: sticky; top: 24px; }
.mw-card {
	background: var(--mw-card);
	border: 1px solid var(--mw-line);
	border-radius: var(--mw-radius);
}

/* แถวสินค้า */
.mw-item {
	display: grid; grid-template-columns: 80px minmax(0, 1fr) auto;
	gap: 16px; padding: 16px; align-items: center;
}
.mw-item + .mw-item { border-top: 1px solid var(--mw-line); }
.mw-thumb { width: 80px; height: 80px; border-radius: 12px !important; object-fit: cover; background: #eee; display: block; }
.mw-name { font-weight: 600; margin-bottom: 12px; color: var(--mw-text) !important; }
.mw-category { color: var(--mw-muted) !important; }
.mw-info .mw-pill { margin-top: 12px; }
.mw-price { text-align: right; white-space: nowrap; }
.mw-price strong { display: block; color: var(--mw-text) !important; margin-bottom: 4px; }
.mw-price s { display: block; color: var(--mw-muted) !important; font-weight: 400 !important; }

/* ปุ่มเม็ดเล็ก (ลบ / เอาออก) */
.mw-pill {
	border: 1px solid var(--mw-line) !important; background: #fff; color: var(--mw-muted) !important;
	border-radius: 999px !important; padding: 8px 16px !important; cursor: pointer; font-weight: 400 !important;
} 
.mw-pill:hover, .mw-pill:focus { color: #fff !important; border-color: var(--mw-danger) !important; background: var(--mw-danger) !important; }
.mw-pill-sm { padding: 1px 12px; font-size: 12px; }

/* โค้ดส่วนลด */
.mw-coupon { padding: 24px; }
.mw-label { display: block; font-weight: 600; margin-bottom: 16px; }
.mw-coupon-row { display: flex; gap: 16px; }
.mw-input {
	flex: 1; min-width: 0; padding: 12px 16px; font-weight: 400 !important; line-height: 1.4 !important; color: var(--mw-text) !important;
	border: 1px solid var(--mw-line) !important; border-radius: 12px !important; background: #fff;
}
.mw-input:focus { outline: none; border-color: var(--mw-primary); box-shadow: 0 0 0 3px rgba(92,192,224,.18); }
.mw-input.is-error { border-color: var(--mw-danger) !important; }
.mw-msg-error { color: var(--mw-danger) !important; margin-top: 12px; font-weight: 400 !important; }
.mw-btn-outline {
	border: 1px solid var(--mw-primary) !important; color: var(--mw-primary) !important; background: transparent;
	border-radius: 999px !important; padding: 16px 24px; font-weight: 600;
	font-family: inherit; cursor: pointer;
}
.mw-btn-outline:hover, .mw-btn-outline:focus { background: var(--mw-primary) !important; color: #fff !important; }
.mw-notice-ok {
	display: flex; align-items: center; gap: 8px;
	background: var(--mw-ok-bg); border-radius: 12px; padding: 18px 20px; font-weight: 500 !important;
}
.mw-notice-ok span { line-height: 1.4; }

/* สรุปยอด */
.mw-summary { padding: 24px; }
.mw-sum-head { margin-bottom: 16px; font-weight: 500 !important; }
.mw-sum-head span { color: var(--mw-muted); font-weight: 400; }
.mw-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; color: var(--mw-muted) !important; font-weight: 400 !important; }
.mw-coupon-side { display: inline-flex; align-items: center; gap: 8px; }
.mw-discount { color: var(--mw-danger); }
.mw-hr { border: 0; border-top: 1px solid var(--mw-line); margin: 12px 0 !important; }
.mw-total { color: var(--mw-text) !important; font-weight: 600; margin-top: 16px; }
.mw-btn-primary {
	display: block; width: 100%; text-align: center !important; text-decoration: none;
	background: var(--mw-primary); color: #fff !important; font-weight: 600;
	border-radius: 999px; padding: 16px 24px; margin-top: 16px;
}
.mw-btn-primary:hover { filter: brightness(.96); color: #fff; }
.mw-secure {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	font-weight: 400 !important; color: var(--mw-muted) !important; margin: 16px 0 0;
}
.mw-secure svg { color: var(--mw-primary); flex-shrink: 0; }

/* ตะกร้าว่าง */
.mw-empty { text-align: center !important; padding: 56px 0; }
.mw-empty p { text-align: center !important; font-weight: 600; margin: 16px 0 24px; }
.mw-btn-inline { display: inline-block; width: auto; margin-top: 0; padding: 16px 32px; border-radius: 999px; }

/* มือถือ */
@media (max-width: 820px) {
	.mw-grid { grid-template-columns: 1fr; }
	.mw-side { position: static; }
	.mw-item { grid-template-columns: 64px minmax(0, 1fr); }
	.mw-thumb { width: 64px; height: 64px; }
	.mw-price { grid-column: 2; text-align: left; display: flex; gap: 8px; align-items: baseline; }
	.mw-price strong, .mw-price s { display: inline; }
}

/* ==========================================
   Header Cart Badge & Global Buttons
   ========================================== */

/* ปรับ Container ปุ่มตะกร้าที่ Header */
.mw-header-cart {
	position: relative !important;
}

/* ตัวเลข Badge สีแดง */
.mw-cart-badge {
	position: absolute;
	top: -8px;
	right: -8px;
	background: var(--mw-danger);
	color: #ffffff !important;
	min-width: 24px;
	height: 24px;
	padding: 0 4px;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	animation: mwBadgePop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes mwBadgePop {
	0% { transform: scale(0.5); opacity: 0; }
	100% { transform: scale(1); opacity: 1; }
}

/* ปุ่มที่ถูกเพิ่มเข้าตะกร้าแล้ว (สามารถคลิกซ้ำเพื่อเอาออกได้) */
.mw-add-to-cart-btn.is-added,
.mw-add-to-cart-btn.is-busy {
	background: #E4F5FF !important;
	color: #0085cd !important;
	border: 1px #c3e3f6 solid;
	font-weight: 500 !important;
	transition: all 0.2s ease;
}

.mw-add-to-cart-btn.is-added:hover {
	background: #d4efff !important;
}