/**
 * Frontend CSS for SPP Bundle Products
 */

/* Bundle Title */
.spp-section-label {
	font-size: 18px;
	font-weight: 600;
	margin: 0 0 16px 0;
}

.wp-block-woocommerce-add-to-cart-with-options-variation-selector {
	display: none !important;
}

.spp-variations-wrapper {
	display: flex;
	flex-direction: column;
	gap: 32px;
}

.spp-variation-options {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.spp-variation-option {
	width: 32.3%;
	border: 1px solid #E6E9F0;
	border-radius: 8px;
}

.spp-variation-option.selected {
	border-color: #04A86B;
	border-width: 2px;
	font-weight: 700;
}

.spp-variation-option label {
	margin-bottom: 0 !important;
	padding: 8px 12px;
	width: 100%;
	display: flex;
	justify-content: space-between;
	cursor: pointer;
}

.spp-variation-option input {
	display: none;
}

/* Form */
.spp-bundle-form {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* Bundle Items Container */
.spp-bundle-items {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* Bundle Group */
.spp-bundle-group {
	border: 1px solid #E6E9F0;
	border-radius: 6px;
	overflow: hidden;
	transition: all 0.2s ease;
}

.spp-bundle-group:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.spp-toggle-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	font-size: 16px;
	transition: transform 0.2s ease;
	transform: rotate(90deg);
}

.spp-bundle-group-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: transparent;
	color: #3DBBFF;
	cursor: pointer;
	padding: 0 0 16px 16px;
}

.spp-bundle-group-toggle-icon {
	transition: transform 0.2s ease;
}

.spp-bundle-product-list[data-expanded="false"] .spp-bundle-product-item:nth-child(n+3) {
	display: none;
}

/* Product List */
.spp-bundle-product-list {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 16px;
	animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
	from {
		opacity: 0;
		max-height: 0;
	}

	to {
		opacity: 1;
		max-height: 500px;
	}
}


/* Product Item */
.spp-bundle-product-item {
	display: flex;
	align-items: stretch;
	gap: 10px;
	transition: all 0.2s ease;
	position: relative;
	border-bottom: 1px solid #E6E9F0;
	padding-bottom: 16px;
}

.spp-bundle-product-item:last-child,
.spp-bundle-product-list[data-expanded="false"] .spp-bundle-product-item:nth-child(2) {
	border-bottom: none;
	padding-bottom: 0;
}

.spp-bundle-product-item.out-of-stock {
	opacity: 0.6;
	background-color: #f5f5f5;
}

/* Checkbox */
.spp-bundle-product-checkbox-label {
	display: flex;
	align-items: center;
	cursor: pointer;
	margin: 0 !important;
}

.spp-bundle-product-checkbox {
	position: absolute;
	opacity: 0;
	cursor: pointer;
	width: 0;
	height: 0;
}

.spp-checkbox-custom {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border: 1px solid #313131;
	border-radius: 4px;
	background-color: white;
	transition: all 0.2s ease;
	flex-shrink: 0;
}

.spp-bundle-product-checkbox:checked+.spp-checkbox-custom {
	background-color: #fff;
	border-color: #04A86B;
}

.spp-bundle-product-checkbox:checked+.spp-checkbox-custom::after {
	content: '\F633';
	font-family: "bootstrap-icons";
	color: #04A86B;
	font-size: 16px;
}

.spp-bundle-product-checkbox:disabled+.spp-checkbox-custom {
	background-color: #eee;
	border-color: #ddd;
	cursor: not-allowed;
}

/* Product Image */
.spp-bundle-product-image {
	width: 100%;
	max-width: 80px;
	overflow: hidden;
	display: flex;
}

.spp-bundle-product-image img {
	width: 100%;
	height: auto;
	object-fit: contain;
}

/* Product Details */
.spp-bundle-product-details-wrapper {
	display: flex;
	justify-content: space-between;
	width: 100%;
}

.spp-bundle-product-details {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.spp-product-price {
	font-weight: 700;
}

.spp-product-stock-status {
	font-size: 11px;
	color: #cc0000;
	font-weight: 600;
	text-transform: uppercase;
}

.spp-bundle-product-actions {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
}

/* Bundle Footer */
.spp-bundle-quantity-wrapper {
	display: inline-flex;
	align-items: center;
	margin-top: 12px;
	border: 1px solid #E6E9F0;
	border-radius: 999px;
	overflow: hidden;
}

.spp-bundle-quantity-button {
	width: 30px;
	height: 30px;
	font-size: 18px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.spp-bundle-quantity-input {
	max-width: 60px;
	width: 30px;
	padding: 6px 0;
	text-align: center;
	-moz-appearance: textfield;
}

.spp-bundle-quantity-input::-webkit-outer-spin-button,
.spp-bundle-quantity-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.spp-bundle-attributes {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
}

.spp-bundle-attribute-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
	position: relative;
	max-width: 250px;
}

.spp-bundle-attribute-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	max-height: 34px;
	overflow: hidden;
}


.spp-bundle-attribute-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.spp-bundle-attribute-pill,
.spp-bundle-summary-item-variation-attribute {
	padding: 4px 8px;
	border: 1px solid #F5F7FB;
	border-radius: 999px;
	background-color: #F5F7FB;
	cursor: pointer;
	font-size: 14px;
	color: #6B7280;
}

.spp-bundle-attribute-pill.selected {
	border-color: #313131;
	color: #313131;
}

.spp-bundle-attribute-select {
	color: #313131;
	padding: 4px 8px;
	font-size: 14px !important;
	cursor: pointer;
	font-family: inherit;
	transition: all 0.2s ease;
	max-width: 100%;
}

.spp-bundle-attribute-select:focus {
	border-color: #3DBBFF !important;
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.spp-bundle-attribute-select:hover {
	border-color: #999;
}

.spp-bundle-attribute-group.is-select::before {
	content: "\F282";
	font-family: "bootstrap-icons";
	position: absolute;
	right: 8px;
	top: 2px;
	font-size: 12px;
}

.spp-bundle-summary {
	border-radius: 8px;
	background-color: #fff;
	padding: 16px 20px;
}

.spp-bundle-summary-toggle {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	font-size: 18px;
	font-weight: 700;
	cursor: pointer;
}

.spp-bundle-summary-main-price-wrapper {
	display: flex;
	align-items: center;
	gap: 5px;
}

.spp-bundle-summary-icon {
	transition: transform 0.2s ease;
}

.spp-bundle-summary.is-open .spp-bundle-summary-icon {
	transform: rotate(180deg);
}

.spp-bundle-summary-body {
	max-height: 0;
	overflow: hidden;
	transition: all 0.3s ease-out;
}

.spp-bundle-summary.is-open .spp-bundle-summary-body {
	max-height: 1000px;
	padding-top: 16px;
	margin-top: 16px;
	border-top: 1px solid #E6E9F0;
}

.spp-bundle-summary-section-label {
	font-weight: 700;
}

.spp-bundle-summary-items {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.spp-bundle-summary-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	color: #6B7280;
	font-size: 14px;
}

.spp-bundle-summary-item-meta,
.spp-bundle-summary-item-info {
	display: flex;
	align-items: center;
	gap: 10px;
}

.spp-bundle-summary-item-quantity,
.spp-bundle-summary-item-price {
	text-align: right;
	text-wrap: nowrap;
}

.spp-bundle-summary-item-variation {
	margin: 4px 0;
}

.spp-bundle-summary-item-variation-attribute {
	margin-right: 4px;
}

.spp-bundle-add-to-cart-btn.loading {
	pointer-events: none;
	opacity: 0.8;
}

.spp-bundle-add-to-cart-btn.loading::after {
	content: '';
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-left: 8px;
	border: 2px solid white;
	border-top-color: transparent;
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
	.spp-variation-option {
		width: 48.5%;
	}

	.spp-checkbox-custom {
		height: 18px;
		width: 18px;
	}

	.spp-bundle-product-details-wrapper {
		flex-direction: column;
		gap: 16px;
	}

	.spp-bundle-product-actions {
		align-items: flex-start;
	}

	.spp-bundle-quantity-wrapper {
		margin-top: 6px;
	}

	.spp-bundle-summary-toggle {
		font-size: 16px;
	}

	.spp-bundle-summary-icon {
		font-size: 12px;
	}

	.spp-bundle-summary-title {
		max-width: 65%;
	}
	body.product-type-variable .spp-bundle-summary-title {
		max-width: 55%;
	}

	.spp-bundle-summary-extras>div+div {
		margin-top: 16px;
	}

	.spp-bundle-summary-item-info {
		max-width: 70%;
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}
	body.product-type-variable .spp-bundle-summary-item-info {
		max-width: 53%;
	}

	.spp-bundle-summary-item-meta {
		gap: 5px;
	}

	.spp-bundle-summary-item-variation {
		margin: 0;
	}
}

/* Dark Mode Support 
@media (prefers-color-scheme: dark) {
	
}*/