/* =========================================================================
   Wellness Product Compare — front-end styles (modern UI)
   ========================================================================= */

:root {
	--wpc-primary: #10a37f;
	--wpc-primary-dark: #0b7d61;
	--wpc-primary-soft: #e6f7f1;
	--wpc-accent: #14b8a6;
	--wpc-purple: #9422ab;
	--wpc-purple-dark: #6d28d9;
	--wpc-ink: #1f2a37;
	--wpc-muted: #6b7280;
	--wpc-line: #e8ecef;
	--wpc-bg: #ffffff;
	--wpc-bg-soft: #f6f9f8;
	--wpc-danger: #e11d48;
	--wpc-danger-soft: #fdecef;
	--wpc-success: #0f9d58;
	--wpc-radius: 16px;
	--wpc-radius-sm: 10px;
	--wpc-shadow: 0 10px 30px rgba(16, 42, 55, .12);
	--wpc-shadow-lg: 0 24px 60px rgba(16, 42, 55, .22);
	--wpc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* =========================================================================
   1. Compare icon (product loop / single product)
   ========================================================================= */
.wpc-compare-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: var(--wpc-purple);
	color: #fff;
	cursor: pointer;
	text-decoration: none;
	line-height: 1;
	box-shadow: 0 4px 12px rgba(124, 58, 237, .35);
	transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.wpc-compare-btn .wpc-compare-icon {
	display: inline-flex;
	width: 20px;
	height: 20px;
}
.wpc-compare-btn .wpc-compare-icon svg {
	width: 100%;
	height: 100%;
	fill: currentColor;
	transition: transform .25s ease;
}
/* Icon-only button — the label stays available to screen readers via aria-label/title */
.wpc-compare-btn .wpc-compare-text {
	display: none;
}
.wpc-compare-btn:hover {
	background: var(--wpc-purple-dark);
	color: #fff;
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(124, 58, 237, .45);
}
.wpc-compare-btn.is-added {
	background: var(--wpc-purple-dark);
}
.wpc-compare-btn.is-added .wpc-compare-icon svg {
	transform: scale(1.08);
}
.wpc-compare-btn.is-disabled {
	opacity: .45;
	cursor: not-allowed;
	pointer-events: auto;
}

/* =========================================================================
   2. Floating compare bar
   ========================================================================= */
.wpc-bar {
	position: fixed;
	left: 50%;
	bottom: 22px;
	transform: translateX(-50%) translateY(20px);
	z-index: 99998;
	width: min(880px, calc(100% - 28px));
	opacity: 0;
	animation: wpc-bar-in .45s cubic-bezier(.2, .8, .2, 1) forwards;
	font-family: var(--wpc-font);
}
@keyframes wpc-bar-in {
	to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.wpc-bar-inner {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 14px 12px 18px;
	background: rgba(255, 255, 255, .86);
	backdrop-filter: saturate(180%) blur(14px);
	-webkit-backdrop-filter: saturate(180%) blur(14px);
	border: 1px solid rgba(16, 163, 127, .16);
	border-radius: 999px;
	box-shadow: var(--wpc-shadow-lg);
}
.wpc-bar-lead {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 0 0 auto;
}
.wpc-bar-icon {
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--wpc-primary-soft);
}
.wpc-bar-icon svg { width: 18px; height: 18px; fill: var(--wpc-primary); }
.wpc-bar-title {
	display: flex;
	flex-direction: column;
	font-weight: 700;
	color: var(--wpc-ink);
	line-height: 1.1;
	font-size: 15px;
}
.wpc-bar-count {
	font-size: 12px;
	font-weight: 600;
	color: var(--wpc-primary);
}
.wpc-bar-items {
	display: flex;
	gap: 8px;
	flex: 1 1 auto;
	justify-content: center;
	flex-wrap: nowrap;
	overflow: hidden;
}
.wpc-bar-item {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--wpc-bg-soft);
	border: 1px solid var(--wpc-line);
	border-radius: 999px;
	padding: 4px 8px 4px 4px;
	font-size: 13px;
	max-width: 280px;
	animation: wpc-chip-in .3s ease;
}
@keyframes wpc-chip-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
.wpc-bar-item img {
	width: 30px;
	height: 30px;
	object-fit: cover;
	border-radius: 50%;
}
.wpc-bar-item .wpc-item-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--wpc-ink);
	font-weight: 500;
}
.wpc-bar-item .wpc-item-remove {
	border: none;
	background: none;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	color: var(--wpc-muted);
	padding: 0 2px;
	transition: color .15s ease;
}
.wpc-bar-item .wpc-item-remove:hover { color: var(--wpc-danger); }
.wpc-bar-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
}
.wpc-bar-actions .wpc-clear {
	border: none;
	background: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: var(--wpc-muted);
	transition: color .15s ease, transform .15s ease;
}
.wpc-bar-actions .wpc-clear:hover { color: var(--wpc-danger); transform: rotate(90deg); }

