/**
 * Vehicle Search — Custom searchable select component.
 *
 * Uses existing hero-search CSS variables for seamless integration.
 *
 * @package DroxAuto
 */

/* ═══════════════════════════════════════════
   SELECT WRAPPER
   ═══════════════════════════════════════════ */
.vs-select {
	position: relative;
	width: 100%;
}

/* ── Trigger ── */
.vs-select__trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	min-height: 46px;
	padding: 10px 14px;
	background: #fff;
	border: 1.5px solid var(--hs-border, #e0e0e0);
	border-radius: 8px;
	cursor: pointer;
	transition: border-color 0.2s, box-shadow 0.2s;
	outline: none;
	user-select: none;
}

.vs-select__trigger:hover {
	border-color: color-mix(in srgb, var(--hs-border, #e0e0e0), #000 20%);
}

.vs-select__trigger:focus-visible {
	border-color: var(--hs-focus, #f5700a);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--hs-focus, #f5700a) 15%, transparent);
}

/* ── Value text ── */
.vs-select__value {
	flex: 1;
	font-size: 14px;
	color: #999;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.vs-select__value--filled {
	color: #1a1a1a;
	font-weight: 500;
}

/* ── Arrow ── */
.vs-select__arrow {
	flex-shrink: 0;
	width: 10px;
	height: 10px;
	margin-left: 10px;
	border-right: 2px solid #999;
	border-bottom: 2px solid #999;
	transform: rotate(45deg) translateY(-2px);
	transition: transform 0.25s;
}

.vs-select--open .vs-select__arrow {
	transform: rotate(-135deg) translateY(-2px);
}

/* ── Loading spinner ── */
.vs-select__spinner {
	display: none;
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	margin-left: 8px;
	border: 2px solid #e0e0e0;
	border-top-color: var(--hs-focus, #f5700a);
	border-radius: 50%;
	animation: vs-spin 0.6s linear infinite;
}

.vs-select--loading .vs-select__spinner {
	display: block;
}

.vs-select--loading .vs-select__arrow {
	display: none;
}

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

/* ── Disabled state ── */
.vs-select--disabled .vs-select__trigger {
	background: #f5f5f5;
	border-color: #e8e8e8;
	cursor: not-allowed;
	opacity: 0.6;
}

.vs-select--disabled .vs-select__value {
	color: #bbb;
}

/* ═══════════════════════════════════════════
   DROPDOWN
   ═══════════════════════════════════════════ */
.vs-select__dropdown {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	z-index: 100;
	background: #fff;
	border: 1.5px solid var(--hs-border, #e0e0e0);
	border-radius: 10px;
	box-shadow: 0 8px 32px rgba(0,0,0,0.12);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity 0.2s, transform 0.2s, visibility 0s 0.2s;
	overflow: hidden;
}

.vs-select--open .vs-select__dropdown {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	transition: opacity 0.2s, transform 0.2s, visibility 0s 0s;
}

/* ── Search input ── */
.vs-select__search-wrap {
	padding: 10px 12px 8px;
	border-bottom: 1px solid #f0f0f0;
}

.vs-select__search {
	width: 100%;
	padding: 8px 12px;
	font-size: 13px;
	border: 1.5px solid #e8e8e8;
	border-radius: 6px;
	outline: none;
	transition: border-color 0.2s;
	background: #fafafa;
}

.vs-select__search:focus {
	border-color: var(--hs-focus, #f5700a);
	background: #fff;
}

/* ── List ── */
.vs-select__list {
	list-style: none;
	margin: 0;
	padding: 6px 0;
	max-height: 220px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.vs-select__list::-webkit-scrollbar {
	width: 5px;
}

.vs-select__list::-webkit-scrollbar-thumb {
	background: #ddd;
	border-radius: 3px;
}

.vs-select__list::-webkit-scrollbar-thumb:hover {
	background: #bbb;
}

/* ── Items ── */
.vs-select__item {
	padding: 9px 14px;
	font-size: 13.5px;
	color: #333;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.vs-select__item:hover,
.vs-select__item--active {
	background: color-mix(in srgb, var(--hs-focus, #f5700a) 8%, transparent);
	color: var(--hs-focus, #f5700a);
}

.vs-select__item--selected {
	font-weight: 600;
	color: var(--hs-focus, #f5700a);
	background: color-mix(in srgb, var(--hs-focus, #f5700a) 6%, transparent);
}

/* ── Empty state ── */
.vs-select__empty {
	display: none;
	padding: 20px 14px;
	text-align: center;
	font-size: 13px;
	color: #999;
}

/* ═══════════════════════════════════════════
   SUBMIT BUTTON DISABLED STATE
   ═══════════════════════════════════════════ */
.hs__btn--disabled,
.hs__btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 600px) {
	.vs-select__trigger {
		min-height: 42px;
		padding: 8px 12px;
	}

	.vs-select__dropdown {
		border-radius: 8px;
	}

	.vs-select__list {
		max-height: 180px;
	}
}

/* ═══════════════════════════════════════════════════════════════════
   VIN SEARCH RESULTS / VERSION PICKER
   ═══════════════════════════════════════════════════════════════════ */
.hs__vin-results {
	display: none;
	margin-top: 12px;
	font-size: 13px;
	line-height: 1.45;
}

.hs__vin-results.is-visible { display: block; }

.hs__vin-msg {
	margin: 0;
	padding: 10px 12px;
	border-radius: 8px;
	font-weight: 600;
}

.hs__vin-results--pending .hs__vin-msg { background: #f0f4ff; color: #4f46e5; }
.hs__vin-results--warn .hs__vin-msg    { background: #fffbeb; color: #b45309; }
.hs__vin-results--error .hs__vin-msg   { background: #fef2f2; color: #b91c1c; }

.hs__vin-picker-title {
	margin: 0 0 8px;
	font-weight: 700;
	color: var(--hs-title, #1a1a1a);
}

.hs__vin-picker-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 260px;
	overflow-y: auto;
}

.hs__vin-option {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 10px 12px;
	border: 1px solid var(--hs-border, #e0e0e0);
	border-radius: 8px;
	text-decoration: none;
	color: inherit;
	background: #fff;
	transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}

.hs__vin-option:hover {
	border-color: var(--hs-focus, #f5700a);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.hs__vin-option:active { transform: scale(0.995); }

.hs__vin-option-main {
	font-weight: 600;
	color: var(--hs-title, #1a1a1a);
}

.hs__vin-option-sub {
	font-size: 12px;
	color: #6b7280;
}
