/**
 * FBT - Frequently Bought Together
 * Frontend styles
 */

.fbt-wrapper {
	margin: 30px 0;
	font-family: inherit;
	color: #222;
	box-sizing: border-box;
}

.fbt-wrapper *,
.fbt-wrapper *::before,
.fbt-wrapper *::after {
	box-sizing: border-box;
}

.fbt-wrapper .fbt-title,
h2.fbt-title {
	font-size: 32px !important;
	line-height: 1.3 !important;
	font-weight: 600 !important;
	margin: 0 0 20px !important;
	padding: 0 !important;
	color: #111 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
}

/* ---------- Product row ---------- */

.fbt-products {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 12px;
	margin-bottom: 20px;
}

.fbt-product {
	flex: 1 1 180px;
	min-width: 160px;
	max-width: 240px;
	display: flex;
}

.fbt-product-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	padding: 12px;
	margin: 0;
	position: relative;
}

.fbt-product-image {
	width: 100%;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 10px;
	background: #fff;
	border-radius: 4px;
	overflow: hidden;
}

.fbt-product-image img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
}

.fbt-product-info {
	display: flex;
	flex-direction: column;
	flex: 1;
}

.fbt-product-name {
	font-size: 0.92em;
	font-weight: 500;
	color: #0066c0;
	text-decoration: none;
	line-height: 1.35;
	margin-bottom: 6px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.fbt-product-name:hover {
	color: #c45500;
	text-decoration: underline;
}

.fbt-product-price {
	font-size: 0.95em;
	font-weight: 600;
	color: #b12704;
	margin-bottom: 6px;
}

.fbt-product-price del {
	color: #888;
	font-weight: 400;
	margin-right: 4px;
}

.fbt-product-price ins {
	text-decoration: none;
	color: #b12704;
}

/* ---------- Variation selectors ---------- */

.fbt-variations {
	margin-top: 8px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.fbt-variation-row {
	display: flex;
	flex-direction: column;
}

.fbt-variation-label {
	font-size: 0.75em;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: #6b7280;
	margin-bottom: 4px;
	cursor: default;
}

.fbt-variation-select {
	width: 100%;
	padding: 8px 32px 8px 12px;
	font-size: 0.9em;
	font-family: inherit;
	color: #111;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	background-color: #fff;
	background-image: url( "data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E" );
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 12px 8px;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	line-height: 1.3;
}

.fbt-variation-select:hover {
	border-color: #9ca3af;
}

.fbt-variation-select:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba( 37, 99, 235, 0.15 );
}

/* ---------- Plus / Equals separator ---------- */

.fbt-plus,
.fbt-equals {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.6em;
	font-weight: 300;
	color: #888;
	flex: 0 0 auto;
	min-width: 16px;
	user-select: none;
}

/* ---------- Summary (inline with products) ---------- */

.fbt-summary {
	flex: 1 1 180px;
	min-width: 160px;
	max-width: 240px;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: center;
	gap: 10px;
	padding: 12px;
}

.fbt-total {
	font-size: 1em;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.fbt-add-all-btn {
	flex: 0 0 auto;
}

.fbt-total-label {
	color: #555;
	margin-right: 6px;
}

.fbt-total-price {
	font-size: 1.3em;
	font-weight: 700;
	color: #b12704;
}

.fbt-wrapper .fbt-add-all-btn,
button.fbt-add-all-btn {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;
	padding: 12px 14px !important;
	font-size: 0.8em !important;
	font-weight: 600 !important;
	color: #fff !important;
	background: #111 !important;
	border: 1px solid #111 !important;
	border-radius: 999px !important;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
	line-height: 1.25 !important;
	white-space: normal !important;
	overflow-wrap: break-word !important;
	word-break: break-word !important;
	text-align: center !important;
	box-sizing: border-box !important;
	letter-spacing: normal !important;
}

.fbt-add-all-btn:hover {
	background: #000 !important;
	box-shadow: 0 4px 10px rgba( 0, 0, 0, 0.2 );
	transform: translateY( -1px );
}

.fbt-add-all-btn:disabled,
.fbt-add-all-btn.is-loading {
	opacity: 0.7;
	cursor: not-allowed;
}

.fbt-message {
	font-size: 0.9em;
	min-height: 1.2em;
	margin-top: 12px;
}

.fbt-message-success {
	color: #007600;
}

.fbt-message-error {
	color: #b12704;
}

/* ---------- Modal ---------- */

body.fbt-modal-open {
	overflow: hidden;
}

.fbt-modal[hidden] {
	display: none;
}

.fbt-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.fbt-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.55 );
	cursor: pointer;
}

.fbt-modal-content {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 10px;
	padding: 28px 24px 24px;
	max-width: 480px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 20px 50px rgba( 0, 0, 0, 0.25 );
	color: #222;
	box-sizing: border-box;
}

.fbt-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 18px;
}

.fbt-modal-close {
	width: 32px !important;
	height: 32px !important;
	min-width: 0 !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	background: #111 !important;
	border: 0 !important;
	border-radius: 50% !important;
	font-size: 18px;
	line-height: 1;
	color: #fff !important;
	cursor: pointer;
	padding: 0 0 2px !important;
	box-shadow: 0 2px 6px rgba( 0, 0, 0, 0.2 );
	flex: 0 0 auto;
	transition: background 0.15s ease, transform 0.15s ease;
}

.fbt-modal-close:hover {
	background: #000 !important;
	transform: scale( 1.05 );
}

.fbt-wrapper .fbt-modal .fbt-modal-title,
h3.fbt-modal-title {
	margin: 0 !important;
	padding: 0 !important;
	font-size: 24px !important;
	line-height: 1.3 !important;
	font-weight: 600 !important;
	color: #111 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	flex: 1 1 auto;
}

.fbt-modal-products {
	display: flex;
	flex-direction: column;
	gap: 18px;
	margin-bottom: 20px;
}

.fbt-modal-product {
	padding-bottom: 18px;
	border-bottom: 1px solid #e5e7eb;
}

.fbt-modal-product:last-child {
	border-bottom: 0;
	padding-bottom: 0;
}

.fbt-modal-product-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 12px;
}

.fbt-modal-product-header img {
	width: 64px;
	height: 64px;
	object-fit: contain;
	border-radius: 4px;
	flex: 0 0 64px;
}

.fbt-modal-product-name {
	font-weight: 600;
	font-size: 0.95em;
	color: #111;
	line-height: 1.3;
}

.fbt-modal-confirm {
	width: 100%;
	font-size: 0.95em !important;
	padding: 12px 16px !important;
}

/* ---------- Responsive ---------- */

@media ( max-width: 768px ) {
	.fbt-wrapper {
		padding: 16px;
	}

	.fbt-products {
		gap: 8px;
	}

	.fbt-product {
		flex: 1 1 calc( 50% - 20px );
		min-width: 0;
		max-width: none;
	}

	.fbt-plus,
	.fbt-equals {
		font-size: 1.3em;
		flex: 0 0 12px;
	}
}

@media ( max-width: 480px ) {
	.fbt-products {
		flex-direction: column;
	}

	.fbt-product,
	.fbt-summary {
		flex: 1 1 100%;
		max-width: 100%;
	}

	.fbt-plus,
	.fbt-equals {
		width: 100%;
		justify-content: center;
		padding: 4px 0;
	}

	.fbt-add-all-btn {
		width: 100%;
	}
}
