/**
 * Elementor Search Widget Override Styles
 *
 * Overrides default Elementor search widget styles to match Figma design
 * Design Reference: Figma node 40288-29893
 *
 * Targets the new Elementor search widget with .e-search classes
 *
 * @package Elcogen_Elementor_Widgets
 */

/* ============================================
   Search Container
   ============================================ */

.e-search {
	width: 100%;
}

/* Form uses flexbox with wrap to create two rows:
   Row 1: Label (full width)
   Row 2: Input wrapper + Submit button (side by side) */
.e-search-form {
	display: flex !important;
	flex-wrap: wrap !important;
	gap: 0.5rem 1.5rem !important;
	width: 100%;
	max-width: none;
	align-items: flex-end !important;
}

/* Label takes full width, forcing next elements to new row */
.e-search-label {
	width: 100% !important;
	flex: 0 0 100% !important;
}

/* ============================================
   Form Label
   ============================================ */

/* Make label visible and styled */
.e-search-label {
	display: block !important;
	margin: 0 !important;
	padding: 0 !important;
}

.e-search-label .elementor-screen-only {
	position: static !important;
	width: auto !important;
	height: auto !important;
	overflow: visible !important;
	clip: auto !important;
	clip-path: none !important;
	white-space: normal !important;
	margin: 0 !important;
	padding: 0 !important;
	font-family: 'Afacad', sans-serif !important;
	font-weight: 400 !important;
	font-size: 1.125rem !important;
	line-height: 1.75rem !important;
	color: #131317 !important;
}

/* ============================================
   Input Wrapper (contains input + clear + results)
   ============================================ */

.e-search-input-wrapper {
	display: flex !important;
	align-items: center !important;
	gap: 1.5rem !important; /* Gap between input, clear button, and search button */
	position: relative;
	flex-wrap: nowrap !important;
}

/* ============================================
   Search Input Field
   ============================================ */

.e-search-input,
input[type="search"].e-search-input {
	background-color: #ffffff !important;
	border: 1px solid #8a8797 !important;
	border-radius: 4px !important;
	padding: 0.5rem !important;
	font-family: 'Afacad', sans-serif !important;
	font-weight: 400 !important;
	font-size: 1.125rem !important;
	line-height: 1.75rem !important;
	color: #131317 !important;
	min-height: auto !important;
	height: auto !important;
	width: 18.75rem !important;
	flex: 0 0 auto !important;
	transition: border-color 0.3s ease, box-shadow 0.3s ease !important;
	outline: none !important;
}

@media (max-width: 40rem) {
	.e-search-input,
input[type="search"].e-search-input {
		flex: 1 !important;
	}
}

.e-search-input:focus,
input[type="search"].e-search-input:focus {
	border-color: #131317 !important;
	box-shadow: 0 0 0 0.0625rem #131317 !important;
}

.e-search-input::placeholder {
	color: #8a8797 !important;
	opacity: 1 !important;
}

/* Remove default search input styling */
.e-search-input::-webkit-search-cancel-button,
.e-search-input::-webkit-search-decoration {
	-webkit-appearance: none !important;
	appearance: none !important;
}

/* ============================================
   Clear Button (SVG Icon)
   ============================================ */

/* Style the existing clear SVG button - matches Figma design */
/* In search results: Uses flexbox between input and button */
.e-search-input-wrapper .e-font-icon-svg.e-fas-times {
	width: 2.5rem !important;
	height: 2.5rem !important;
	min-width: 2.5rem !important;
	min-height: 2.5rem !important;
	padding: 0.125rem !important; /* Figma: padding-icon-only = 0.125rem */
	background-color: transparent !important;
	border: 2px solid #1e1c25 !important;
	border-radius: 50% !important;
	cursor: pointer !important;
	transition: all 0.3s ease !important;
	flex-shrink: 0 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	color: #1e1c25 !important;
	fill: #1e1c25 !important;
	box-sizing: border-box !important;
	opacity: 1 !important;
	overflow: hidden !important;
}

.e-search-input-wrapper .e-font-icon-svg.e-fas-times:hover {
	background-color: #1e1c25 !important;
	color: #ffffff !important;
	fill: #ffffff !important;
}

/* Keep clear button always visible - no collapse/hidden state */
.e-search-input-wrapper .e-font-icon-svg.e-fas-times.hidden {
	width: 2.5rem !important;
	min-width: 2.5rem !important;
	opacity: 1 !important;
	pointer-events: auto !important;
}

/* Ensure inner SVG is properly sized (24x1.5rem icon in 2.5rem button) */
.e-search-input-wrapper .e-font-icon-svg.e-fas-times svg {
	width: 1.5rem !important;
	height: 1.5rem !important;
	display: block !important;
}

/* Ensure SVG path inherits color */
.e-search-input-wrapper .e-font-icon-svg.e-fas-times path,
.e-search-input-wrapper .e-font-icon-svg.e-fas-times svg path {
	fill: none !important;
	stroke: currentColor !important;
	stroke-width: 0.125rem !important;
}

/* ============================================
   Results Container
   ============================================ */

/* Hide results container from layout flow */
.e-search-results-container {
	position: absolute !important;
	top: 100% !important;
	left: 0 !important;
	right: 0 !important;
	z-index: 1000 !important;
	margin-top: 0.5rem !important;
}

