/* ==========================================================================
   Dual Button
   ========================================================================== */
.cew-dual-button {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
}

.cew-dual-button__btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	text-decoration: none;
	line-height: 1;
	transition: background-color 0.2s ease, color 0.2s ease;
	/* Lets buttons shrink instead of overflowing their flex parent. */
	min-width: 0;
	flex-shrink: 1;
}

.cew-dual-button__btn span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cew-dual-button__divider {
	flex-shrink: 0;
	opacity: 0.6;
	font-size: 0.85em;
}

/* ==========================================================================
   Vertical Timeline
   ========================================================================== */
.cew-timeline {
	position: relative;
	padding: 20px 0;
	--cew-bullet-size: 32px;
}

.cew-timeline__line {
	position: absolute;
	top: 0;
	bottom: 0;
	left: calc(var(--cew-bullet-size) / 2);
	border-left: 2px solid #e5e7eb;
}

.cew-timeline--center .cew-timeline__line {
	left: 50%;
	transform: translateX(-50%);
}

.cew-timeline__item {
	position: relative;
	padding: 0 0 0 calc(var(--cew-bullet-size) + 24px);
}

.cew-timeline__bullet {
	position: absolute;
	left: 0;
	top: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	box-sizing: border-box;
}

.cew-timeline__content {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

/* Beside-content layouts: image and text side by side. */
.cew-timeline__content--img-start,
.cew-timeline__content--img-end {
	flex-direction: row;
	align-items: stretch;
}

.cew-timeline__content--img-end .cew-timeline__image-wrap {
	order: 2;
}

.cew-timeline__content--img-end .cew-timeline__text {
	order: 1;
}

.cew-timeline__image-wrap {
	flex-shrink: 0;
	min-width: 0;
}

.cew-timeline__image-wrap img {
	display: block;
	width: 100%;
	height: 100%;
}

.cew-timeline__content--img-top .cew-timeline__image-wrap img {
	height: auto;
}

.cew-timeline__text {
	flex: 1 1 auto;
	min-width: 0;
}

.cew-timeline__date {
	display: block;
}

.cew-timeline__title {
	display: block;
}

.cew-timeline__description {
	display: block;
}

/* Center/alternating layout: items alternate sides on wider screens. */
@media (min-width: 768px) {
	.cew-timeline--center .cew-timeline__item {
		padding-left: 0;
		width: 50%;
		box-sizing: border-box;
	}
	.cew-timeline--center .cew-timeline__item--left {
		padding-right: calc(var(--cew-bullet-size) + 24px);
		text-align: right;
	}
	.cew-timeline--center .cew-timeline__item--right {
		margin-left: 50%;
		padding-left: calc(var(--cew-bullet-size) + 24px);
	}
	.cew-timeline--center .cew-timeline__item--left .cew-timeline__content--img-start,
	.cew-timeline--center .cew-timeline__item--left .cew-timeline__content--img-end {
		flex-direction: row-reverse;
	}
	.cew-timeline--center .cew-timeline__item--left .cew-timeline__bullet {
		left: auto;
		right: calc(var(--cew-bullet-size) / -2);
	}
	.cew-timeline--center .cew-timeline__item--right .cew-timeline__bullet {
		left: calc(var(--cew-bullet-size) / -2);
	}
}

/* Below the breakpoint, beside-content layouts fall back to stacked so
   text never gets crushed into an unreadably narrow column. */
@media (max-width: 767px) {
	.cew-timeline__content--img-start,
	.cew-timeline__content--img-end {
		flex-direction: column;
	}
	.cew-timeline__content--img-start .cew-timeline__image-wrap,
	.cew-timeline__content--img-end .cew-timeline__image-wrap {
		order: 0;
		width: 100% !important;
		max-width: 100% !important;
	}
	.cew-timeline__content--img-start .cew-timeline__text,
	.cew-timeline__content--img-end .cew-timeline__text {
		order: 1;
	}
}

/* ==========================================================================
   Woo Mini Cart
   ========================================================================== */
.cew-mini-cart {
	position: relative;
	display: inline-flex;
}

.cew-mini-cart__toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	text-decoration: none;
}

.cew-mini-cart__badge {
	position: absolute;
	top: -6px;
	right: -10px;
	font-size: 11px;
	line-height: 1;
	min-width: 16px;
	height: 16px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
}

.cew-mini-cart__dropdown {
	display: none;
	position: absolute;
	top: 100%;
	right: 0;
	z-index: 999;
	min-width: 280px;
	max-width: 90vw;
	background: #fff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	padding: 16px;
	margin-top: 12px;
}

.cew-mini-cart.is-open .cew-mini-cart__dropdown {
	display: block;
}

