/* =====================================================================
   RichUps — Cart Drawer Styles (v3 — รวม toast + wishlist state)
===================================================================== */

/* ─── 1. Cart icon badge (on navbar) ──────────────────────────── */
.rp-cart-icon-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.rp-cart-badge {
	position: absolute;
	top: -6px;
	right: -8px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	background: #c25a3e;
	color: #fff;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	opacity: 0;
	transform: scale(0.6);
	transition: opacity .2s ease, transform .25s cubic-bezier(.34,1.56,.64,1);
	pointer-events: none;
	font-family: 'Segoe UI', system-ui, sans-serif;
}
.rp-cart-badge.is-visible {
	opacity: 1;
	transform: scale(1);
}
.rp-cart-badge.is-bumping {
	animation: rp-badge-bump .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes rp-badge-bump {
	0%   { transform: scale(1); }
	50%  { transform: scale(1.4); }
	100% { transform: scale(1); }
}


/* ─── 2. Backdrop ──────────────────────────────────────────────── */
.rp-drawer-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(15, 25, 19, 0.45);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	z-index: 9998;
	opacity: 0;
	visibility: hidden;
	transition: opacity .3s ease, visibility .3s;
}
.rp-drawer-backdrop.is-open {
	opacity: 1;
	visibility: visible;
}


/* ─── 3. Drawer container ──────────────────────────────────────── */
.rp-drawer {
	position: fixed;
	top: 0;
	right: 0;
	height: 100vh;
	width: 440px;
	max-width: 92vw;
	background: #fff;
	box-shadow: -20px 0 50px rgba(15, 25, 19, 0.15);
	z-index: 9999;
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform .35s cubic-bezier(.2,.7,.2,1);
	font-family: inherit;
}
.rp-drawer.is-open {
	transform: translateX(0);
}


/* ─── 4. Drawer header ─────────────────────────────────────────── */
.rp-drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 22px 24px;
	border-bottom: 1px solid var(--rp-line);
	flex-shrink: 0;
	background: var(--rp-green-50);
}
.rp-drawer-title {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 18px;
	font-weight: 700;
	color: var(--rp-ink);
	margin: 0;
}
.rp-drawer-title svg {
	color: var(--rp-green-700);
}
.rp-drawer-close {
	width: 38px;
	height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: #fff;
	color: var(--rp-mute);
	border-radius: 50%;
	cursor: pointer;
	transition: all .2s;
}
.rp-drawer-close:hover {
	background: var(--rp-ink);
	color: #fff;
	transform: rotate(90deg);
}


/* ─── 5. Drawer body (scrollable) ──────────────────────────────── */
.rp-drawer-body {
	flex: 1;
	overflow-y: auto;
	padding: 20px 24px;
	scrollbar-width: thin;
	scrollbar-color: var(--rp-green-300) transparent;
}
.rp-drawer-body::-webkit-scrollbar { width: 6px; }
.rp-drawer-body::-webkit-scrollbar-track { background: transparent; }
.rp-drawer-body::-webkit-scrollbar-thumb {
	background: var(--rp-green-300);
	border-radius: 3px;
}


/* ─── 6. Loading state ─────────────────────────────────────────── */
.rp-drawer-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 0;
}
.rp-drawer-loading::before {
	content: '';
	width: 36px;
	height: 36px;
	border: 3px solid var(--rp-green-100);
	border-top-color: var(--rp-green-700);
	border-radius: 50%;
	animation: rp-spin 0.7s linear infinite;
}
@keyframes rp-spin { to { transform: rotate(360deg); } }