/* Buttons */
.wpc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	cursor: pointer;
	font-weight: 700;
	font-size: 14px;
	border-radius: 999px;
	padding: 10px 18px;
	text-decoration: none;
	transition: transform .15s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease;
	white-space: nowrap;
}
.wpc-btn-primary {
	color: #fff;
	background: linear-gradient(135deg, var(--wpc-primary), var(--wpc-accent));
	box-shadow: 0 8px 20px rgba(16, 163, 127, .35);
}
.wpc-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(16, 163, 127, .45); }
.wpc-btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.wpc-btn-ghost {
	color: var(--wpc-primary-dark);
	background: var(--wpc-primary-soft);
}
.wpc-btn-ghost:hover { background: #d7f1e8; color: var(--wpc-primary-dark); }

/* =========================================================================
   3. Modal / popup
   ========================================================================= */
.wpc-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--wpc-font);
}
.wpc-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(12, 26, 22, .55);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	animation: wpc-fade .25s ease;
}
@keyframes wpc-fade { from { opacity: 0; } to { opacity: 1; } }
.wpc-modal-box {
	position: relative;
	background: var(--wpc-bg);
	border-radius: 22px;
	max-width: 940px;
	width: calc(100% - 28px);
	max-height: 90vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: var(--wpc-shadow-lg);
	animation: wpc-pop .35s cubic-bezier(.2, .9, .25, 1.1);
}
@keyframes wpc-pop { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.wpc-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px;
	background: linear-gradient(135deg, var(--wpc-primary), var(--wpc-accent));
	color: #fff;
}
.wpc-modal-title {
	margin: 0;
	font-size: 19px;
	font-weight: 800;
	color: #fff;
	letter-spacing: .2px;
}
.wpc-modal-close {
	border: none;
	background: rgba(255, 255, 255, .18);
	color: #fff;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	transition: background .15s ease, transform .15s ease;
}
.wpc-modal-close:hover { background: rgba(255, 255, 255, .32); transform: rotate(90deg); }
.wpc-modal-content {
	padding: 20px 22px 24px;
	overflow: auto;
}

/* =========================================================================
   4. Comparison table
   ========================================================================= */
.wpc-table-wrap { overflow-x: auto; font-family: var(--wpc-font); }
.wpc-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 15px;
	color: var(--wpc-ink);
}
.wpc-table th,
.wpc-table td {
	padding: 16px 18px;
	vertical-align: top;
	text-align: left;
	border-bottom: 1px solid var(--wpc-line);
}
.wpc-table tbody tr:nth-child(even) td,
.wpc-table tbody tr:nth-child(even) .wpc-row-label { background: var(--wpc-bg-soft); }
.wpc-table tbody tr:hover td { background: var(--wpc-primary-soft); }

.wpc-row-label {
	width: 160px;
	font-weight: 700;
	color: var(--wpc-muted);
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: .04em;
	background: #fff;
	position: sticky;
	left: 0;
	z-index: 1;
}
.wpc-corner {
	background: transparent;
	border-bottom: none;
}
.wpc-corner-text {
	display: inline-block;
	color: var(--wpc-muted);
	font-weight: 700;
}

