/**
 * Estilos compartidos .buscador-* (venta, widget Cloudbeds, etc.).
 */

.wp-block-nerjavillas-buscador-venta,
.mwm-buscador-cloudbeds {
	display: block;
	width: 100%;
}

.buscador-form {
	display: flex;
	gap: 24px;
	align-items: stretch;
	width: 100%;
}

/* --- Field base --- */

.buscador-field {
	flex: 1;
	/* Figma: 62px alto total (py 8 + 2 filas + gap 6, borde incluido en box) */
	height: 62px;
	max-height: 62px;
	padding: 8px 12px;
	box-sizing: border-box;
	border: 1px solid var(--wp--preset--color--accent);
	border-radius: 6px;
	background: transparent;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: stretch;
	gap: 0;
	color: var(--wp--preset--color--tertiary);
	position: relative;
}

/* Figma: columna con dos filas (icono+label · hueco+valor), gap 6px */
.buscador-field__main {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: center;
	flex: 1 1 auto;
	/* 20 + 4 + 20 + 16 (padding) + 2 (borde) = 62px total */
	gap: 4px;
	min-width: 0;
	width: 100%;
	min-height: 0;
	max-height: 100%;
}

.buscador-field__row {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 8px;
	width: 100%;
	min-width: 0;
	flex: 0 0 auto;
	height: 20px;
	min-height: 20px;
	max-height: 20px;
}

.buscador-field__icon-spacer {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	pointer-events: none;
}

.buscador-field__icon-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	color: var(--wp--preset--color--tertiary);
}

.buscador-field__icon {
	flex-shrink: 0;
	display: block;
	color: inherit;
}

.buscador-field__label {
	flex: 1 1 auto;
	min-width: 0;
	font-family: var(--wp--preset--font-family--body);
	font-size: 16px;
	font-weight: 400;
	color: var(--wp--preset--color--tertiary);
	line-height: 1;
	margin: 0;
}

.buscador-field__row > .buscador-field__value {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
}

/* --- Date field --- */

.buscador-field--date {
	cursor: pointer;
}

.buscador-field--date .buscador-field__main {
	pointer-events: none;
	position: relative;
	z-index: 1;
}

.buscador-date-input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	background: none;
	border: none;
	outline: none;
	color: transparent;
	font-size: 0;
	padding: 0;
	cursor: pointer;
	z-index: 2;
}

.buscador-field--date .buscador-field__value {
	font-family: var(--wp--preset--font-family--body);
	font-size: 16px;
	font-weight: 300;
	line-height: 1;
	color: var(--wp--preset--color--tertiary);
	pointer-events: none;
	position: relative;
	z-index: 1;
}

/* --- Guests field (Figma: texto a la izquierda, +/- apilados a la derecha) --- */

.buscador-field--guests {
	justify-content: center;
}

.buscador-field__guests-inner {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	gap: 12px;
	min-width: 0;
	flex: 1;
}

.buscador-field--guests .buscador-field__main {
	flex: 1 1 auto;
	min-width: 0;
	justify-content: center;
}

.buscador-field--guests .buscador-field__label {
	white-space: nowrap;
}

.buscador-guests__controls {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	flex-shrink: 0;
}

.buscador-guests__btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	color: var(--wp--preset--color--accent);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

.buscador-guests__input {
	background: none;
	border: none;
	outline: none;
	color: var(--wp--preset--color--tertiary);
	font-family: var(--wp--preset--font-family--body);
	font-size: 16px;
	font-weight: 400;
	line-height: 1;
	min-width: 1ch;
	width: auto;
	max-width: 100%;
	text-align: left;
	padding: 0;
	flex: 1 1 auto;
	min-height: 0;
	-moz-appearance: textfield;
}

.buscador-guests__input::-webkit-inner-spin-button,
.buscador-guests__input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* --- Accommodation field --- */

.buscador-field--accommodation {
	cursor: pointer;
}

.buscador-field--accommodation .buscador-field__main {
	pointer-events: none;
	position: relative;
	z-index: 1;
}