/* ─── 7. Empty state ───────────────────────────────────────────── */
.rp-drawer-empty {
	text-align: center;
	padding: 60px 24px;
	color: var(--rp-mute);
}
.rp-drawer-empty-ic {
	margin: 0 auto 18px;
	width: 80px;
	height: 80px;
	background: var(--rp-green-50);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--rp-green-700);
}
.rp-drawer-empty h4 {
	color: var(--rp-ink);
	font-size: 17px;
	margin: 0 0 6px;
	font-weight: 600;
}
.rp-drawer-empty p {
	margin: 0 0 22px;
	font-size: 14px;
}
.rp-drawer-empty-btn {
	display: inline-block;
	background: var(--rp-green-700);
	color: #fff;
	padding: 11px 26px;
	border-radius: 10px;
	text-decoration: none;
	font-weight: 600;
	font-size: 14px;
	transition: background .2s;
}
.rp-drawer-empty-btn:hover {
	background: var(--rp-green-900);
	color: #fff;
}


/* ─── 8. Cart item card ────────────────────────────────────────── */
.rp-drawer-items {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.rp-drawer-item {
	display: grid;
	grid-template-columns: 80px 1fr;
	gap: 14px;
	padding: 14px;
	background: var(--rp-cream);
	border-radius: 12px;
	position: relative;
	animation: rp-drawer-item-in .25s ease both;
}
@keyframes rp-drawer-item-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}
.rp-drawer-item.is-removing {
	opacity: 0;
	transform: translateX(60px);
	transition: opacity .25s, transform .3s;
	pointer-events: none;
}

