/**
 * KS Bundle Discount - Frontend styles
 *
 * v1.1 badge overlay (kept for backward compatibility) + v2.0 combo styles.
 */

/* =====================================================
 * v1.1 BADGE OVERLAY (UNCHANGED)
 * ===================================================== */

.ksbd-badge-wrapper {
	position: relative;
	display: inline-block;
	line-height: 0;
}

.ksbd-badge-wrapper > img {
	position: relative;
	z-index: 1;
}

.ksbd-badge-overlay {
	position: absolute;
	pointer-events: none;
	z-index: 5;
	transform-origin: center center;
	line-height: 1;
	max-width: 80%;
	max-height: 80%;
}

.ksbd-badge-overlay svg {
	width: 100%;
	height: 100%;
	display: block;
	overflow: visible;
}

li.product-category,
.products li.product-category {
	position: relative;
}

.ksbd-badge-overlay--cat {
	z-index: 10;
}

@media (max-width: 480px) {
	.ksbd-badge-overlay {
		max-width: 60%;
	}
}

/* =====================================================
 * v2.0 COMBO PRODUCT BADGE (Scenario B)
 * — REMOVED in v2.1.1. Empty placeholder kept so older minifier caches
 *   don't try to fetch missing rule names.
 * ===================================================== */

/* =====================================================
 * v2.0 COMBO OFFERS SECTION (in category archive, top)
 * ===================================================== */

.ksbd-combo-offers-section {
	background: linear-gradient(135deg, #fff8e1 0%, #fffbeb 100%);
	border: 2px solid #f0c14b;
	border-radius: 12px;
	padding: 24px;
	margin: 24px 0 36px;
}

.ksbd-combo-offers-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
}

.ksbd-combo-offers-header h2 {
	font-size: 1.5em;
	margin: 0;
	color: #b8860b;
}

.ksbd-combo-offers-icon {
	font-size: 1.6em;
	line-height: 1;
}

.ksbd-combo-offers-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 20px;
}

/* Combo card */
.ksbd-combo-card {
	background: #fff;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	transition: transform 0.2s, box-shadow 0.2s;
	display: block;
	text-decoration: none !important;
	color: inherit !important;
	position: relative;
	border: 1px solid #eee;
}

.ksbd-combo-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* .ksbd-combo-card-badge rules removed in v2.1.1.
   The badge feature (and its CSS) will return later. */

.ksbd-combo-card-images {
	display: flex;
	height: 160px;
	background: #f8f8f8;
	position: relative;
}

.ksbd-combo-card-img {
	flex: 1;
	background-size: contain;
	background-position: center;
	background-repeat: no-repeat;
	background-color: #fff;
}