/* ============================================
   Submit Button
   ============================================ */

.e-search-submit,
button.e-search-submit {
	background-color: #1e1c25 !important;
	border: 2px solid #1e1c25 !important;
	border-radius: 22.5rem !important;
	padding: 0.5rem 1rem 0.5rem 1rem !important;
	font-family: 'Afacad', sans-serif !important;
	font-weight: 700 !important;
	font-size: 1.125rem !important;
	line-height: 1.75rem !important;
	color: #ffffff !important;
	cursor: pointer !important;
	transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease !important;
	white-space: nowrap !important;
	flex-shrink: 0 !important;
	min-height: auto !important;
	height: auto !important;
	will-change: transform !important;
}

.e-search-submit:hover,
button.e-search-submit:hover {
	background-color: #0c28c4 !important;
	border:2px solid #0c28c4 !important;
	transform: translateY(-0.125rem) !important;
	box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15) !important;
}

.e-search-submit:active,
button.e-search-submit:active {
	background-color: #0c28c4 !important;
	border: 2px solid #0c28c4 !important;
	transform: translateY(0) !important;
	box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.1) !important;
}

/* ============================================
   Button Text Content Override
   ============================================ */

/* Hide original button text */
.e-search-submit span {
	font-size: 0 !important;
	line-height: 0 !important;
}

/* Replace with "Search again" text */
.e-search-submit span::after {
	content: 'Search' !important;
	font-family: 'Afacad', sans-serif !important;
	font-weight: 700 !important;
	font-size: 1.125rem !important;
	line-height: 1.75rem !important;
	color: #ffffff !important;
	white-space: nowrap !important;
}

/* Hide any icons in the button */
.e-search-submit i,
.e-search-submit svg {
	display: none !important;
}

/* ============================================
   Responsive Design - Tablet
   ============================================ */

@media (max-width: 64rem) {
	.e-search-form {
		gap: 0.5rem 1rem !important;
	}

	.e-search-input-wrapper {
		gap: 1rem !important; /* Tablet gap */
	}

	.e-search-input {
		font-size: 1rem !important;
		line-height: 1.5rem !important;
		width: 15.625rem !important;
	}

	.e-search-submit {
		font-size: 1rem !important;
		line-height: 1.5rem !important;
		padding: 0.5rem 1rem 0.5rem 0.625rem !important;
	}

	.e-search-submit span::after {
		font-size: 1rem !important;
		line-height: 1.5rem !important;
	}
}

/* ============================================
   Responsive Design - Mobile
   ============================================ */

@media (max-width: 47.9375rem) {
	.e-search-form {
		gap: 0.75rem !important;
		flex-direction: column !important;
		align-items: stretch !important;
	}

	.e-search-label {
		width: 100% !important;
	}

	.e-search-input-wrapper {
		width: 100% !important;
		gap: 0.75rem !important; /* Mobile gap */
	}

	.e-search-input-wrapper .e-font-icon-svg.e-fas-times {
		width: 2.25rem !important;
		height: 2.25rem !important;
		min-width: 2.25rem !important;
		min-height: 2.25rem !important;
		padding: 0.125rem !important;
	}

	.e-search-input-wrapper .e-font-icon-svg.e-fas-times.hidden {
		width: 2.25rem !important;
		min-width: 2.25rem !important;
		opacity: 1 !important;
	}

	.e-search-input-wrapper .e-font-icon-svg.e-fas-times svg {
		width: 1.25rem !important;
		height: 1.25rem !important;
	}

	.e-search-input {
		font-size: 1rem !important;
		line-height: 1.5rem !important;
		padding: 0.625rem 1rem !important;
		width: 100% !important;
		flex: 1 1 auto !important;
	}

	.e-search-submit {
		width: 100% !important;
		justify-content: center !important;
		font-size: 1rem !important;
		line-height: 1.5rem !important;
		padding: 0.625rem 1.5rem !important;
	}

	.e-search-submit span::after {
		font-size: 1rem !important;
		line-height: 1.5rem !important;
	}
}

/* ============================================
   High Specificity Overrides
   ============================================ */

/* Force styles if Elementor inline styles are too specific */
.elementor-widget-search .e-search-form {
	display: flex !important;
	flex-wrap: wrap !important;
	align-items: flex-end !important;
}

.elementor-widget-search .e-search-label {
	display: block !important;
	width: 100% !important;
	flex: 0 0 100% !important;
}

.elementor-widget-search .e-search-input-wrapper {
	display: flex !important;
	flex-wrap: nowrap !important;
	flex: 0 0 auto !important;
}

.elementor-widget-search .e-search-input {
	background-color: #ffffff !important;
	border: 1px solid #8a8797 !important;
	border-radius: 4px !important;
}

.elementor-widget-search .e-search-submit {
	background-color: #1e1c25 !important;
	border: 2px solid #1e1c25 !important;
	border-radius: 22.5rem !important;
	color: #ffffff !important;
	flex-shrink: 0 !important;
}

.elementor-widget-search .e-search-submit:hover {
	background-color: #0c28c4 !important;
	border-color: #0c28c4 !important;
}

