/**
 * Upload Rules Admin Page Styles
 *
 * @package Gatewell
 * @since 1.2.0
 */

/* Rules page layout */
.gatewell-rules-wrap {
	max-width: 1200px;
}

/* Rule cards */
.gatewell-rule-card {
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	margin-bottom: 15px;
	background: #fff;
	transition: box-shadow 0.2s;
}

.gatewell-rule-card:hover {
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.gatewell-rule-card.gatewell-rule-disabled {
	opacity: 0.7;
}

.gatewell-rule-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 16px;
	background: #f6f7f7;
	border-bottom: 1px solid #c3c4c7;
	border-radius: 4px 4px 0 0;
	flex-wrap: wrap;
	gap: 8px;
}

.gatewell-rule-title {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.gatewell-rule-title strong {
	font-size: 14px;
	color: #1d2327;
}

.gatewell-rule-status {
	display: inline-block;
	padding: 2px 8px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	border-radius: 3px;
	letter-spacing: 0.3px;
}

.gatewell-status-active {
	background: #00a32a;
	color: #fff;
}

.gatewell-status-disabled {
	background: #999;
	color: #fff;
}

.gatewell-rule-priority {
	display: inline-block;
	padding: 2px 8px;
	font-size: 11px;
	font-weight: 600;
	border-radius: 3px;
	border: 1px solid #c3c4c7;
	background: #f0f0f1;
	color: #2c3338;
}

.gatewell-priority-high {
	background: #fcf3cf;
	border-color: #f1c40f;
	color: #7a6508;
}

.gatewell-priority-very-high {
	background: #fadbd8;
	border-color: #e74c3c;
	color: #922b21;
}

.gatewell-priority-low {
	background: #eaf2f8;
	border-color: #aed6f1;
	color: #2471a3;
}

.gatewell-rule-actions {
	display: flex;
	gap: 6px;
}

.gatewell-rule-actions .button {
	font-size: 12px;
	line-height: 1.8;
	min-height: 28px;
	padding: 0 10px;
}

.gatewell-rule-actions .gatewell-delete-rule {
	color: #b32d2e;
}

.gatewell-rule-actions .gatewell-delete-rule:hover {
	color: #b32d2e;
	border-color: #b32d2e;
}

.gatewell-rule-body {
	padding: 16px;
}

/* Targets */
.gatewell-rule-targets {
	margin-bottom: 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid #f0f0f1;
}

.gatewell-rule-targets h4 {
	font-size: 11px;
	font-weight: 600;
	color: #646970;
	text-transform: uppercase;
	margin: 0 0 8px;
	letter-spacing: 0.5px;
}

.gatewell-target-badge {
	display: inline-block;
	padding: 3px 10px;
	margin: 3px 4px 3px 0;
	border-radius: 3px;
	font-size: 12px;
	border: 1px solid;
}

.gatewell-target-post-type {
	background: #e7f5fe;
	color: #0c5d8e;
	border-color: #c5d9ed;
}

.gatewell-target-context {
	background: #f0faf0;
	color: #1e7e34;
	border-color: #c3e6cb;
}

.gatewell-target-role {
	background: #fef5e7;
	color: #856404;
	border-color: #ffeeba;
}

/* Constraints */
.gatewell-rule-constraints {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 12px;
}

.gatewell-constraint-item {
	display: flex;
	align-items: flex-start;
	gap: 8px;
}

.gatewell-constraint-item .dashicons {
	color: #646970;
	margin-top: 1px;
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.gatewell-constraint-label {
	font-size: 12px;
	font-weight: 600;
	color: #2c3338;
}

.gatewell-constraint-value {
	font-size: 12px;
	color: #646970;
}

/* Empty state */
.gatewell-rules-empty {
	text-align: center;
	padding: 60px 20px;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
}

.gatewell-rules-empty h3 {
	font-size: 18px;
	margin: 10px 0;
	color: #1d2327;
}

.gatewell-rules-empty p {
	color: #646970;
	margin-bottom: 20px;
}

/* Modal styles */
.gatewell-modal-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.7);
	z-index: 100100;
	align-items: center;
	justify-content: center;
}

.gatewell-modal-overlay.active {
	display: flex;
}

