/* ============================================================
   Global Search Overlay — Renown Electric (Nicolet pattern)
   Trigger: .toggle-search button in .top-right-search
   Overlay: #gsearch toggled by vanilla JS (.is-open class)
   ============================================================ */

/* Trigger button */
.toggle-search {
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	vertical-align: middle;
	line-height: 1;
}
.toggle-search img {
	display: block;
}

/* Overlay — hidden by default, .is-open shows it */
.global-search {
	display: none;
}
.global-search.is-open {
	display: block;
}

/* Overlay appearance */
.global-search {
	background-color: #000;
	border-bottom: 3px solid #000 !important;
	box-shadow: none !important;
	left: 0;
	padding: 1.25rem 0;
	position: fixed;
	top: 0;
	width: 100%;
	z-index: 99999;
}

/* Inner row: position relative so close btn can be absolute */
.global-search .grid-x {
	position: relative;
}

/* Form row — leaves room on right for absolute close button */
.global-search__form,
.global-search form {
	border: none !important;
	box-shadow: none !important;
	outline: none !important;
	background: transparent !important;
	display: flex;
	align-items: center;
	padding-right: 4.375rem;
	margin: 0 !important;
}

/* Search text input — force white over any theme dark-mode overrides */
.global-search__form input[type="text"],
.global-search__form input[type="search"] {
	border-radius: 5px !important;
	border: none !important;
	box-shadow: none !important;
	background-color: #fff !important;
	color: #000 !important;
	flex: 1 1 auto;
	font-family: inherit;
	font-size: 1.125rem;
	height: 2.625rem;
	margin: 0 !important;
	padding: 0 1.25rem !important;
}
.global-search__form input[type="text"]::placeholder,
.global-search__form input[type="search"]::placeholder {
	color: #888 !important;
}

/* Kill Foundation's focus box-shadow (0 0 5px #cacaca) — that's the gray line */
.global-search__form input[type="text"]:focus,
.global-search__form input[type="search"]:focus {
	box-shadow: none !important;
	border: none !important;
	outline: none !important;
}

/* Submit button — green outline, rounded pill, white text */
.global-search__form button[type="submit"] {
	background-color: transparent !important;
	border: 2px solid #0aa970 !important;
	border-radius: 130px !important;
	color: #fff !important;
	cursor: pointer;
	flex: none;
	font-family: inherit;
	font-size: 1rem;
	margin-left: 0.625rem;
	padding: 0.625rem 1.25rem !important;
	text-decoration: none;
	transition: all 0.3s ease-in-out;
	white-space: nowrap;
}
.global-search__form button[type="submit"]:hover {
	background-color: #0aa970 !important;
	color: #fff !important;
}

/* Close button — big SVG ×, absolute top-right (matches Nicolet icon-close.svg) */
.global-search__close {
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 2.5rem;
	width:  2.5rem;
	padding: 0;
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	opacity: 0.85;
	transition: opacity 0.15s;
}
.global-search__close:hover {
	opacity: 1;
}
.global-search__close svg {
	display: block;
	width:  2.5rem;
	height: 2.5rem;
}

/* When search is open, hide any header borders that bleed through */
body.search-open .header,
body.search-open .header__top,
body.search-open header {
	border-bottom: none !important;
	border-top: none !important;
	outline: none !important;
	box-shadow: none !important;
}

/* ============================================================
   Mobile Nav Search — appended as last <li> inside mega menu drawer
   Injected by JS into #mega-menu-main_menu as .mega-menu-mobile-search-item
   Hidden on desktop so it never appears in the horizontal nav.
   Only visible inside the mobile drawer after hamburger is clicked.
   Breakpoint: 1078px matches data-breakpoint on mega menu
   ============================================================ */

/* Hide on desktop — must not appear as a horizontal nav item */
@media (min-width: 1079px) {
	.mega-menu-mobile-search-item {
		display: none !important;
	}
}

/* Style inside the mobile drawer */
@media (max-width: 1078px) {
	#mega-menu-main_menu li.mega-menu-mobile-search-item,
	#mega-menu-wrap-main_menu li.mega-menu-mobile-search-item {
		border: none !important;
		border-top: none !important;
		border-bottom: none !important;
		box-shadow: none !important;
		padding: 0.75rem 10px !important;
		width: 100% !important;
	}

	/* Spacer above Get A Quote CTA — separates it from the nav links above */
	#mega-menu-main_menu > li.mega-menu-item:last-child {
		margin-top: 0.75rem !important;
	}

	.mobile-menu-search {
		align-items: center;
		display: flex;
		gap: 0.5rem;
		width: 100%;
	}

	.mobile-menu-search__input {
		background-color: #fff !important;
		border: 1px solid #ccc !important;
		border-radius: 4px !important;
		box-shadow: none !important;
		color: #333 !important;
		flex: 1 1 auto;
		font-family: inherit;
		font-size: 0.9375rem;
		height: 2.25rem;
		margin: 0 !important;
		min-width: 0;
		padding: 0 0.75rem !important;
	}

	.mobile-menu-search__input::placeholder {
		color: #999 !important;
	}

	.mobile-menu-search__input:focus {
		border-color: #0aa970 !important;
		box-shadow: 0 0 0 2px rgba(10, 169, 112, 0.2) !important;
		outline: none !important;
	}

	.mobile-menu-search__btn {
		align-items: center;
		background-color: #0aa970 !important;
		border: none !important;
		border-radius: 4px !important;
		color: #fff !important;
		cursor: pointer;
		display: flex;
		flex: none;
		height: 2.25rem;
		justify-content: center;
		padding: 0 !important;
		transition: background-color 0.2s;
		width: 2.25rem;
	}

	.mobile-menu-search__btn:hover,
	.mobile-menu-search__btn:focus {
		background-color: #089060 !important;
		outline: none;
	}

	.mobile-menu-search__btn svg {
		display: block;
	}
}
