/* =====================================================================
   RichUps — Products Page Styles
   Load ผ่าน head.php เมื่อ $current_page === 'products'
===================================================================== */

:root {
	--rp-green-900: #1d3a23;
	--rp-green-800: #244a2c;
	--rp-green-700: #2c5a36;
	--rp-green-600: #3a7847;
	--rp-green-500: #4a8f57;
	--rp-green-400: #6ba572;
	--rp-green-300: #9bc4a0;
	--rp-green-100: #e7f1e9;
	--rp-green-50:  #f3f8f4;
	--rp-earth:     #b08a5c;
	--rp-earth-soft:#d9b88a;
	--rp-cream:     #faf7f1;
	--rp-ink:       #1f2b22;
	--rp-mute:      #6c7c70;
	--rp-line:      #dde6df;
	--rp-shadow:    0 6px 24px rgba(29, 58, 35, 0.07);
	--rp-shadow-lg: 0 18px 50px rgba(29, 58, 35, 0.14);
}

/* ─── 1. PAGE BANNER ─────────────────────────────────── */
.rp-banner {
	position: relative;
	padding: 90px 0 110px;
	background: linear-gradient(135deg, var(--rp-green-700) 0%, var(--rp-green-900) 60%, #0f2517 100%);
	color: #fff;
	overflow: hidden;
}
.rp-banner::before {
	content: '';
	position: absolute; inset: 0;
	background-image:
		radial-gradient(circle at 20% 30%, rgba(155, 196, 160, 0.18), transparent 40%),
		radial-gradient(circle at 80% 70%, rgba(176, 138, 92, 0.12), transparent 50%);
	pointer-events: none;
}
.rp-leaves { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.rp-leaf  { position: absolute; }
.rp-leaf-1 { width: 220px; top: -40px; right: -20px;  transform: rotate(35deg);  animation: rp-float 9s ease-in-out infinite; }
.rp-leaf-2 { width: 150px; bottom: -30px; left: 8%;   transform: rotate(-25deg); animation: rp-float 11s ease-in-out infinite -3s; }
.rp-leaf-3 { width: 100px; top: 40%; right: 12%;      transform: rotate(110deg); animation: rp-float 7s  ease-in-out infinite -1.5s; }
.rp-leaf-4 { width: 180px; top: 60%; left: -40px;     transform: rotate(-60deg); animation: rp-float 13s ease-in-out infinite -6s; }
@keyframes rp-float {
	0%,100% { transform: translateY(0)    rotate(var(--r, 0)); }
	50%     { transform: translateY(-18px) rotate(calc(var(--r, 0) + 4deg)); }
}
.rp-banner-inner {
	position: relative;
	text-align: center;
	max-width: 760px;
	margin: 0 auto;
}
.rp-banner-eyebrow {
	display: inline-flex; align-items: center; gap: 14px;
	font-size: 12px; letter-spacing: 4px; text-transform: uppercase;
	color: var(--rp-green-300); font-weight: 600;
	margin-bottom: 22px;
}
.rp-dot { width: 30px; height: 1px; background: var(--rp-green-300); }
.rp-banner-title {
	font-size: clamp(38px, 6vw, 68px);
	line-height: 1.08; font-weight: 700;
	margin: 0 0 18px;
	color: #fff;
	text-shadow: 0 2px 24px rgba(0,0,0,0.18);
}
.rp-banner-desc {
	font-size: 17px; line-height: 1.7;
	color: rgba(255,255,255,0.85);
	max-width: 580px; margin: 0 auto 30px;
}
.rp-breadcrumb {
	display: inline-flex; align-items: center; gap: 10px;
	list-style: none; padding: 8px 22px; margin: 0;
	background: rgba(255,255,255,0.08);
	border: 1px solid rgba(255,255,255,0.15);
	backdrop-filter: blur(8px);
	border-radius: 999px;
	font-size: 13px;
}
.rp-breadcrumb li         { color: rgba(255,255,255,0.7); }
.rp-breadcrumb li.sep     { color: rgba(255,255,255,0.35); font-weight: 300; }
.rp-breadcrumb li.current { color: #fff; font-weight: 600; }
.rp-breadcrumb a          { color: rgba(255,255,255,0.7); text-decoration: none; transition: color .2s; }
.rp-breadcrumb a:hover    { color: #fff; }

/* ─── 2. CATEGORY TABS ────────────────────────────────── */
.rp-cattabs-wrap {
	background: var(--rp-cream);
	padding: 28px 0;
	border-bottom: 1px solid var(--rp-line);
	position: relative;
	margin-top: -36px;
}
.rp-cattabs {
	display: flex; gap: 8px;
	padding: 12px;
	background: #fff;
	border-radius: 18px;
	box-shadow: var(--rp-shadow);
	overflow-x: auto;
	scrollbar-width: none;
}
.rp-cattabs::-webkit-scrollbar { display: none; }
.rp-cattab {
	display: inline-flex; align-items: center; gap: 10px;
	padding: 12px 20px;
	border-radius: 12px;
	color: var(--rp-ink);
	text-decoration: none;
	font-weight: 500;
	font-size: 14.5px;
	white-space: nowrap;
	flex-shrink: 0;
	transition: all .25s;
}
.rp-cattab:hover { background: var(--rp-green-50); color: var(--rp-green-700); }
.rp-cattab.is-active {
	background: linear-gradient(135deg, var(--rp-green-600), var(--rp-green-700));
	color: #fff;
	box-shadow: 0 6px 18px rgba(58, 120, 71, 0.32);
}
.rp-cattab-ic { width: 20px; height: 20px; display: inline-flex; }
.rp-cattab-ic svg { width: 100%; height: 100%; }

/* ─── 3. MAIN PRODUCTS SECTION ───────────────────────── */
.rp-section { padding: 64px 0 90px; background: var(--rp-cream); }

/* Toolbar */
.rp-toolbar {
	display: flex; align-items: center; justify-content: space-between;
	gap: 18px;
	padding: 18px 22px;
	background: #fff;
	border-radius: 14px;
	box-shadow: var(--rp-shadow);
	margin-bottom: 36px;
	flex-wrap: wrap;
}
.rp-result-count         { color: var(--rp-mute); font-size: 14.5px; }
.rp-result-count strong  { color: var(--rp-green-700); font-weight: 700; }
.rp-toolbar-right        { display: flex; align-items: center; gap: 18px; }
.rp-sort                 { display: flex; align-items: center; gap: 10px; }
.rp-sort label           { color: var(--rp-mute); font-size: 13.5px; font-weight: 500; }
.rp-sort select {
	border: 1px solid var(--rp-line);
	background: #fff;
	padding: 8px 32px 8px 14px;
	border-radius: 10px;
	font-size: 14px; color: var(--rp-ink);
	cursor: pointer; appearance: none;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c7c70' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
	background-repeat: no-repeat;
	background-position: right 12px center;
}
.rp-sort select:focus { outline: none; border-color: var(--rp-green-500); }
.rp-view-toggle { display: flex; gap: 4px; padding: 4px; background: var(--rp-green-50); border-radius: 10px; }
.rp-vt-btn {
	width: 36px; height: 32px;
	border: none; background: transparent;
	display: inline-flex; align-items: center; justify-content: center;
	border-radius: 7px; cursor: pointer;
	color: var(--rp-mute); transition: all .2s;
	text-decoration: none;
}
.rp-vt-btn:hover          { color: var(--rp-green-700); }
.rp-vt-btn svg            { width: 16px; height: 16px; }
.rp-vt-btn.is-active      { background: #fff; color: var(--rp-green-700); box-shadow: 0 2px 6px rgba(0,0,0,0.06); }

/* ─── 4. PRODUCT GRID ────────────────────────────────── */
.rp-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 26px;
}
@media (max-width: 1100px) { .rp-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 820px)  { .rp-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; } }
@media (max-width: 480px)  { .rp-grid { grid-template-columns: 1fr; } }

/* Product card (base — used by both views) */
.rp-card {
	background: #fff;
	border-radius: 18px;
	overflow: hidden;
	box-shadow: var(--rp-shadow);
	display: flex; flex-direction: column;
	transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s;
	position: relative;
}
.rp-card:hover { transform: translateY(-6px); box-shadow: var(--rp-shadow-lg); }

/* Card media */
.rp-card-media {
	position: relative;
	aspect-ratio: 1 / 1;
	display: flex; align-items: center; justify-content: center;
	overflow: hidden;
}
.rp-card-media.cat-decorations         { background: linear-gradient(135deg, #e8f0e3, #c9dccb); }
.rp-card-media.cat-clothes             { background: linear-gradient(135deg, #efe7d8, #d5c4a3); }
.rp-card-media.cat-food                { background: linear-gradient(135deg, #f0ead8, #d8d3a3); }
.rp-card-media.cat-health-and-beauty   { background: linear-gradient(135deg, #e7eee4, #b8d1be); }
.rp-card-media.cat-bath-and-body-care  { background: linear-gradient(135deg, #e3eef0, #a8c8d2); }

.rp-card-media::before {
	content: '';
	position: absolute; inset: 0;
	background-image:
		radial-gradient(circle at 25% 25%, rgba(255,255,255,0.5) 0%, transparent 25%),
		radial-gradient(circle at 75% 75%, rgba(0,0,0,0.04) 0%, transparent 30%);
	pointer-events: none;
}

/* Real product image */
.rp-card-img {
	width: 100%; height: 100%;
	object-fit: cover;
	position: relative; z-index: 1;
	transition: transform .5s cubic-bezier(.2,.7,.2,1);
}
.rp-card:hover .rp-card-img { transform: scale(1.06); }

/* SVG icon fallback */
.rp-card-svg {
	width: 64px; height: 64px;
	color: var(--rp-green-700);
	opacity: 0.55;
	transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .3s;
	position: relative; z-index: 1;
}
.rp-card:hover .rp-card-svg { transform: scale(1.15) rotate(-6deg); opacity: 0.75; }
.rp-card-svg svg            { width: 100%; height: 100%; }

/* Badges (อยู่บน media — แสดงทั้ง 2 view) */
.rp-badge {
	position: absolute; top: 12px; left: 12px;
	font-size: 10.5px; font-weight: 700;
	padding: 5px 10px; border-radius: 999px;
	letter-spacing: .8px; text-transform: uppercase;
	display: inline-flex; align-items: center; gap: 4px;
	z-index: 2;
}
.rp-badge-hot  { background: var(--rp-green-700); color: #fff; }
.rp-badge-new  { background: var(--rp-earth); color: #fff; }
.rp-badge-low-stock {
	position: absolute; top: 12px; right: 12px;
	background: #c25a3e; color: #fff;
	font-size: 10.5px; font-weight: 700;
	padding: 5px 10px; border-radius: 999px;
	z-index: 2;
}

/* ─── 5. GRID VIEW — hover actions ON MEDIA ──────────── */

/* Hover icons (♡ 👁 ▭) — column on right of media */
.rp-card-actions {
	position: absolute; top: 50%; right: -50px;
	transform: translateY(-50%);
	display: flex; flex-direction: column; gap: 8px;
	transition: right .35s cubic-bezier(.2,.7,.2,1);
	z-index: 2;
}
.rp-card:hover .rp-card-actions { right: 12px; }
.rp-act-btn {
	width: 38px; height: 38px;
	border: none;
	background: #fff;
	border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
	cursor: pointer;
	color: var(--rp-green-700);
	box-shadow: 0 4px 12px rgba(0,0,0,0.12);
	transition: all .2s;
}
.rp-act-btn:hover { background: var(--rp-green-700); color: #fff; transform: scale(1.08); }
.rp-act-btn svg   { width: 16px; height: 16px; }

/* Add-to-cart slide-up (on media) */
.rp-card-cart {
	position: absolute;
	left: 12px; right: 12px; bottom: 12px;
	background: var(--rp-green-700);
	color: #fff;
	border: none;
	padding: 11px 14px;
	border-radius: 10px;
	font-weight: 600; font-size: 13.5px;
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	cursor: pointer;
	transform: translateY(calc(100% + 14px));
	opacity: 0;
	transition: all .35s cubic-bezier(.2,.7,.2,1);
	z-index: 2;
}
.rp-card:hover .rp-card-cart { transform: translateY(0); opacity: 1; }
.rp-card-cart:hover          { background: var(--rp-green-900); }

/* Card body */
.rp-card-body { padding: 18px 20px 22px; }
.rp-card-cat {
	display: inline-block;
	font-size: 11.5px; font-weight: 600;
	color: var(--rp-green-600);
	letter-spacing: 1.2px; text-transform: uppercase;
	margin-bottom: 8px;
}
.rp-card-title {
	font-size: 15.5px; font-weight: 600; line-height: 1.45;
	margin: 0 0 10px;
	color: var(--rp-ink);
	min-height: 44px;
	display: -webkit-box;
	-webkit-line-clamp: 2; -webkit-box-orient: vertical;
	overflow: hidden;
}
.rp-card-title a       { color: inherit; text-decoration: none; transition: color .2s; }
.rp-card-title a:hover { color: var(--rp-green-700); }
.rp-card-rating {
	display: flex; align-items: center; gap: 6px;
	margin-bottom: 12px;
	font-size: 13px;
	color: #e0b340;
}
.rp-card-rating .rp-rating-num { color: var(--rp-mute); font-size: 12px; margin-left: 4px; }
.rp-card-price { display: flex; align-items: baseline; gap: 10px; }
.rp-price-now  { color: var(--rp-green-700); font-size: 19px; font-weight: 700; }

/* ─── 6. LIST VIEW — แค่เปลี่ยน card เป็นแนวนอน ────── */

/* List view = card เป็น row: media | body (action buttons เหมือน grid view) */
.rp-grid.is-list                   { grid-template-columns: 1fr; gap: 16px; }
.rp-grid.is-list .rp-card          { flex-direction: row; align-items: stretch; }
.rp-grid.is-list .rp-card-media    { width: 260px; flex-shrink: 0; aspect-ratio: 1/1; }
.rp-grid.is-list .rp-card-body     {
	flex: 1;
	padding: 26px 30px;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.rp-grid.is-list .rp-card-title    { min-height: auto; }

/* Mobile: collapse to vertical */
@media (max-width: 640px) {
	.rp-grid.is-list .rp-card         { flex-direction: column; }
	.rp-grid.is-list .rp-card-media   { width: 100%; }
}

/* ─── 7. EMPTY STATE ─────────────────────────────────── */
.rp-empty {
	text-align: center;
	padding: 80px 24px;
	background: #fff;
	border-radius: 18px;
	box-shadow: var(--rp-shadow);
}
.rp-empty-ic        { font-size: 56px; margin-bottom: 14px; }
.rp-empty h3        { font-size: 22px; color: var(--rp-ink); margin: 0 0 8px; }
.rp-empty p         { color: var(--rp-mute); margin: 0 0 22px; }
.rp-empty-btn {
	display: inline-block;
	padding: 12px 28px;
	background: var(--rp-green-700);
	color: #fff;
	border-radius: 10px;
	text-decoration: none;
	font-weight: 600;
	transition: background .2s;
}
.rp-empty-btn:hover { background: var(--rp-green-900); color: #fff; }

/* ─── 8. PAGINATION ──────────────────────────────────── */
.rp-pagination {
	display: flex; justify-content: center; align-items: center;
	gap: 6px;
	margin-top: 48px;
	flex-wrap: wrap;
}
.rp-pg-btn {
	min-width: 42px; height: 42px; padding: 0 12px;
	display: inline-flex; align-items: center; justify-content: center;
	background: #fff;
	border-radius: 10px;
	color: var(--rp-ink);
	text-decoration: none;
	font-weight: 600; font-size: 14px;
	transition: all .2s;
	box-shadow: 0 2px 8px rgba(29, 58, 35, 0.05);
	border: none;
	cursor: pointer;
}
.rp-pg-btn:hover     { background: var(--rp-green-100); color: var(--rp-green-700); }
.rp-pg-btn.is-active {
	background: var(--rp-green-700); color: #fff;
	box-shadow: 0 6px 14px rgba(58, 120, 71, 0.32);
}
.rp-pg-btn.is-active:hover { color: #fff; }
.rp-pg-btn.is-disabled {
	opacity: .35;
	cursor: not-allowed;
	pointer-events: none;
}
.rp-pg-btn svg  { width: 16px; height: 16px; }
.rp-pg-dots     { color: var(--rp-mute); padding: 0 6px; }

/* ─── 9. RICHUPS CTA ─────────────────────────────────── */
.rp-cta       { padding: 80px 0; background: var(--rp-cream); }
.rp-cta-inner {
	position: relative;
	background: linear-gradient(135deg, var(--rp-green-700), var(--rp-green-900));
	border-radius: 24px;
	padding: 60px 60px;
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 40px;
	align-items: center;
	overflow: hidden;
	color: #fff;
}
@media (max-width: 800px) {
	.rp-cta-inner { grid-template-columns: 1fr; text-align: center; padding: 50px 32px; }
}
.rp-cta-deco { position: absolute; right: -40px; top: -20px; width: 280px; opacity: .35; }
.rp-cta-deco svg { width: 100%; height: 100%; }
.rp-cta-text { position: relative; z-index: 1; max-width: 640px; }
.rp-cta-eyebrow {
	display: inline-block;
	font-size: 11.5px; letter-spacing: 3px; text-transform: uppercase;
	color: var(--rp-green-300); font-weight: 700;
	margin-bottom: 14px;
}
.rp-cta-text h2 { font-size: clamp(26px, 3.5vw, 38px); line-height: 1.25; margin: 0 0 14px; font-weight: 700; color: #fff; }
.rp-cta-text p  { color: rgba(255,255,255,0.85); margin: 0; font-size: 16px; line-height: 1.65; }
.rp-cta-btn {
	position: relative; z-index: 1;
	display: inline-flex; align-items: center; gap: 10px;
	background: #fff;
	color: var(--rp-green-900);
	padding: 16px 28px;
	border-radius: 12px;
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
	transition: all .25s;
	box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.rp-cta-btn:hover     { background: var(--rp-earth-soft); color: var(--rp-green-900); transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,0,0,0.2); }
.rp-cta-btn svg       { transition: transform .2s; }
.rp-cta-btn:hover svg { transform: translateX(4px); }

/* ─── 10. RESPONSIVE FINE-TUNE ──────────────────────── */
@media (max-width: 640px) {
	.rp-banner            { padding: 70px 0 100px; }
	.rp-toolbar           { flex-direction: column; align-items: stretch; }
	.rp-toolbar-right     { justify-content: space-between; }
}