/* Product header cards */
.wpc-product-head {
	text-align: center;
	border-bottom: 2px solid var(--wpc-primary-soft);
	min-width: 220px;
}
.wpc-product-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	color: var(--wpc-ink);
}
.wpc-product-thumb img {
	width: 110px;
	height: 110px;
	object-fit: cover;
	border-radius: 14px;
	box-shadow: var(--wpc-shadow);
	transition: transform .25s ease;
}
.wpc-product-link:hover .wpc-product-thumb img { transform: translateY(-3px) scale(1.02); }
.wpc-product-name {
	font-weight: 700;
	font-size: 16px;
	line-height: 1.35;
}
.wpc-view-product {
	display: inline-block;
	margin-top: 10px;
	padding: 7px 16px;
	font-size: 13px;
	font-weight: 700;
	color: var(--wpc-primary-dark);
	background: var(--wpc-primary-soft);
	border-radius: 999px;
	text-decoration: none;
	transition: background .2s ease, color .2s ease;
}
.wpc-view-product:hover { background: var(--wpc-primary); color: #fff; }

/* Cell content */
.wpc-cell { line-height: 1.55; }
.wpc-cell p { margin: 0 0 .6em; }
.wpc-cell p:last-child { margin-bottom: 0; }
.wpc-price {
	font-weight: 800;
	font-size: 17px;
	color: var(--wpc-primary-dark);
}
.wpc-price del { color: var(--wpc-muted); font-weight: 500; font-size: 14px; }
.wpc-stock-pill {
	display: inline-block;
	padding: 5px 12px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 700;
}
.wpc-stock-pill.is-in-stock { background: #e7f7ee; color: var(--wpc-success); }
.wpc-stock-pill.is-out-stock { background: var(--wpc-danger-soft); color: var(--wpc-danger); }
.wpc-na { color: #b7bec6; }
.wpc-empty {
	text-align: center;
	padding: 40px 20px;
	color: var(--wpc-muted);
	font-size: 15px;
	font-family: var(--wpc-font);
}

/* =========================================================================
   5. Compare page
   ========================================================================= */
.wpc-compare-page { font-family: var(--wpc-font); }
.wpc-page-head { text-align: center; margin-bottom: 26px; }
.wpc-page-title {
	margin: 0 0 6px;
	font-size: 28px;
	font-weight: 800;
	color: var(--wpc-ink);
}
.wpc-page-sub { margin: 0; color: var(--wpc-muted); font-size: 15px; }

.wpc-selectors {
	display: flex;
	align-items: stretch;
	gap: 18px;
	flex-wrap: nowrap;
	margin-bottom: 30px;
}
.wpc-selector {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1 1 0;
	background: var(--wpc-bg);
	border: 1px solid var(--wpc-line);
	border-radius: var(--wpc-radius);
	padding: 18px;
	box-shadow: var(--wpc-shadow);
}
.wpc-selector label {
	font-weight: 700;
	color: var(--wpc-primary-dark);
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: .05em;
}
/* Searchable combobox */
.wpc-combo { position: relative; width: 100%; }
.wpc-combo-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--wpc-line);
	border-radius: var(--wpc-radius-sm);
	background: var(--wpc-bg-soft);
	font-size: 15px;
	color: var(--wpc-muted);
	cursor: pointer;
	text-align: left;
	transition: border-color .2s ease, box-shadow .2s ease;
}
.wpc-combo.has-value .wpc-combo-toggle { color: var(--wpc-ink); }
.wpc-combo.is-open .wpc-combo-toggle,
.wpc-combo-toggle:hover {
	border-color: var(--wpc-primary);
	box-shadow: 0 0 0 3px var(--wpc-primary-soft);
}
.wpc-combo-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 600;
}
.wpc-combo-caret {
	flex: 0 0 auto;
	width: 9px;
	height: 9px;
	border-right: 2px solid var(--wpc-muted);
	border-bottom: 2px solid var(--wpc-muted);
	transform: rotate(45deg);
	transition: transform .2s ease;
	margin-top: -3px;
}
.wpc-combo.is-open .wpc-combo-caret { transform: rotate(-135deg); margin-top: 3px; }