.buscador-field--accommodation .buscador-field__value {
	display: block;
	font-family: var(--wp--preset--font-family--body);
	font-size: 16px;
	line-height: 1;
	font-weight: 300;
	color: var(--wp--preset--color--tertiary);
	pointer-events: none;
	position: relative;
	z-index: 1;
}

.buscador-select {
	position: static;
	display: contents;
}

.buscador-select__trigger {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	z-index: 2;
	color: transparent;
	font-size: 0;
}

.buscador-select__dropdown {
	position: absolute;
	bottom: calc(100% + 16px);
	left: -12px;
	right: -12px;
	background: var(--wp--preset--color--tertiary);
	border-radius: 6px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
	list-style: none;
	margin: 0;
	padding: 8px 0;
	z-index: 50;
	max-height: 240px;
	overflow-y: auto;
}

.buscador-select__option {
	padding: 10px 16px;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--normal);
	font-weight: 400;
	color: var(--wp--preset--color--corporativo-01);
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.buscador-select__option:hover {
	background-color: rgba(0, 0, 0, 0.05);
}

.buscador-select__option.is-selected {
	color: var(--wp--preset--color--accent);
}

/* --- Search button with animation --- */

.buscador-submit {
	flex-shrink: 0;
	align-self: stretch;
	width: 62px;
	height: 62px;
	max-height: 62px;
	min-height: 62px;
	box-sizing: border-box;
	background-color: var(--wp--preset--color--accent);
	border: none;
	border-radius: 6px;
	cursor: pointer;
	position: relative;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.buscador-submit__shadow {
	position: absolute;
	left: 0;
	top: 0;
	width: 0;
	height: 100%;
	background-color: var(--wp--preset--color--tertiary);
	border-radius: 6px;
	transition: width 0.4s ease;
	z-index: 1;
}

.buscador-submit:hover .buscador-submit__shadow {
	width: 100%;
}

.buscador-submit__link {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
}

.buscador-submit__icons {
	width: 20px;
	height: 20px;
	overflow: hidden;
}

.buscador-submit__icons svg {
	display: block;
	width: 20px;
	height: 20px;
	transition: transform 0.4s ease;
}

.buscador-submit__icons svg:first-child {
	color: var(--wp--preset--color--tertiary);
}

.buscador-submit__icons svg:last-child {
	color: var(--wp--preset--color--corporativo-01);
}

.buscador-submit:hover .buscador-submit__icons svg {
	transform: translateY(-20px);
}

/* --- Flatpickr theme overrides --- */

.flatpickr-calendar {
	font-family: var(--wp--preset--font-family--body);
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
	border: none;
}

.flatpickr-months .flatpickr-month {
	background: var(--wp--preset--color--corporativo-01);
	color: var(--wp--preset--color--tertiary);
	border-radius: 12px 12px 0 0;
}

.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
	color: var(--wp--preset--color--tertiary);
	font-weight: 500;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
	fill: var(--wp--preset--color--tertiary);
	color: var(--wp--preset--color--tertiary);
}

span.flatpickr-weekday {
	color: var(--wp--preset--color--corporativo-01);
	font-weight: 500;
}

.flatpickr-day {
	border-radius: 6px;
	color: var(--wp--preset--color--corporativo-01);
}

.flatpickr-day:hover {
	background: var(--wp--preset--color--tertiary);
	border-color: var(--wp--preset--color--secondary);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
	background: var(--wp--preset--color--accent);
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--tertiary);
}

.flatpickr-day.inRange {
	background: rgba(227, 104, 43, 0.15);
	border-color: transparent;
	box-shadow: -5px 0 0 rgba(227, 104, 43, 0.15), 5px 0 0 rgba(227, 104, 43, 0.15);
}

/* --- Responsive --- */

@media (max-width: 782px) {
	.buscador-form {
		flex-direction: column;
		gap: 12px;
	}

	.buscador-field {
		width: 100%;
		height: auto;
		min-height: 62px;
		max-height: none;
	}

	.buscador-submit {
		width: 100%;
		min-height: 52px;
		height: 52px;
		align-self: stretch;
	}

	.buscador-select__dropdown {
		left: 0;
		right: 0;
	}
}