.ksbd-combo-card-img--placeholder {
	background: linear-gradient(135deg, #e0e0e0, #f0f0f0);
}

.ksbd-combo-card-plus {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #fff;
	border: 2px solid #f0c14b;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	font-weight: 700;
	color: #b8860b;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.ksbd-combo-card-content {
	padding: 16px;
}

.ksbd-combo-card-title {
	font-size: 1.1em;
	margin: 0 0 6px;
	color: #222;
}

.ksbd-combo-card-desc {
	font-size: 0.9em;
	color: #666;
	margin: 0 0 14px;
	min-height: 38px;
}

.ksbd-combo-card-cta {
	display: block;
	width: 100%;
	background: #0073aa;
	color: #fff;
	text-align: center;
	padding: 11px;
	border-radius: 6px;
	font-weight: 600;
	font-size: 0.95em;
}

.ksbd-combo-card:hover .ksbd-combo-card-cta {
	background: #005d8a;
}

/* =====================================================
 * v2.0 CONFIGURATOR PAGE
 * ===================================================== */

.ksbd-configurator-main {
	max-width: 1200px;
	margin: 0 auto;
	padding: 24px;
}

.ksbd-configurator {
	font-family: inherit;
}

.ksbd-configurator-hero {
	background: linear-gradient(135deg, #fff8e1 0%, #fffbeb 100%);
	border: 2px solid #f0c14b;
	border-radius: 12px;
	padding: 28px;
	margin-bottom: 28px;
	text-align: center;
}

.ksbd-configurator-title {
	font-size: 1.9em;
	margin: 0 0 10px;
	color: #b8860b;
}

.ksbd-configurator-desc {
	color: #666;
	max-width: 600px;
	margin: 0 auto 14px;
}

.ksbd-configurator-savings-badge {
	display: inline-block;
	background: #d32f2f;
	color: #fff;
	padding: 8px 18px;
	border-radius: 30px;
	font-weight: 700;
	font-size: 1em;
	margin-top: 10px;
}

.ksbd-configurator-layout {
	display: grid;
	grid-template-columns: 1fr 320px;
	gap: 28px;
	align-items: start;
}

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

.ksbd-configurator-step {
	background: #fff;
	border-radius: 10px;
	padding: 24px;
	margin-bottom: 24px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.ksbd-step-header {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: 18px;
	padding-bottom: 14px;
	border-bottom: 1px solid #eee;
}

.ksbd-step-number {
	background: #0073aa;
	color: #fff;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	flex-shrink: 0;
}

.ksbd-step-title {
	font-size: 1.1em;
	font-weight: 600;
	color: #222;
}

.ksbd-step-subtitle {
	font-size: 0.85em;
	color: #888;
}

.ksbd-no-products {
	color: #888;
	font-style: italic;
}

/* Product selector grid */
.ksbd-product-selector {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 14px;
}

.ksbd-product-card {
	border: 2px solid #e5e5e5;
	border-radius: 8px;
	overflow: hidden;
	cursor: pointer;
	transition: border-color 0.15s, box-shadow 0.15s;
	background: #fff;
	position: relative;
}

.ksbd-product-card:hover {
	border-color: #0073aa;
}

.ksbd-product-card.is-selected {
	border-color: #0073aa;
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.ksbd-product-card.is-selected::before {
	content: "\2713";
	position: absolute;
	top: 8px;
	right: 8px;
	background: #0073aa;
	color: #fff;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	font-weight: 700;
	z-index: 2;
}

.ksbd-product-card-img {
	height: 160px;
	background-size: contain;
	background-position: center;
	background-repeat: no-repeat;
	background-color: #fff;
	border-bottom: 1px solid #f0f0f0;
}

.ksbd-product-card-info {
	padding: 10px;
}

.ksbd-product-card-name {
	font-size: 0.85em;
	font-weight: 500;
	color: #333;
	margin-bottom: 4px;
	min-height: 36px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ksbd-product-card-price {
	font-weight: 700;
	color: #d32f2f;
	font-size: 0.9em;
	margin-bottom: 8px;
}

.ksbd-product-card-price .woocommerce-Price-amount {
	color: inherit;
}

.ksbd-product-card-qty {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid #f0f0f0;
}

.ksbd-qty-btn {
	background: #f5f5f5;
	border: 1px solid #ddd;
	width: 26px;
	height: 26px;
	border-radius: 4px;
	cursor: pointer;
	font-weight: 700;
	color: #555;
	display: flex;
	align-items: center;
	justify-content: center;
	user-select: none;
	font-size: 14px;
	line-height: 1;
	padding: 0;
}

.ksbd-qty-btn:hover {
	background: #e8e8e8;
}

.ksbd-qty-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.ksbd-qty-input {
	flex: 1;
	text-align: center;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 4px;
	font-size: 0.85em;
	height: 26px;
	box-sizing: border-box;
	-moz-appearance: textfield;
}

.ksbd-qty-input::-webkit-outer-spin-button,
.ksbd-qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* Price panel (sticky sidebar) */
.ksbd-price-panel {
	background: #fff;
	border-radius: 10px;
	padding: 22px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
	position: sticky;
	top: 20px;
}

.ksbd-price-panel-title {
	font-size: 1.1em;
	margin: 0 0 16px;
	padding-bottom: 12px;
	border-bottom: 1px solid #eee;
}

.ksbd-selected-items {
	margin-bottom: 16px;
	padding-bottom: 14px;
	border-bottom: 1px solid #eee;
}

.ksbd-selected-item {
	font-size: 0.85em;
	color: #666;
	padding: 4px 0;
	display: flex;
	justify-content: space-between;
	gap: 8px;
}

.ksbd-selected-item-name {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ksbd-selected-item-total {
	flex-shrink: 0;
	font-weight: 500;
	color: #333;
}

.ksbd-empty-msg {
	color: #aaa;
	font-style: italic;
	font-size: 0.85em;
	padding: 8px 0;
}

.ksbd-price-row {
	display: flex;
	justify-content: space-between;
	margin-bottom: 10px;
	font-size: 0.9em;
	color: #555;
}

.ksbd-price-discount {
	color: #2e7d32;
	font-weight: 600;
}

.ksbd-price-total {
	border-top: 2px solid #eee;
	padding-top: 12px;
	margin-top: 12px;
	font-size: 1.1em;
	font-weight: 700;
	color: #222;
}

.ksbd-add-to-cart-btn {
	width: 100%;
	background: #2e7d32;
	color: #fff;
	border: none;
	padding: 14px;
	border-radius: 6px;
	font-size: 1em;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s;
	margin-top: 10px;
}

.ksbd-add-to-cart-btn:hover:not(:disabled) {
	background: #1b5e20;
}

.ksbd-add-to-cart-btn:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.ksbd-add-to-cart-btn.is-loading {
	opacity: 0.7;
	cursor: wait;
}

.ksbd-add-to-cart-hint {
	font-size: 0.8em;
	color: #888;
	text-align: center;
	margin: 8px 0 0;
}

.ksbd-add-to-cart-hint.is-success {
	color: #2e7d32;
	font-weight: 500;
}

.ksbd-add-to-cart-hint.is-error {
	color: #d32f2f;
	font-weight: 500;
}

/* =====================================================
 * MOBILE
 * ===================================================== */

@media (max-width: 600px) {
	.ksbd-combo-offers-section {
		padding: 16px;
	}

	.ksbd-combo-offers-grid {
		grid-template-columns: 1fr;
	}

	.ksbd-configurator-main {
		padding: 12px;
	}

	.ksbd-configurator-hero {
		padding: 18px;
	}

	.ksbd-configurator-title {
		font-size: 1.5em;
	}

	.ksbd-configurator-step {
		padding: 16px;
	}

	.ksbd-product-selector {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	}
}