.gatewell-modal {
	background: #fff;
	border-radius: 4px;
	box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
	max-width: 750px;
	width: 90%;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
}

.gatewell-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 20px;
	border-bottom: 1px solid #dcdcde;
	flex-shrink: 0;
}

.gatewell-modal-header h2 {
	font-size: 18px;
	font-weight: 600;
	color: #1d2327;
	margin: 0;
}

.gatewell-modal-close {
	font-size: 24px;
	line-height: 1;
	color: #646970;
	cursor: pointer;
	background: none;
	border: none;
	padding: 0;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 3px;
}

.gatewell-modal-close:hover {
	background: #f0f0f1;
}

.gatewell-modal-body {
	padding: 20px;
	overflow-y: auto;
	flex: 1;
}

.gatewell-modal-footer {
	padding: 12px 20px;
	border-top: 1px solid #dcdcde;
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	flex-shrink: 0;
}

/* Form sections */
.gatewell-form-section {
	margin-bottom: 20px;
	padding: 16px;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	background: #f9f9f9;
}

.gatewell-form-section h3 {
	font-size: 14px;
	font-weight: 600;
	color: #1d2327;
	margin: 0 0 12px;
}

.gatewell-form-field {
	margin-bottom: 12px;
}

.gatewell-form-field:last-child {
	margin-bottom: 0;
}

.gatewell-form-field > label {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
	color: #1d2327;
	font-size: 13px;
}

.gatewell-form-field input[type="text"],
.gatewell-form-field input[type="number"],
.gatewell-form-field select {
	width: 100%;
	padding: 6px 10px;
	border: 1px solid #8c8f94;
	border-radius: 3px;
	font-size: 13px;
}

.gatewell-form-field input[type="text"]:focus,
.gatewell-form-field input[type="number"]:focus,
.gatewell-form-field select:focus {
	border-color: #2271b1;
	outline: none;
	box-shadow: 0 0 0 1px #2271b1;
}

.gatewell-form-field-inline {
	display: flex;
	gap: 8px;
	align-items: flex-end;
}

.gatewell-form-field-inline .gatewell-form-field {
	flex: 1;
}

.gatewell-form-field-inline input[type="number"] {
	width: 100%;
}

.gatewell-dimension-separator {
	padding-bottom: 8px;
	font-size: 16px;
	color: #646970;
}

.gatewell-help-text {
	font-size: 12px;
	color: #646970;
	font-style: italic;
	margin-top: 3px;
}

/* Radio & Checkbox groups */
.gatewell-radio-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.gatewell-radio-item,
.gatewell-checkbox-item {
	display: flex;
	align-items: center;
	gap: 6px;
	font-weight: normal;
	cursor: pointer;
}

.gatewell-radio-item input,
.gatewell-checkbox-item input {
	margin: 0;
}

.gatewell-checkbox-group {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: 8px;
}

/* Slider */
.gatewell-slider-container {
	margin-top: 8px;
}

.gatewell-slider-labels {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 4px;
	font-size: 12px;
	color: #646970;
}

.gatewell-slider-labels strong {
	color: #1d2327;
	font-size: 14px;
}

input[type="range"] {
	width: 100%;
}

/* Admin notices for AJAX feedback */
.gatewell-ajax-notice {
	padding: 10px 12px;
	margin: 10px 0;
	border-left: 4px solid;
	background: #fff;
	border-radius: 0 3px 3px 0;
}

.gatewell-ajax-notice.success {
	border-left-color: #00a32a;
	background: #f0faf0;
}

.gatewell-ajax-notice.error {
	border-left-color: #d63638;
	background: #fcf0f1;
}

/* Responsive */
@media (max-width: 782px) {
	.gatewell-rule-header {
		flex-direction: column;
		align-items: flex-start;
	}

	.gatewell-rule-actions {
		width: 100%;
	}

	.gatewell-rule-constraints {
		grid-template-columns: 1fr;
	}

	.gatewell-form-field-inline {
		flex-direction: column;
	}

	.gatewell-dimension-separator {
		display: none;
	}

	.gatewell-modal {
		width: 95%;
		max-height: 95vh;
	}
}
