/* ============================================================
   BW Product Compare — Biowest brand styling
   Single semantic table: alignment + sticky headers are native.
   Tune the brand in the :root block below.
   ============================================================ */
:root {
	--bw-ink:     #1e1b3a;
	--bw-body:    #4a4a63;
	--bw-muted:   #8a8aa3;
	--bw-purple:  #4b1e78;
	--bw-magenta: #e6007e;
	/* brand button gradient (from Figma) + a slightly lifted hover variant */
	--bw-grad:       linear-gradient(117.95deg, #1B2454 13.27%, #3A1D4A 56.41%, #5B1F52 94.15%);
	--bw-grad-hover: linear-gradient(117.95deg, #26316E 13.27%, #4C2761 56.41%, #78286B 94.15%);
	--bw-line:    #eceaf2;
	--bw-row-alt: #faf9fc;
	--bw-radius:  16px;
	--bw-font:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- add-to-compare toggle (your Bricks Compare icon element) ---------- */
.bw-compare { cursor: pointer; position: relative !important; overflow: visible !important; transition: color .15s ease, opacity .15s ease; }
.bw-compare.is-active { color: var(--bw-magenta); }
/* Checkmark is injected by JS and absolutely positioned to the LEFT of the
   element, vertically centred — so it works regardless of the element's own
   flex-direction (Bricks stacks the icon above the "Compare" label). */
.bw-check {
	position: absolute !important;
	right: 100%;
	top: 50%;
	transform: translateY(-50%);
	margin-right: 6px;
	color: var(--bw-magenta);
	font-weight: 700;
	font-size: 11.5px;
	letter-spacing: .4px;
	text-transform: uppercase;
	line-height: 1;
	white-space: nowrap;
	pointer-events: none;
}

/* ---------- floating counter button ---------- */
.bw-compare-bar {
	position: fixed; right: 24px; bottom: 24px; z-index: 99998;
	display: none; align-items: center; gap: 10px;
	padding: 12px 20px; border-radius: 999px;
	background: var(--bw-grad); color: #fff;
	font-family: var(--bw-font); font-size: 14px; font-weight: 600;
	box-shadow: 0 10px 30px rgba(27,36,84,.35); cursor: pointer;
	transition: transform .15s ease, background .15s ease;
}
.bw-compare-bar.is-visible { display: inline-flex; }
.bw-compare-bar:hover { background: var(--bw-grad-hover); transform: translateY(-2px); }
.bw-compare-bar-icon { display: flex; align-items: center; }

/* circular × dismiss badge, pinned to the top-right corner of the pill
   (same on mobile + desktop — the pill itself doesn't change between them) */
.bw-compare-bar-dismiss {
	position: absolute; top: -9px; right: -9px;
	width: 24px; height: 24px; padding: 0;
	display: flex; align-items: center; justify-content: center;
	border: 2px solid #fff; border-radius: 50%;
	background: var(--bw-magenta); color: #fff;
	font-size: 16px; line-height: 1; cursor: pointer;
	box-shadow: 0 2px 8px rgba(30,27,58,.35);
	transition: transform .15s ease, background .15s ease;
}
.bw-compare-bar-dismiss:hover { background: var(--bw-purple); transform: scale(1.12); }

/* ---------- overlay + modal ---------- */
html.bw-compare-lock { overflow: hidden; }
.bw-compare-overlay {
	position: fixed; inset: 0; z-index: 99999; display: none;
	background: rgba(20,16,40,.55); backdrop-filter: blur(4px);
	padding: 4vh 4vw; box-sizing: border-box;
}
.bw-compare-overlay.is-open { display: block; }
.bw-compare-modal {
	position: relative; width: 100%; max-width: 1180px; height: 92vh; margin: 0 auto;
	background: #fff; border-radius: var(--bw-radius); overflow: hidden;
	box-shadow: 0 24px 60px rgba(30,27,58,.28);
	font-family: var(--bw-font);
	display: flex; flex-direction: column;
}
.bw-compare-body { flex: 1; overflow: auto; padding: 64px 24px 24px; }

/* close + clear + page link inside modal */
.bw-compare-close {
	position: absolute; top: 16px; right: 18px; z-index: 5;
	width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
	border: 0; background: #f3f1f8; color: var(--bw-ink); border-radius: 50%;
	font-size: 24px; line-height: 1; cursor: pointer; transition: .18s;
}
.bw-compare-close:hover { background: var(--bw-magenta); color: #fff; transform: rotate(90deg); }
.bw-clear, .bw-page {
	position: absolute; top: 18px; z-index: 5;
	font-size: 13px; font-weight: 600; text-decoration: none;
	padding: 8px 16px; border-radius: 999px; transition: .15s; white-space: nowrap;
}
.bw-clear { left: 20px; color: var(--bw-purple); background: #f3f1f8; }
.bw-clear:hover { background: var(--bw-magenta); color: #fff; }
.bw-page { left: 190px; color: var(--bw-muted); display: inline-flex; align-items: center; gap: 5px; }
.bw-page:hover { color: var(--bw-magenta); }

/* ---------- the table (shared by popup + page) ---------- */
.bw-compare-wrap { width: 100%; overflow-x: auto; }
.bw-compare-table {
	width: 100%; border-collapse: collapse; font-family: var(--bw-font);
	color: var(--bw-body); font-size: 14px;
}
.bw-compare-table th, .bw-compare-table td {
	border: 0; border-bottom: 1px solid var(--bw-line);
	padding: 12px 18px; text-align: center; vertical-align: middle;
	min-width: 200px;
}

/* row-label column (sticky left) */
.bw-compare-table tbody th {
	position: sticky; left: 0; z-index: 2;
	text-align: left; color: var(--bw-ink); font-weight: 600;
	background: #fff; white-space: nowrap; min-width: 180px;
}

/* product header row (sticky top) */
.bw-compare-table thead th {
	position: sticky; top: 0; z-index: 3; background: #fff;
	border-bottom: 1px solid var(--bw-line); vertical-align: top; padding: 16px 18px;
}
.bw-compare-table thead th.bw-corner {
	left: 0; z-index: 4; min-width: 180px; border-bottom: 1px solid var(--bw-line);
}
.bw-col-head { position: relative; }
.bw-remove {
	position: absolute; top: 6px; right: 8px; width: 24px; height: 24px;
	border: 0; border-radius: 50%; background: #f3f1f8; color: var(--bw-muted);
	font-size: 16px; line-height: 1; cursor: pointer; transition: .15s;
}
.bw-remove:hover { background: var(--bw-magenta); color: #fff; }
.bw-thumb { display: block; margin: 0 auto 10px; }
.bw-thumb img {
	width: 120px; height: 120px; object-fit: contain;
	background: #fbfbfd; border: 1px solid var(--bw-line); border-radius: 12px; padding: 8px;
}
.bw-name {
	display: block; margin: 0 0 8px; font-size: 15px; font-weight: 600;
	line-height: 1.35; color: var(--bw-ink); text-decoration: none;
}
.bw-name:hover { color: var(--bw-magenta); }
.bw-price { font-weight: 700; color: var(--bw-ink); margin-bottom: 10px; }
.bw-cta {
	display: inline-block; background: var(--bw-grad); color: #fff;
	font-weight: 600; font-size: 13.5px; padding: 10px 22px;
	border-radius: 999px; text-decoration: none; transition: .15s;
}
.bw-cta:hover { background: var(--bw-grad-hover); color: #fff; }

/* stock badge */
.bw-stock {
	display: inline-block; font-weight: 600; font-size: 12.5px;
	padding: 4px 12px; border-radius: 999px;
}
.bw-stock.in  { background: #e7f7ee; color: #1b7a44; }
.bw-stock.out { background: #fdecec; color: #b3261e; }

/* description */
.bw-desc-row th, .bw-desc-row td { vertical-align: top; }
.bw-desc { text-align: left; font-size: 13.5px; line-height: 1.55; color: var(--bw-body); }
.bw-desc p { margin: 0 0 .7em; }
.bw-desc p:last-child { margin-bottom: 0; }
.bw-desc strong { color: var(--bw-ink); font-weight: 600; }

/* specifications section divider */
.bw-section th {
	text-align: left; text-transform: uppercase; letter-spacing: .6px;
	font-size: 11.5px; font-weight: 700; color: var(--bw-purple);
	background: #fff; border-bottom: 2px solid var(--bw-purple); padding-top: 20px;
	position: static;
}
.bw-empty { color: var(--bw-muted); }

/* clickable product categories */
.bw-cat { line-height: 1.5; }
.bw-cat a { color: var(--bw-purple); text-decoration: none; }
.bw-cat a:hover { color: var(--bw-magenta); text-decoration: underline; }

/* consistent zebra striping — every 2nd data row gets a super-light gradient
   (the .bw-section divider row is excluded). Applied to th too so the sticky
   left label column matches when scrolling horizontally. */
.bw-compare-table tbody tr:nth-child(even):not(.bw-section) td,
.bw-compare-table tbody tr:nth-child(even):not(.bw-section) th {
	background: linear-gradient(90deg, #faf9fc 0%, #f5f2fb 100%);
}

/* ---------- /compare page variant (no overlay) ---------- */
.bw-compare-page { font-family: var(--bw-font); }
.bw-compare-page .bw-compare-wrap {
	background: #fff; border: 1px solid var(--bw-line); border-radius: var(--bw-radius); padding: 8px;
}

/* ---------- empty + loading ---------- */
.bw-compare-empty { padding: 48px 24px; text-align: center; color: var(--bw-muted); font-family: var(--bw-font); }
.bw-compare-loading {
	width: 34px; height: 34px; margin: 60px auto; border-radius: 50%;
	border: 3px solid var(--bw-line); border-top-color: var(--bw-purple);
	animation: bw-spin .8s linear infinite;
}
@keyframes bw-spin { to { transform: rotate(360deg); } }

/* ---------- scrollbars ---------- */
.bw-compare-body::-webkit-scrollbar, .bw-compare-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.bw-compare-body::-webkit-scrollbar-thumb, .bw-compare-wrap::-webkit-scrollbar-thumb { background: #d5d0e2; border-radius: 8px; }

/* ---------- mobile ---------- */
@media (max-width: 767px) {
	.bw-compare-overlay { padding: 2vh 2vw; }
	.bw-compare-modal { height: 96vh; }
	.bw-compare-body { padding: 60px 12px 16px; }
	.bw-page { display: none; }
	.bw-compare-table thead th { padding: 12px; }
	.bw-thumb img { width: 88px; height: 88px; }
	.bw-name { font-size: 13.5px; }
	.bw-compare-table th, .bw-compare-table td { min-width: 150px; }
	.bw-compare-table tbody th, .bw-compare-table thead th.bw-corner { min-width: 120px; }
}