/**
 * Header search – inline in header (like pic two): input + blue Sök button + X.
 * When open, search icon is hidden and this bar appears in the header row.
 *
 * @package Blocksy_Child
 */

/* Hide header search icon when search bar is open (desktop only – on mobile icon stays visible, bar shows below) */
@media (min-width: 769px) {
	body.autohjul-search-overlay-open #autohjul-search-id,
	body.autohjul-search-overlay-open [id="autohjul-search-id"] {
		visibility: hidden !important;
		pointer-events: none !important;
		opacity: 0 !important;
	}
}

/* Container: only wraps the box; box is positioned by JS next to #autohjul-search-id */
.autohjul-search-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	pointer-events: none;
}

.autohjul-search-overlay.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: none;
}

.autohjul-search-overlay__backdrop {
	display: none;
}

/* Box position set by JS next to search icon; fixed so it stays beside the icon */
.autohjul-search-overlay__box {
	position: fixed;
	width: 100%;
	max-width: 420px;
	margin: 0;
	pointer-events: auto;
}

/* Mobile: search bar below search icon, full width – position from JS */
@media (max-width: 768px) {
	.autohjul-search-overlay__box--mobile {
		max-width: none !important;
	}
}

/* Same look as pic two: light grey input, blue Sök, rounded */
.autohjul-search-overlay__form {
	display: flex;
	align-items: center;
	gap: 0;
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid #e5e7eb;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.autohjul-search-overlay__input {
	flex: 1;
	min-width: 120px;
	height: 44px;
	padding: 0 14px;
	font-size: 15px;
	color: #111;
	background: #f5f5f5;
	border: none;
	border-radius: 8px 0 0 8px;
	outline: none;
}

.autohjul-search-overlay__input::placeholder {
	color: #6b7280;
}

.autohjul-search-overlay__input:focus {
	background: #eee;
}

.autohjul-search-overlay__btn {
	height: 44px;
	padding: 0 18px;
	font-size: 15px;
	font-weight: 600;
	color: #fff;
	background: #2563eb;
	border: none;
	border-radius: 0;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.2s ease;
}

.autohjul-search-overlay__btn:hover {
	background: #1d4ed8;
}

.autohjul-search-overlay__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 44px;
	padding: 0;
	font-size: 20px;
	line-height: 1;
	color: #374151;
	background: transparent;
	border: none;
	border-radius: 0 8px 8px 0;
	cursor: pointer;
	transition: color 0.2s ease, background 0.2s ease;
}

.autohjul-search-overlay__close:hover {
	color: #111;
	background: #f3f4f6;
}

.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	height: 1px;
	overflow: hidden;
	position: absolute;
	width: 1px;
}

/* Däck type selection popup */
.autohjul-dack-popup {
	position: fixed;
	inset: 0;
	z-index: 100002;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.autohjul-dack-popup.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.autohjul-dack-popup__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	backdrop-filter: blur(4px);
}

.autohjul-dack-popup__box {
	position: relative;
	width: 90%;
	max-width: 420px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
	padding: 24px;
	z-index: 1;
}

.autohjul-dack-popup__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	padding: 0;
	font-size: 22px;
	line-height: 1;
	color: #666;
	background: transparent;
	border: none;
	cursor: pointer;
	border-radius: 4px;
	transition: color 0.2s, background 0.2s;
}

.autohjul-dack-popup__close:hover {
	color: #111;
	background: #f0f0f0;
}

.autohjul-dack-popup__title {
	margin: 0 0 20px 0;
	font-size: 18px;
	font-weight: 600;
	color: #111;
}

.autohjul-dack-popup__options {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 24px;
}

.autohjul-dack-popup__option {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 14px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	cursor: pointer;
	transition: border-color 0.2s, background 0.2s;
}

.autohjul-dack-popup__option:hover {
	border-color: #2563eb;
	background: #f8fafc;
}

.autohjul-dack-popup__option.is-selected {
	border-color: #2563eb;
	background: #eff6ff;
}

.autohjul-dack-popup__option input {
	display: none;
}

.autohjul-dack-popup__option-inner {
	display: flex;
	align-items: center;
	gap: 14px;
}

.autohjul-dack-popup__img {
	width: 64px;
	height: 64px;
	object-fit: contain;
}

.autohjul-dack-popup__label {
	font-size: 15px;
	font-weight: 500;
	color: #333;
}

.autohjul-dack-popup__actions {
	display: flex;
	justify-content: flex-end;
	gap: 12px;
}

.autohjul-dack-popup__btn {
	padding: 10px 22px;
	font-size: 14px;
	font-weight: 600;
	border-radius: 6px;
	cursor: pointer;
	transition: background 0.2s, border-color 0.2s;
}

.autohjul-dack-popup__btn--cancel {
	background: #fff;
	border: 1px solid #d1d5db;
	color: #374151;
}

.autohjul-dack-popup__btn--cancel:hover {
	background: #f9fafb;
	border-color: #9ca3af;
}

.autohjul-dack-popup__btn--confirm {
	background: #2563eb;
	border: none;
	color: #fff;
}

.autohjul-dack-popup__btn--confirm:hover {
	background: #1d4ed8;
}