/* ==========================================================================
   Woo User Profile
   ========================================================================== */
.cew-user-profile {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	text-decoration: none;
	min-width: 0;
}

.cew-user-profile__avatar img {
	border-radius: 50%;
	display: block;
}

.cew-user-profile__name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ==========================================================================
   Header — single flex container, single breakpoint, everything below
   collapses together instead of truncating independently.
   ========================================================================== */
.cew-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: nowrap;
	gap: 24px;
	width: 100%;
}

.cew-header__logo {
	flex: 0 0 auto;
	min-width: 0;
}

.cew-header__logo img {
	max-height: 40px;
	width: auto;
	display: block;
}

.cew-header__nav {
	flex: 1 1 auto;
	min-width: 0;
}

.cew-header__menu {
	display: flex;
	align-items: center;
	gap: 24px;
	list-style: none;
	margin: 0;
	padding: 0;
	flex-wrap: wrap;
}

.cew-header__menu a {
	text-decoration: none;
	white-space: nowrap;
}

.cew-header__actions {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	gap: 20px;
}

.cew-header__button {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
	text-decoration: none;
	padding: 10px 20px;
	border-radius: 6px;
	background: #2563eb;
	color: #fff;
	flex-shrink: 0;
}

.cew-header__toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	width: 32px;
	height: 32px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	flex-shrink: 0;
}

.cew-header__toggle-bar {
	display: block;
	width: 100%;
	height: 2px;
	background: currentColor;
}

/*
 * The breakpoint is set per-instance via the --cew-header-breakpoint
 * custom property (see class-header-widget.php render()), so a media
 * query alone can't reach it — widgets.js applies/removes an
 * .is-mobile class by comparing viewport width to that property. This
 * is what keeps the header's own breakpoint independent of the theme's
 * and of any other widget's breakpoint, which is the root cause this
 * widget exists to avoid.
 */
.cew-header.is-mobile .cew-header__nav {
	display: none;
	flex-basis: 100%;
	order: 10;
}

.cew-header.is-mobile.is-nav-open .cew-header__nav {
	display: block;
}

.cew-header.is-mobile .cew-header__menu {
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	padding: 16px 0;
}

.cew-header.is-mobile .cew-header__toggle {
	display: flex;
}

.cew-header.is-mobile {
	flex-wrap: wrap;
}

/* ==========================================================================
   Comparison Table
   ========================================================================== */
.cew-compare-table-wrap {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.cew-compare-table {
	display: grid;
	grid-template-columns: minmax(160px, 2fr) repeat(var(--cew-compare-columns, 2), minmax(90px, 1fr));
	width: 100%;
	border: 1px solid #e5e7eb;
	box-sizing: border-box;
}

/* Grid column minimums shrink at each breakpoint instead of the table
   carrying a fixed min-width — that fixed min-width was the actual bug:
   it forced a horizontal scrollbar even for a simple 2-column table
   that would otherwise fit a phone screen with no scrolling at all. */
@media (max-width: 1024px) {
	.cew-compare-table {
		grid-template-columns: minmax(120px, 1.6fr) repeat(var(--cew-compare-columns, 2), minmax(64px, 1fr));
	}
}

@media (max-width: 480px) {
	.cew-compare-table {
		grid-template-columns: minmax(90px, 1.4fr) repeat(var(--cew-compare-columns, 2), minmax(44px, 1fr));
	}
}

.cew-compare-table__cell--feature-header {
	align-items: flex-start !important;
	text-align: left;
}

.cew-compare-table__row {
	display: contents;
}

.cew-compare-table__cell {
	border-top: 1px solid #e5e7eb;
	display: flex;
	align-items: center;
}

.cew-compare-table__row--header .cew-compare-table__cell {
	border-top: none;
	align-items: flex-start;
	flex-direction: column;
}

.cew-compare-table__cell--column-title {
	text-align: center;
	align-items: center !important;
	position: relative;
}

.cew-compare-table__title {
	font-weight: 700;
}

.cew-compare-table__price {
	font-size: 0.9em;
	margin-top: 4px;
}

.cew-compare-table__badge {
	position: absolute;
	top: -10px;
	right: 12px;
	font-size: 11px;
	line-height: 1;
	padding: 4px 10px;
	border-radius: 999px;
	white-space: nowrap;
}

.cew-compare-table__cell--label {
	gap: 10px;
}

.cew-compare-table__label-icon {
	flex-shrink: 0;
	display: inline-flex;
}

.cew-compare-table__cell--value {
	justify-content: center;
	text-align: center;
}

.cew-compare-table__cell--highlight {
	position: relative;
}
