/**
 * AJ Tractor Filter - Loading spinner
 * แนบไฟล์นี้ในธีม (enqueue หรือรวมเข้ากับ style.css หลัก)
 */

#aj-products-results {
	min-height: 200px; /* กันเลย์เอาต์กระโดดตอนผลลัพธ์ยังไม่มา */
}

.aj-tractor-loading-overlay {
	display: flex; /* คุมการซ่อน/โชว์ด้วย opacity+visibility แทน display เพราะต้องเป็น flex ตลอด */
	position: absolute;
	inset: 0;
	background: rgba( 255, 255, 255, 0.7 );
	z-index: 50;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s ease;
}

.aj-tractor-loading-overlay.is-visible {
	opacity: 1;
	visibility: visible;
}

.aj-tractor-spinner {
	width: 42px;
	height: 42px;
	border: 4px solid #e0e0e0;
	border-top-color: #2e7d32; /* ปรับสีให้ตรงกับธีม/แบรนด์ */
	border-radius: 50%;
	animation: aj-tractor-spin 0.8s linear infinite;
}

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

/* เวลา loading อยู่ ให้ผลลัพธ์เดิมจางลงเล็กน้อย เพื่อสื่อว่ากำลังอัปเดต */
#aj-products-results.aj-loading > *:not( .aj-tractor-loading-overlay ) {
	opacity: 0.4;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

/* ปุ่ม/ช่องกรอกตอน disabled ระหว่างโหลด */
.aj-tractor-filter-form input:disabled,
.aj-tractor-filter-form select:disabled,
.aj-tractor-filter-form button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.aj-tractor-filter-form select{
	appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    padding: 0 .5rem;

    background-image: url("../images/arrow-down.png");
    background-repeat: no-repeat;
    background-position: right 15px center; /* เลื่อนลูกศร */
    background-size: 20px;
}