.rp-drawer-item-img {
	width: 80px;
	height: 80px;
	border-radius: 8px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
}
.rp-drawer-item-img.cat-decorations        { background: linear-gradient(135deg, #e8f0e3, #c9dccb); }
.rp-drawer-item-img.cat-clothes            { background: linear-gradient(135deg, #efe7d8, #d5c4a3); }
.rp-drawer-item-img.cat-food               { background: linear-gradient(135deg, #f0ead8, #d8d3a3); }
.rp-drawer-item-img.cat-health-and-beauty  { background: linear-gradient(135deg, #e7eee4, #b8d1be); }
.rp-drawer-item-img.cat-bath-and-body-care { background: linear-gradient(135deg, #e3eef0, #a8c8d2); }

.rp-drawer-item-img img {
	width: 100%; height: 100%; object-fit: cover;
}
.rp-drawer-item-img-svg {
	width: 40%; height: 40%;
	color: var(--rp-green-700);
	opacity: 0.55;
}
.rp-drawer-item-img-svg svg { width: 100%; height: 100%; }

.rp-drawer-item-body {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	min-width: 0;
}

.rp-drawer-item-name {
	font-size: 14px;
	font-weight: 600;
	color: var(--rp-ink);
	line-height: 1.4;
	margin: 0 0 4px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	padding-right: 28px;
}
.rp-drawer-item-name a {
	color: inherit;
	text-decoration: none;
}
.rp-drawer-item-name a:hover {
	color: var(--rp-green-700);
}

.rp-drawer-item-price {
	font-size: 13px;
	color: var(--rp-mute);
}

.rp-drawer-item-bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 8px;
	gap: 12px;
}

.rp-drawer-qty {
	display: inline-flex;
	align-items: center;
	background: #fff;
	border: 1px solid var(--rp-line);
	border-radius: 8px;
	overflow: hidden;
}
.rp-drawer-qty-btn {
	width: 28px;
	height: 28px;
	border: none;
	background: transparent;
	color: var(--rp-green-700);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.rp-drawer-qty-btn:hover:not(:disabled) {
	background: var(--rp-green-50);
}
.rp-drawer-qty-btn:disabled {
	opacity: .4;
	cursor: not-allowed;
}
.rp-drawer-qty-val {
	min-width: 28px;
	text-align: center;
	font-weight: 600;
	color: var(--rp-ink);
	font-size: 14px;
	user-select: none;
}

.rp-drawer-item-subtotal {
	font-weight: 700;
	color: var(--rp-green-700);
	font-size: 15px;
}

.rp-drawer-item-remove {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 24px;
	height: 24px;
	border: none;
	background: transparent;
	color: var(--rp-mute);
	cursor: pointer;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all .15s;
}
.rp-drawer-item-remove:hover {
	background: #c25a3e;
	color: #fff;
}


/* ─── 9. Drawer footer ─────────────────────────────────────────── */
.rp-drawer-foot {
	padding: 20px 24px 24px;
	background: #fff;
	border-top: 1px solid var(--rp-line);
	flex-shrink: 0;
	box-shadow: 0 -8px 20px rgba(0,0,0,0.04);
}

.rp-drawer-total-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin-bottom: 8px;
	font-size: 14px;
	color: var(--rp-mute);
}
.rp-drawer-total-row.rp-drawer-total-final {
	font-size: 16px;
	color: var(--rp-ink);
	font-weight: 600;
	padding-top: 10px;
	border-top: 1px dashed var(--rp-line);
	margin-top: 12px;
}
.rp-drawer-total-row.rp-drawer-total-final .rp-drawer-total-amount {
	font-size: 24px;
	font-weight: 700;
	color: var(--rp-green-700);
}

.rp-drawer-checkout {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	margin-top: 18px;
	padding: 16px 24px;
	background: var(--rp-green-700);
	color: #fff;
	border: none;
	border-radius: 12px;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none;
	transition: all .2s;
	font-family: inherit;
}
.rp-drawer-checkout:hover {
	background: var(--rp-green-900);
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 10px 24px rgba(58, 120, 71, 0.3);
}

.rp-drawer-continue {
	display: block;
	text-align: center;
	margin-top: 10px;
	color: var(--rp-mute);
	font-size: 13px;
	text-decoration: none;
	cursor: pointer;
	background: none;
	border: none;
	width: 100%;
	padding: 6px;
	font-family: inherit;
	transition: color .2s;
}
.rp-drawer-continue:hover {
	color: var(--rp-green-700);
}


/* ─── 10. Lock body scroll when drawer open ────────────────────── */
body.rp-drawer-locked {
	overflow: hidden;
}


/* ─── 11. Mobile adjustments ───────────────────────────────────── */
@media (max-width: 480px) {
	.rp-drawer { width: 100vw; max-width: 100vw; }
	.rp-drawer-head { padding: 18px 18px; }
	.rp-drawer-body { padding: 16px 18px; }
	.rp-drawer-foot { padding: 16px 18px 20px; }
	.rp-drawer-item { grid-template-columns: 70px 1fr; padding: 12px; gap: 12px; }
	.rp-drawer-item-img { width: 70px; height: 70px; }
}


/* =====================================================================
   12. Toast Notification (Global — โหลดทุกหน้า)
===================================================================== */
.rp-toast {
	position: fixed;
	bottom: 28px;
	right: 28px;
	z-index: 9999;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 22px;
	background: var(--rp-green-700, #2c5a36);
	color: #fff;
	border-radius: 12px;
	font-size: 14.5px;
	font-weight: 600;
	box-shadow: 0 12px 30px rgba(0,0,0,0.2);
	opacity: 0;
	visibility: hidden;
	transform: translateY(20px);
	transition: opacity .25s, transform .3s cubic-bezier(.2,.7,.2,1), visibility .3s;
	max-width: 90vw;
}
.rp-toast.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}
.rp-toast.is-error { background: #c25a3e; }
.rp-toast svg { flex-shrink: 0; }

@media (max-width: 640px) {
	.rp-toast {
		left: 20px; right: 20px; bottom: 20px;
		justify-content: center;
	}
}


/* =====================================================================
   13. Wishlist heart "favored" state
===================================================================== */
.rp-act-btn.is-favored {
	background: #c25a3e !important;
	color: #fff !important;
}
.rp-act-btn.is-favored svg {
	fill: rgba(255, 255, 255, 0.3);
}


/* =====================================================================
   14. Add-to-cart loading state
===================================================================== */
.rp-add-to-cart.is-loading,
.rp-card-cart.is-loading {
	opacity: 0.7;
	pointer-events: none;
}


/* =====================================================================
   15. ซ่อนปุ่ม "เปรียบเทียบ" (ปุ่มที่ 3 ใน .rp-card-actions)
   — feature นี้ยังไม่ implement จึงซ่อนไว้
===================================================================== */
.rp-card-actions .rp-act-btn:nth-child(3) {
	display: none !important;
}
