/**
 * Search Icon Widget Styles
 *
 * Styles for the Elementor Search Icon Widget and overlay
 *
 * @package    Alselec_Core
 * @subpackage Alselec_Core/public/css
 * @since      1.0.0
 */

/* Search Icon Button */
.alselec-search-icon-wrapper {
	display: inline-block;
}

.alselec-search-icon {
	background: none !important;
	border: none !important;
	cursor: pointer;
	padding: 0;
	margin: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	outline: none;
}

.alselec-search-icon:hover {
	background: none !important;
	border: none !important;
}

.alselec-search-icon:focus {
	outline: none !important;
	background: none !important;
	border: none !important;
}

.alselec-search-icon:active {
	background: none !important;
	border: none !important;
}

.alselec-search-icon svg {
	width: 22px;
	height: 22px;
	display: block;
	fill: currentColor;
}

.alselec-search-icon svg path {
	fill: currentColor;
	stroke: none;
	stroke-width: 0;
}

/* Search Overlay */
.alselec-search-overlay,
#alselec-search-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 90px;
	background-color: #ffffff !important;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
}

/* Desktop: Altura fija de 275px y fondo gris */
@media (min-width: 769px) {
	.alselec-search-overlay,
	#alselec-search-overlay {
		height: 275px;
		top: 0;
		align-items: center;
		background-color: rgb(242, 242, 242) !important;
	}
}

.alselec-search-overlay.alselec-search-overlay-open {
	display: flex;
}

.alselec-search-overlay-content {
	position: relative;
	width: 100%;
	padding: 0 20px;
	animation: alselecSearchSlideIn 0.3s ease;
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100%;
}

@media (min-width: 769px) {
	.alselec-search-overlay-content {
		padding: 0;
		position: relative;
		height: 100%;
	}
}

