/**
 * Price Rules Admin Styles
 *
 * Styling for the price rules builder UI.
 * Follows EPOFW conventions (.epofw-* prefix).
 *
 * @since 4.4.9
 */

/* Price Rules Container */
.epofw-price-rules-container {
	background-color: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	padding: 15px;
	margin-top: 10px;
}

/* Rules Wrapper */
.epofw-price-rules-wrapper {
	margin-bottom: 15px;
}

/* Single Rule Row */
.epofw-price-rule-row {
	background-color: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 15px;
	margin-bottom: 12px;
	display: grid;
	grid-template-columns: auto auto auto auto 32px;
	gap: 10px;
	align-items: center;
}

.epofw-price-rule-row:hover {
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.1 );
}

/* Rule Content Container */
.epofw-price-rule-content {
	display: contents;
}

/* Rule Group (When, Value, Modifier, Amount) */
.epofw-price-rule-group {
	display: flex;
	align-items: center;
	gap: 6px;
}

/* Rule Label (When, =, Then) */
.epofw-price-rule-label {
	font-size: 13px;
	font-weight: 600;
	color: #555;
	white-space: nowrap;
	padding: 0 6px;
}

/* Trigger Field Dropdown */
.epofw-price-rule-trigger-field {
	min-width: 140px;
	padding: 6px 8px;
}

/* Value Input Container */
.epofw-price-rule-value-input {
	display: flex;
	gap: 6px;
	align-items: center;
}

.epofw-price-rule-trigger-value-select,
.epofw-price-rule-trigger-value-text {
	min-width: 110px;
	padding: 6px 8px;
}

/* Modifier Dropdown */
.epofw-price-rule-modifier {
	min-width: 150px;
	padding: 6px 8px;
}

/* Amount Group */
.epofw-price-rule-amount {
	display: flex;
	align-items: center;
	gap: 4px;
	justify-content: flex-start;
}

.epofw-price-rule-symbol {
	font-size: 14px;
	font-weight: 600;
	color: #666;
	min-width: 15px;
}

.epofw-price-rule-amount-input {
	width: 70px;
	padding: 6px 8px;
}

/* Remove Button */
.epofw-price-rule-remove {
	background: none;
	border: none;
	color: #dc3545;
	cursor: pointer;
	font-size: 18px;
	padding: 0 4px;
	min-width: 32px;
	text-align: center;
	transition: color 0.2s;
	flex: 0 0 auto;
}

.epofw-price-rule-remove:hover {
	color: #c82333;
}

/* Add Price Rule Button */
.epofw-add-price-rule {
	background-color: #f1f1f1;
	border: 1px solid #ddd;
	color: #555;
	padding: 8px 12px;
	border-radius: 4px;
	font-size: 13px;
	cursor: pointer;
	transition: all 0.2s;
}

.epofw-add-price-rule:hover {
	background-color: #e8e8e8;
	border-color: #ccc;
}

/* Form Controls */
.epofw-price-rules-container .epofw-form-control {
	padding: 6px 8px;
	font-size: 13px;
	border: 1px solid #ddd;
	border-radius: 3px;
	background-color: #fff;
	color: #333;
}

.epofw-price-rules-container .epofw-form-control:focus {
	outline: none;
	border-color: #4a90e2;
	box-shadow: 0 0 0 3px rgba( 74, 144, 226, 0.1 );
}

/* Responsive: Stack on smaller screens */
@media ( max-width: 768px ) {
	.epofw-price-rule-content {
		flex-direction: column;
		align-items: stretch;
	}

	.epofw-price-rule-group {
		width: 100%;
		gap: 6px;
	}

	.epofw-price-rule-trigger-field,
	.epofw-price-rule-modifier,
	.epofw-price-rule-amount-input {
		width: 100%;
		min-width: unset;
	}

	.epofw-price-rule-label {
		min-width: unset;
	}

	.epofw-price-rule-remove {
		align-self: flex-start;
		margin-top: 4px;
	}
}

/* Premium Preview State */
.epofw-premium-preview .epofw-price-rules-container {
	opacity: 0.6;
	pointer-events: none;
}

.epofw-premium-preview .epofw-price-rules-container::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: repeating-linear-gradient(
		45deg,
		transparent,
		transparent 10px,
		rgba( 255, 255, 255, 0.1 ) 10px,
		rgba( 255, 255, 255, 0.1 ) 20px
	);
	pointer-events: none;
}

/*
 * Option-based fields (select/radio/checkbox/country/...) price per selected
 * option, so hide the field-level price controls in the Pricing tab and show
 * only the Price Rules section. The rules section and the note are direct
 * children too, but are not .epofw-form-group / #price_extra so they remain.
 */
.epofw-tab-content.epofw-pricing-rules-only > .epofw-form-group,
.epofw-tab-content.epofw-pricing-rules-only > #price_extra {
	display: none !important;
}

/*
 * Option-based Price Rules tab — proper UI.
 * Render the per-option note as a full-width info banner (it was collapsing into
 * a narrow column), and give the Price Rules section clean spacing.
 */
.epofw-tab-content.epofw-pricing-rules-only .epofw-pricing-rules-only-note {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	flex: 1 1 100% !important;
	grid-column: 1 / -1 !important;
	box-sizing: border-box !important;
	margin: 0 0 20px !important;
	padding: 12px 16px !important;
	background: #f0f6fc !important;
	border: 1px solid #c3d9ed !important;
	border-left: 4px solid #2271b1 !important;
	border-radius: 4px !important;
	font-size: 13px !important;
	line-height: 1.5 !important;
	color: #1d2327 !important;
}

.epofw-tab-content.epofw-pricing-rules-only [id^="epofw-price-rules-section-"] {
	display: block !important;
	width: 100%;
}
