/**
 * Quantity Selector Styles
 *
 * Pricing / quantity dropdown for variable products that vary by quantity.
 *
 * Colors use letterjacket theme tokens with a hex fallback mirroring the
 * token's value (the old Astra-era --ast-* layer was removed once the
 * letterjacket theme became the only consumer). Subtle backgrounds
 * (hovers) have no --lj-* equivalent and keep plain hex.
 *
 * @package LJE_Tools
 */

/* Hide the native WooCommerce quantity dropdown row — our selector replaces it. */
.lje-qty-native-hidden {
	display: none;
}

/* =============================================
   Pricing Section
   ============================================= */

.lje-pricing-section {
	background: var(--lj-color-bg, #fff);
	border-radius: 8px;
	padding: 15px;
	margin-top: 30px;
	position: relative;
	border: 1px solid var(--lj-color-border, #e2e2e2);
}

.lje-pricing-selector {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	padding: 5px;
	position: relative;
}

.lje-pricing-selector:hover {
	background-color: var(--lj-color-surface-subtle, #f5f5f5);
	border-radius: 4px;
}

.lje-pricing-item {
	flex: 1;
	text-align: center;
}

.lje-pricing-label {
	font-size: 12px;
	color: var(--lj-color-text-muted, #6b6b66);
	margin-bottom: 3px;
}

.lje-pricing-value {
	font-size: 20px;
	font-weight: 600;
	color: var(--lj-color-text, #32322c);
}

/* Border-drawn chevron, matching the theme's Print Options caret.
   Theme token with a mirroring hex fallback. */
.lje-dropdown-arrow {
	width: 0.5rem;
	height: 0.5rem;
	flex-shrink: 0;
	border-right: 2px solid var(--lj-color-text-muted, #6b6b66);
	border-bottom: 2px solid var(--lj-color-text-muted, #6b6b66);
	transform: translateY(-25%) rotate(45deg);
	transition: transform 0.3s ease;
	margin-left: 10px;
}

.lje-dropdown-arrow.lje-open {
	transform: translateY(25%) rotate(225deg);
}

/* =============================================
   Pricing Dropdown
   ============================================= */

.lje-pricing-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: var(--lj-color-bg, #fff);
	border: 1px solid var(--lj-color-border, #e2e2e2);
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	margin-top: 5px;
	display: none;
	max-height: 400px;
	overflow-y: auto;
	z-index: 100;
}

.lje-pricing-dropdown.lje-active {
	display: block;
}

.lje-pricing-dropdown-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 20px;
	border-bottom: 1px solid var(--lj-color-border, #e2e2e2);
	font-size: 12px;
	font-weight: 600;
	color: var(--lj-color-text-muted, #6b6b66);
}

.lje-pricing-option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 20px;
	cursor: pointer;
	transition: background-color 0.2s;
}

.lje-pricing-option:hover {
	background-color: var(--lj-color-surface-subtle, #f5f5f5);
}

.lje-pricing-option.lje-selected {
	background-color: color-mix(in srgb, var(--lj-color-primary, #00a5b2) 10%, var(--lj-color-bg, #fff));
}

.lje-pricing-option-item {
	flex: 1;
	text-align: center;
}

.lje-pricing-option-value {
	font-size: 16px;
	font-weight: 500;
	color: var(--lj-color-text, #32322c);
}

/* =============================================
   Unselected / disabled states (issue #185)
   ============================================= */

/* Placeholder state: nothing chosen yet — de-emphasize the values. */
.lje-pricing-selector.lje-pricing-unselected .lje-pricing-value {
	color: var(--lj-color-text-muted, #6b6b66);
	font-weight: 400;
}

/* Make WooCommerce's disabled add-to-cart state visually unmistakable. */
.lje-quantity-selector-active .single_add_to_cart_button.disabled,
.lje-quantity-selector-active .single_add_to_cart_button[aria-disabled="true"] {
	opacity: 0.5;
	cursor: not-allowed;
}

/* =============================================
   Responsive (max-width: 768px)
   ============================================= */

@media (max-width: 768px) {
	.lje-pricing-section {
		padding: 10px;
		margin-top: 20px;
	}

	.lje-pricing-selector {
		padding: 5px 0;
	}

	.lje-pricing-label {
		font-size: 10px;
	}

	.lje-pricing-value {
		font-size: 16px;
	}

	.lje-dropdown-arrow {
		margin-left: 5px;
	}

	.lje-pricing-dropdown {
		max-height: 60vh;
	}

	/* Mobile overlay for the open dropdown. */
	body.lje-dropdown-open::before {
		content: '';
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0, 0, 0, 0.5);
		z-index: 99;
	}

	body.lje-dropdown-open .lje-pricing-dropdown {
		position: fixed;
		left: 10px;
		right: 10px;
		top: 20%;
		z-index: 1000;
		max-height: 60vh;
	}

	.lje-pricing-option {
		padding: 10px;
	}

	.lje-pricing-option-value {
		font-size: 14px;
	}
}