@keyframes alselecSearchSlideIn {
	from {
		opacity: 0;
		transform: translateY(-30px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Search Container */
.alselec-search-container {
	position: relative;
	width: 100%;
}

/* Desktop: Contenedor de 868px */
@media (min-width: 769px) {
	.alselec-search-container {
		width: 868px;
		margin: 0 auto;
		position: relative;
		height: 100%;
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
		padding-bottom: 78px;
		z-index: 1;
	}

	.alselec-search-form {
		position: relative;
		z-index: 1;
		margin-bottom: 0;
		width: 100%;
	}
}

/* Close Button */
.alselec-search-close {
	position: absolute;
	top: 20px;
	right: 20px;
	background: none !important;
	border: none !important;
	color: #1a1a1a;
	cursor: pointer;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 1;
	z-index: 100;
	visibility: visible;
}

@media (min-width: 769px) {
	.alselec-search-overlay-content {
		position: relative;
		overflow: visible;
	}
	
	.alselec-search-close {
		position: absolute;
		top: 55px;
		right: 70px;
		z-index: 1000000;
		visibility: visible;
	}
}

.alselec-search-close svg {
	width: 19.085px;
	height: 18.627px;
	display: block;
}

.alselec-search-close:hover {
	opacity: 1;
	background: none !important;
	border: none !important;
}

.alselec-search-close:focus {
	outline: none !important;
	background: none !important;
	border: none !important;
}

.alselec-search-close:active {
	background: none !important;
	border: none !important;
}

/* Search Form */
.alselec-search-form {
	display: flex;
	align-items: center;
	position: relative;
	width: 100%;
}

/* Search Input Wrapper */
.alselec-search-input-wrapper {
	display: flex;
	align-items: stretch;
	width: 100%;
	border: 1px solid #999999;
	padding: 0;
}

@media (min-width: 769px) {
	.alselec-search-input-wrapper {
		width: 868px;
		border: none;
		border-bottom: 1px solid #999999;
		padding-bottom: 15px;
		align-items: center;
	}
}

.alselec-search-input,
input[type="search"].alselec-search-input {
	flex: 1;
	border: none !important;
	border-width: 0 !important;
	border-radius: 0 !important;
	outline: none;
	box-shadow: none !important;
	padding: 0 !important;
	margin: 0 !important;
	font-size: 24px;
	background-color: transparent;
	color: #1a1a1a;
	font-family: inherit;
	font-weight: 300;
	width: 100%;
	transition: all .3s;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

/* Ocultar botón de limpiar en inputs de tipo search */
.alselec-search-input::-webkit-search-cancel-button,
input[type="search"].alselec-search-input::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
	display: none;
}

.alselec-search-input::-webkit-search-decoration,
input[type="search"].alselec-search-input::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
}

.alselec-search-input::-moz-search-clear-button,
input[type="search"].alselec-search-input::-moz-search-clear-button {
	display: none;
}

.alselec-search-input:focus,
input[type="search"].alselec-search-input:focus {
	border: none !important;
	border-width: 0 !important;
	border-radius: 0 !important;
	outline: none;
	box-shadow: none !important;
	padding: 0 !important;
}

.alselec-search-input::placeholder {
	color: rgb(155, 152, 152);
	font-family: RedHatText, sans-serif;
	font-size: 30px;
	font-weight: normal;
	font-stretch: normal;
	font-style: normal;
	line-height: 1.33;
	letter-spacing: normal;
	text-align: left;
}

.alselec-search-button {
	border: none !important;
	background: none !important;
	background-color: transparent !important;
	color: #1a1a1a;
	padding: 0;
	cursor: pointer;
	font-size: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	flex-shrink: 0;
	margin-left: auto;
}

.alselec-search-button:hover {
	color: #000000;
	background: none !important;
	background-color: transparent !important;
	border: none !important;
}

.alselec-search-button:focus {
	outline: none !important;
	background: none !important;
	background-color: transparent !important;
	border: none !important;
}

.alselec-search-button:active {
	background: none !important;
	background-color: transparent !important;
	border: none !important;
}

.alselec-search-button svg {
	width: 30px;
	height: 30px;
	flex-shrink: 0;
}

.alselec-search-button svg path {
	fill: currentColor;
	stroke: none;
	stroke-width: 0;
}

.alselec-search-button i {
	font-size: 28px;
	flex-shrink: 0;
}

.alselec-search-button-text {
	display: none;
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
	.alselec-search-overlay-content {
		padding: 0 20px;
		height: 100%;
	}

	.alselec-search-container {
		width: 100%;
		height: auto;
		padding-bottom: 0;
		display: flex;
		align-items: center;
	}

	/* Ocultar botón de cerrar en mobile - se cierra tocando fuera */
	.alselec-search-close {
		display: none;
	}

	/* Mobile input wrapper - full border */
	.alselec-search-input-wrapper {
		border: 1px solid #999999;
		padding: 0;
		align-items: stretch;
	}

	.alselec-search-input,
	input[type="search"].alselec-search-input {
		font-size: 16px;
		padding: 0 24px !important;
		height: 50px !important;
		font-family: RedHatText, sans-serif;
		font-weight: normal;
		line-height: 50px;
		text-indent: 0 !important;
		-webkit-padding-start: 24px !important;
		padding-inline-start: 24px !important;
		box-sizing: border-box;
	}

	.alselec-search-input:focus,
	input[type="search"].alselec-search-input:focus {
		padding: 0 24px !important;
		height: 50px !important;
		text-indent: 0 !important;
		-webkit-padding-start: 24px !important;
		padding-inline-start: 24px !important;
	}

	.alselec-search-input::placeholder {
		font-family: RedHatText, sans-serif;
		font-size: 16px;
		font-weight: normal;
		font-style: normal;
		line-height: 1.38;
		letter-spacing: normal;
		text-align: left;
		color: #9b9898;
	}

	/* Mobile button - blue background 50x50 with white icon */
	.alselec-search-button {
		width: 50px;
		height: 50px;
		min-width: 50px;
		min-height: 50px;
		background-color: #032ca6 !important;
		background: #032ca6 !important;
		color: #ffffff;
		border: none !important;
		border-radius: 0 !important;
		margin-left: 0;
		flex-shrink: 0;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.alselec-search-button:hover,
	.alselec-search-button:focus,
	.alselec-search-button:active {
		background-color: #032ca6 !important;
		background: #032ca6 !important;
		color: #ffffff;
	}

	.alselec-search-button svg {
		width: 20px;
		height: 20px;
	}

	.alselec-search-button svg path {
		fill: #ffffff;
	}

	.alselec-search-button i {
		font-size: 20px;
		color: #ffffff;
	}

	.alselec-search-form {
		gap: 0;
		padding-bottom: 0;
		width: 100%;
	}
}

@media (max-width: 480px) {
	.alselec-search-overlay-content {
		padding: 0 15px;
	}
}

/* Accessibility */
.alselec-search-overlay *:focus {
	outline-offset: 2px;
}

/* Loading State (optional) */
.alselec-search-form.is-loading .alselec-search-button {
	opacity: 0.7;
	cursor: wait;
}

/* Animation for overlay closing */
@keyframes alselecSearchSlideOut {
	from {
		opacity: 1;
		transform: translateY(0);
	}
	to {
		opacity: 0;
		transform: translateY(-30px);
	}
}

/* RTL Support */
[dir="rtl"] .alselec-search-close {
	right: auto;
	left: 0;
}

[dir="rtl"] .alselec-search-button {
	flex-direction: row-reverse;
}

/* Hide search icon when overlay is open (mobile) */
.alselec-search-icon-wrapper.alselec-search-hidden {
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
}

/* Transform hamburger menu to X when overlay is open (mobile) */
@media (max-width: 768px) {
	.elementor-menu-toggle.alselec-search-overlay-active .elementor-menu-toggle__icon--open,
	.elementor-menu-toggle.alselec-search-overlay-active .eicon-menu-bar {
		display: none !important;
	}

	.elementor-menu-toggle.alselec-search-overlay-active .elementor-menu-toggle__icon--close,
	.elementor-menu-toggle.alselec-search-overlay-active .eicon-close {
		display: block !important;
	}

	/* If using custom hamburger icon, transform to X */
	.elementor-menu-toggle.alselec-search-overlay-active {
		position: relative;
	}

	.elementor-menu-toggle.alselec-search-overlay-active::before,
	.elementor-menu-toggle.alselec-search-overlay-active::after {
		content: '';
		position: absolute;
		width: 20.5px;
		height: 2px;
		background-color: #000000;
		top: 50%;
		left: 50%;
	}

	.elementor-menu-toggle.alselec-search-overlay-active::before {
		transform: translate(-50%, -50%) rotate(45deg);
	}

	.elementor-menu-toggle.alselec-search-overlay-active::after {
		transform: translate(-50%, -50%) rotate(-45deg);
	}

	/* Hide the original hamburger lines when showing X */
	.elementor-menu-toggle.alselec-search-overlay-active i,
	.elementor-menu-toggle.alselec-search-overlay-active svg {
		opacity: 0;
	}
}
