/*
 * PASTE THIS FILE AS: /wp-content/plugins/custom-product-addons/assets/css/frontend.css
 * All selectors are scoped under .cpa- to avoid bleeding into theme styles.
 * Elementor style controls override colors/spacing here via inline {{WRAPPER}} rules,
 * so treat these as sane fallback defaults.
 */

.cpa-addons-wrapper {
	margin: 24px 0;
}

.cpa-block-title {
	margin: 0 0 12px;
	font-size: 18px;
	font-weight: 600;
}

/* Layout: column (vertical list) vs row (grid) */
.cpa-addons-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.cpa-addons-list.cpa-layout-row {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
}

/* Card */
.cpa-addon-card {
	display: flex;
	align-items: center;
	gap: 14px;
	background-color: #ffffff;
	border: 1px solid #e0e0e0;
	border-radius: 12px;
	padding: 14px 16px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cpa-addon-card[data-in-stock="0"] {
	opacity: 0.55;
}

/* LEFT: thumbnail */
.cpa-addon-thumb {
	flex: 0 0 auto;
	width: 64px;
	height: 64px;
	border-radius: 8px;
	overflow: hidden;
	background: #f5f5f5;
}

.cpa-addon-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* CENTER: badge + title + price */
.cpa-addon-info {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.cpa-addon-badge {
	display: inline-block;
	align-self: flex-start;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	padding: 2px 8px;
	border-radius: 999px;
	background-color: #43a047;
	color: #ffffff;
}

.cpa-addon-title {
	font-size: 14px;
	font-weight: 600;
	color: #212121;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cpa-addon-price {
	font-size: 14px;
	font-weight: 700;
	color: #e53935;
}

.cpa-addon-price del {
	opacity: 0.6;
	font-weight: 400;
	margin-right: 4px;
}

.cpa-addon-stock-note {
	font-size: 11px;
	color: #d32f2f;
}

/* RIGHT: round selection toggle */
.cpa-addon-toggle {
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	border: 2px solid #bdbdbd;
	background: #ffffff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cpa-addon-toggle:disabled {
	cursor: not-allowed;
	opacity: 0.4;
}

.cpa-addon-toggle-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: transparent;
	transition: background-color 0.15s ease;
}

.cpa-addon-toggle.is-checked {
	background-color: #e53935;
	border-color: #e53935;
}

.cpa-addon-toggle.is-checked .cpa-addon-toggle-dot {
	background-color: #ffffff;
}

/* Selected card highlight — Elementor's "Active Border Color" control targets this class */
.cpa-addon-card.is-selected {
	border-color: #e53935;
	box-shadow: 0 0 0 1px #e53935;
}

/* "Add Selected to Cart" button */
.cpa-add-selected-btn {
	margin-top: 14px;
	width: 100%;
	padding: 12px 20px;
	border: none;
	border-radius: 8px;
	background-color: #212121;
	color: #ffffff;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.cpa-add-selected-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.cpa-feedback-message {
	margin-top: 8px;
	font-size: 13px;
	min-height: 16px;
}

.cpa-feedback-message.is-success {
	color: #2e7d32;
}

.cpa-feedback-message.is-error {
	color: #d32f2f;
}

@media (max-width: 480px) {
	.cpa-addons-list.cpa-layout-row {
		grid-template-columns: 1fr;
	}
}
