/**
 * Admin styles for the Easy Shipping Rate rules table.
 * Scoped under #esr-woo-table so nothing leaks into other screens.
 */

#esr-woo-table {
	--esraw-control-height: 34px;
	margin-top: 8px;
	/* Column widths come from the header row; content never widens a column. */
	table-layout: fixed;
	width: 100%;
}

/* ---- Table frame ---- */

#esr-woo-table th,
#esr-woo-table td {
	padding: 12px 10px;
	vertical-align: middle;
}

#esr-woo-table thead th {
	font-weight: 600;
}

#esr-woo-table thead th:first-child,
#esr-woo-table tbody td:first-child {
	width: 28px;
	text-align: center;
}

#esr-woo-table thead th:nth-child(3) {
	width: 18%;
}

#esr-woo-table thead th:nth-child(4) {
	width: 16%;
}

#esr-woo-table thead th:last-child {
	width: 70px;
}

#esr-woo-table tbody tr:hover {
	background-color: #f6f7f7;
}

#esr-woo-table tfoot th {
	padding: 10px;
}

#esr-woo-table input[type="checkbox"] {
	margin: 0;
}

#esr-woo-table + .description {
	margin: 10px 0 0;
}

/* ---- Layout: condition + operator + value on one wrapping line ---- */

#esr-woo-table .easy_rate_condition_content,
#esr-woo-table .easy_rate_operator_content {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	flex: 1 1 auto;
}

/* ---- Uniform control height so the row baseline aligns ---- */

#esr-woo-table input[type="text"],
#esr-woo-table input[type="number"],
#esr-woo-table select,
#esr-woo-table .select2-selection--single {
	height: var(--esraw-control-height);
	margin: 0;
}

#esr-woo-table .select2-selection--single .select2-selection__rendered,
#esr-woo-table .select2-selection--single .select2-selection__arrow {
	height: calc(var(--esraw-control-height) - 2px);
	line-height: calc(var(--esraw-control-height) - 2px);
}

#esr-woo-table .select2-selection--multiple {
	min-height: var(--esraw-control-height);
}

/* ---- Control widths ---- */

/* WooCommerce forces a large minimum width on the settings-form selects;
   inside the rules table every control must stay within its column, whether
   it is a bare select or its selectWoo replacement. */
#esr-woo-table select,
#esr-woo-table input[type="text"],
#esr-woo-table .select2-container {
	min-width: 0 !important;
	max-width: 100% !important;
}

#esr-woo-table td {
	overflow: hidden;
}

/* Compact native widths, matching the selectWoo flex sizing below. */
#esr-woo-table .easy_rate_condition_content > select {
	width: 220px;
}

#esr-woo-table select[name*="[operator]"] {
	width: 100px;
}

#esr-woo-table select[multiple] {
	width: 340px;
}

#esr-woo-table select[name*="[action]"] {
	width: 100%;
}

/* Dropdowns stay compact by default; the condition one gets more room. */
#esr-woo-table .easy_rate_condition_content .select2-container {
	flex: 0 1 110px;
	min-width: 90px;
	width: auto !important;
}

#esr-woo-table .easy_rate_condition_content > .select2-container {
	flex-basis: 190px;
	min-width: 170px;
}

/* Multi-selects (shipping classes, roles, products) match the native width. */
#esr-woo-table select[multiple] + .select2-container {
	flex: 0 1 340px;
}

/* The action-column select fills its cell. */
#esr-woo-table td > .select2-container {
	width: 100% !important;
	min-width: 120px;
}

#esr-woo-table .easy_rate_operator_content input[type="number"] {
	width: 100px;
}

/* Single-value text conditions (zipcode, city, state, country) fill the column,
   matching the condition and operator dropdowns stacked above them. */
#esr-woo-table .easy_rate_operator_content input[type="text"] {
	flex: 1 1 100%;
	width: 100%;
}

/* ---- Per-row delete button ---- */

#esr-woo-table .esr-remove-row {
	border: 0;
	background: none;
	padding: 4px;
	cursor: pointer;
	color: #757575;
}

#esr-woo-table .esr-remove-row:hover {
	color: #d63638;
}

/* ---- Unit suffix (kg, qty, currency…) ---- */

#esr-woo-table .easy_rate_unit {
	color: #757575;
	font-size: 12px;
}