.wpc-combo-panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 50;
	background: var(--wpc-bg);
	border: 1px solid var(--wpc-line);
	border-radius: var(--wpc-radius-sm);
	box-shadow: var(--wpc-shadow-lg);
	overflow: hidden;
	animation: wpc-pop .2s ease;
}
.wpc-combo-search {
	position: relative;
	padding: 10px;
	border-bottom: 1px solid var(--wpc-line);
	background: var(--wpc-bg);
}
.wpc-combo-search-icon {
	position: absolute;
	left: 20px;
	top: 50%;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	color: var(--wpc-muted);
	pointer-events: none;
}
.wpc-combo-search-icon svg { width: 100%; height: 100%; }
.wpc-combo-input {
	width: 100%;
	padding: 10px 12px 10px 34px;
	border: 1px solid var(--wpc-line);
	border-radius: 8px;
	font-size: 14px;
	color: var(--wpc-ink);
	background: var(--wpc-bg-soft);
}
.wpc-combo-input:focus {
	outline: none;
	border-color: var(--wpc-primary);
	box-shadow: 0 0 0 3px var(--wpc-primary-soft);
}
.wpc-combo-list {
	list-style: none;
	margin: 0;
	padding: 6px;
	max-height: 320px;
	overflow-y: auto;
}
.wpc-combo-option {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 10px;
	border-radius: 8px;
	cursor: pointer;
	transition: background .15s ease;
}
.wpc-combo-option:hover { background: var(--wpc-primary-soft); }
.wpc-combo-option[aria-selected="true"] { background: var(--wpc-primary-soft); }
.wpc-combo-option img,
.wpc-combo-noimg {
	width: 40px;
	height: 40px;
	border-radius: 8px;
	object-fit: cover;
	flex: 0 0 auto;
	background: var(--wpc-bg-soft);
}
.wpc-combo-opt-name {
	flex: 1 1 auto;
	font-weight: 600;
	color: var(--wpc-ink);
	line-height: 1.3;
}
.wpc-combo-opt-price {
	flex: 0 0 auto;
	font-weight: 700;
	color: var(--wpc-primary-dark);
	font-size: 13px;
}
.wpc-combo-opt-price del { color: var(--wpc-muted); font-weight: 500; }
.wpc-combo-loading,
.wpc-combo-empty {
	list-style: none;
	padding: 18px;
	text-align: center;
	color: var(--wpc-muted);
	font-size: 14px;
}

.wpc-selector-vs {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
}
.wpc-selector-vs span {
	width: 52px;
	height: 52px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--wpc-primary), var(--wpc-accent));
	color: #fff;
	font-weight: 800;
	font-size: 15px;
	box-shadow: 0 8px 18px rgba(16, 163, 127, .35);
}
.wpc-compare-page-table {
	background: var(--wpc-bg);
	border: 1px solid var(--wpc-line);
	border-radius: var(--wpc-radius);
	overflow: hidden;
	box-shadow: var(--wpc-shadow);
}
.wpc-compare-page-table .wpc-table th:first-child,
.wpc-compare-page-table .wpc-table td:first-child { padding-left: 22px; }

/* =========================================================================
   6. Responsive
   ========================================================================= */
@media (max-width: 782px) {
	.wpc-bar { bottom: 12px; }
	.wpc-bar-inner { border-radius: 20px; flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
	.wpc-bar-items { display: none; }
	.wpc-bar-actions { flex: 1 1 100%; justify-content: space-between; }
	.wpc-btn { flex: 1 1 auto; }

	.wpc-selectors { flex-direction: column; }
	.wpc-selector-vs { justify-content: center; }
	.wpc-selector-vs span { margin: -6px 0; }

	.wpc-page-title { font-size: 23px; }
	.wpc-modal-content { padding: 14px; }
	.wpc-table th, .wpc-table td { padding: 12px; }
	.wpc-row-label { width: 108px; font-size: 12px; }
	.wpc-product-thumb img { width: 74px; height: 74px; }
	.wpc-product-name { font-size: 14px; }
}

/* =========================================================================
   7. RTL support (Arabic / WPML)
   ========================================================================= */
[dir="rtl"] .wpc-table th,
[dir="rtl"] .wpc-table td { text-align: right; }

/* Sticky first column moves to the right in RTL */
[dir="rtl"] .wpc-row-label { left: auto; right: 0; }

[dir="rtl"] .wpc-compare-page-table .wpc-table th:first-child,
[dir="rtl"] .wpc-compare-page-table .wpc-table td:first-child {
	padding-left: 18px;
	padding-right: 22px;
}

/* Combobox: search icon + input padding flip */
[dir="rtl"] .wpc-combo-toggle { text-align: right; }
[dir="rtl"] .wpc-combo-search-icon { left: auto; right: 20px; }
[dir="rtl"] .wpc-combo-input { padding: 10px 34px 10px 12px; }

/* Bar chips / actions read naturally under the inherited RTL flow;
   only nudge the clear button so it doesn't hug the edge. */
[dir="rtl"] .wpc-modal-close,
[dir="rtl"] .wpc-modal-header { direction: rtl; }
