/**
 * Combo Builder frontend styles.
 *
 * Deliberately neutral: inherits the theme's fonts and colors wherever
 * possible; --wccb-accent is the single brand hook (set per combo page
 * or via the Elementor widget).
 */

.wccb {
	--wccb-accent: #111827;
	--wccb-columns: 3;
	--wccb-radius: 10px;
	--wccb-gap: 20px;
	margin: 0 0 2em;
}

.wccb-instructions {
	margin-bottom: 1.25em;
	padding: 14px 18px;
	border-left: 3px solid var(--wccb-accent);
	background: rgba(0, 0, 0, 0.03);
	border-radius: 0 var(--wccb-radius) var(--wccb-radius) 0;
}

.wccb-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: var(--wccb-gap);
	align-items: start;
}

/* ── Product grid ─────────────────────────────────────────────────── */
.wccb-grid {
	display: grid;
	grid-template-columns: repeat(var(--wccb-columns), minmax(0, 1fr));
	gap: var(--wccb-gap);
}

.wccb-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: var(--wccb-radius);
	overflow: hidden;
	transition: box-shadow 0.2s ease, transform 0.2s ease, outline-color 0.2s ease;
	outline: 2px solid transparent;
	outline-offset: -2px;
}

.wccb--style-default .wccb-card {
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 14px rgba(0, 0, 0, 0.05);
}

.wccb--style-default .wccb-card:hover {
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 10px 28px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
}

.wccb--style-bordered .wccb-card {
	border: 1px solid rgba(0, 0, 0, 0.12);
}

.wccb--style-minimal .wccb-card {
	background: transparent;
}

.wccb-card.is-selected {
	outline-color: var(--wccb-accent);
}

.wccb-card__media {
	position: relative;
	cursor: pointer;
	line-height: 0;
}

.wccb-card__media img {
	width: 100%;
	height: auto;
	display: block;
}

.wccb-card__check {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--wccb-accent);
	color: #fff;
	font-size: 15px;
	line-height: 28px;
	text-align: center;
	opacity: 0;
	transform: scale(0.5);
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.wccb-card.is-selected .wccb-card__check {
	opacity: 1;
	transform: scale(1);
}

.wccb-card__body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 14px 16px 16px;
	flex-grow: 1;
}

.wccb-card__title {
	margin: 0;
	font-size: 1em;
	line-height: 1.35;
}

.wccb-card__price {
	font-weight: 600;
}

.wccb-card__desc {
	font-size: 0.86em;
	opacity: 0.75;
}

.wccb-card__actions {
	margin-top: auto;
	display: flex;
	gap: 10px;
	align-items: center;
}

/* Quantity */
.wccb-qty {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid rgba(0, 0, 0, 0.18);
	border-radius: 6px;
	overflow: hidden;
}

.wccb-qty__btn {
	width: 30px;
	border: 0;
	background: transparent;
	cursor: pointer;
	font-size: 15px;
	padding: 0;
	line-height: 1;
}

.wccb-qty__btn:hover {
	background: rgba(0, 0, 0, 0.05);
}

.wccb-qty__input {
	width: 42px;
	border: 0;
	text-align: center;
	padding: 6px 0;
	font-size: 0.9em;
	-moz-appearance: textfield;
	appearance: textfield;
}

.wccb-qty__input::-webkit-inner-spin-button,
.wccb-qty__input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* Select button */
.wccb-card__select {
	flex-grow: 1;
	padding: 9px 12px;
	border: 1px solid var(--wccb-accent);
	border-radius: 6px;
	background: transparent;
	color: var(--wccb-accent);
	font-weight: 600;
	font-size: 0.9em;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.wccb-card__select:hover {
	background: color-mix(in srgb, var(--wccb-accent) 8%, transparent);
}

.wccb-card__select-remove {
	display: none;
}

.wccb-card.is-selected .wccb-card__select {
	background: var(--wccb-accent);
	color: #fff;
}

.wccb-card.is-selected .wccb-card__select-add {
	display: none;
}

.wccb-card.is-selected .wccb-card__select-remove {
	display: inline;
}

/* ── Summary sidebar ──────────────────────────────────────────────── */
.wccb-summary {
	position: sticky;
	top: 24px;
}

.wccb-summary__inner {
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: var(--wccb-radius);
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.wccb-summary__title {
	margin: 0;
	font-size: 1.1em;
}

.wccb-summary__counter {
	margin: 0;
	font-size: 0.9em;
	opacity: 0.85;
}

.wccb-summary__items {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-height: 260px;
	overflow-y: auto;
}

.wccb-summary__item {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	font-size: 0.88em;
	padding: 6px 0;
	border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
}

.wccb-summary__total {
	display: flex;
	justify-content: space-between;
	margin: 0;
	padding-top: 8px;
	border-top: 2px solid rgba(0, 0, 0, 0.12);
	font-weight: 700;
	font-size: 1.05em;
}

/* Messages */
.wccb-message {
	padding: 10px 14px;
	border-radius: 6px;
	font-size: 0.88em;
}

.wccb-message--error {
	background: #fdecec;
	color: #8a1f1f;
}

.wccb-message--warning {
	background: #fff7e0;
	color: #7a5a00;
}

.wccb-message--success {
	background: #e8f7ec;
	color: #1c6b34;
}

/* Submit */
.wccb-submit {
	position: relative;
	padding: 13px 18px;
	border: 0;
	border-radius: 8px;
	background: var(--wccb-accent);
	color: #fff;
	font-weight: 700;
	font-size: 1em;
	cursor: pointer;
	transition: opacity 0.15s ease, transform 0.1s ease;
}

.wccb-submit:hover:not(:disabled) {
	opacity: 0.92;
}

.wccb-submit:active:not(:disabled) {
	transform: scale(0.99);
}

.wccb-submit:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.wccb-submit__spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: wccb-spin 0.7s linear infinite;
	margin-left: 8px;
	vertical-align: -3px;
}

.wccb.is-loading .wccb-submit__spinner {
	display: inline-block;
}

@keyframes wccb-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wccb *,
	.wccb *::before,
	.wccb *::after {
		transition: none !important;
		animation-duration: 1.5s;
	}
}

/* Focus visibility */
.wccb button:focus-visible,
.wccb input:focus-visible {
	outline: 2px solid var(--wccb-accent);
	outline-offset: 2px;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 1024px) {
	.wccb-grid {
		grid-template-columns: repeat(min(var(--wccb-columns), 3), minmax(0, 1fr));
	}
}

@media (max-width: 900px) {
	.wccb-layout {
		grid-template-columns: 1fr;
	}

	.wccb-summary {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		top: auto;
		z-index: 999;
	}

	.wccb-summary__inner {
		border-radius: var(--wccb-radius) var(--wccb-radius) 0 0;
		box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.12);
		gap: 8px;
		padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
	}

	.wccb-summary__items {
		display: none; /* Compact mobile bar: counter + total + button. */
	}

	/* Leave room so the fixed bar doesn't cover the grid. */
	.wccb {
		padding-bottom: 170px;
	}
}

@media (max-width: 640px) {
	.wccb-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 400px) {
	.wccb-grid {
		grid-template-columns: 1fr;
	}
}
