/*
 * search.css — Buscador avanzado v2.0
 * Prefijo: av-  |  Mobile-first  |  Breakpoints: 640 / 1024px
 * Compatible con OceanWP — sin clases genéricas
 */

/* ============================================================
   VARIABLES — scoped en .av-search para aislamiento total
============================================================ */
.av-search {
	--av-primary:     #E8652A;
	--av-primary-dk:  #C8501A;
	--av-primary-lt:  rgba(232, 101, 42, 0.10);
	--av-text:        #222222;
	--av-muted:       #717171;
	--av-border:      #DDDDDD;
	--av-bg:          #FFFFFF;
	--av-bg-alt:      #F7F7F7;
	--av-shadow-sm:   0 1px 4px rgba(0,0,0,.09);
	--av-shadow-md:   0 4px 20px rgba(0,0,0,.11);
	--av-shadow-lg:   0 8px 36px rgba(0,0,0,.15);
	--av-radius:      14px;
	--av-radius-sm:   8px;
	--av-radius-pill: 9999px;
	--av-font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--av-ease:        cubic-bezier(.4, 0, .2, 1);
	--av-dur:         180ms;

	font-family: var(--av-font);
	color: var(--av-text);
	margin: 0 0 48px;
}

/* ============================================================
   BARRA HORIZONTAL (mobile: stack vertical)
============================================================ */
.av-searchbar {
	display: flex;
	flex-direction: column;
	background: var(--av-bg);
	border: 1px solid var(--av-border);
	border-radius: var(--av-radius);
	box-shadow: var(--av-shadow-md);
	margin-bottom: 16px;
	overflow: visible;
}

.av-searchbar__field {
	position: relative;
	padding: 12px 16px;
	border-bottom: 1px solid var(--av-border);
}
.av-searchbar__field:last-child { border-bottom: none; }

.av-searchbar__label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--av-text);
	margin: 0 0 4px;
	line-height: 1;
}

/* ---- Input de texto ---- */
.av-searchbar__input-wrap {
	position: relative;
	display: flex;
	align-items: center;
}

.av-searchbar__input-icon {
	position: absolute;
	left: 0;
	color: var(--av-muted);
	pointer-events: none;
}

.av-searchbar__input {
	width: 100%;
	padding: 6px 28px 6px 24px;
	border: none;
	background: transparent;
	font-size: 15px;
	font-family: var(--av-font);
	color: var(--av-text);
	outline: none;
	-webkit-appearance: none;
}
.av-searchbar__input::placeholder { color: var(--av-muted); }

.av-searchbar__clear-text {
	position: absolute; right: 0;
	display: flex; align-items: center; justify-content: center;
	width: 22px; height: 22px;
	border: none; background: var(--av-border);
	border-radius: 50%;
	cursor: pointer; color: var(--av-text); padding: 0;
	transition: background var(--av-dur);
}
.av-searchbar__clear-text:hover { background: var(--av-primary); color: #fff; }

/* ---- Separadores (ocultos en móvil) ---- */
.av-searchbar__divider { display: none; }

/* ---- Botón buscar ---- */
.av-searchbar__btn {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	width: 100%;
	padding: 12px 20px;
	background: var(--av-primary);
	color: #fff;
	border: none;
	border-radius: var(--av-radius-sm);
	font-size: 15px; font-weight: 700; font-family: var(--av-font);
	cursor: pointer;
	transition: background var(--av-dur), transform 100ms;
}
.av-searchbar__btn:hover  { background: var(--av-primary-dk); }
.av-searchbar__btn:active { transform: scale(.98); }

/* ---- Fila de chips (debajo de la barra) ---- */
.av-search__chips-row {
	margin-bottom: 16px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}
.av-search__chips-row::-webkit-scrollbar { display: none; }

/* ============================================================
   SIDEBAR VERTICAL
============================================================ */
.av-sidebar-search__panel {
	background: var(--av-bg);
	border: 1px solid var(--av-border);
	border-radius: var(--av-radius);
	box-shadow: var(--av-shadow-sm);
	padding: 20px;
	margin-bottom: 20px;
}

.av-sidebar-search__title {
	font-size: 16px; font-weight: 700;
	color: var(--av-text);
	margin: 0 0 18px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--av-border);
}

.av-sb-field { margin-bottom: 14px; }

.av-sb-label {
	display: flex; align-items: center; gap: 6px;
	font-size: 12px; font-weight: 700;
	text-transform: uppercase; letter-spacing: .06em;
	color: var(--av-muted);
	margin-bottom: 6px;
}

/* Input sidebar */
.av-sb-input-wrap { position: relative; }

.av-sb-input {
	width: 100%;
	padding: 9px 30px 9px 12px;
	border: 1.5px solid var(--av-border);
	border-radius: var(--av-radius-sm);
	font-size: 14px; font-family: var(--av-font); color: var(--av-text);
	background: var(--av-bg);
	-webkit-appearance: none; appearance: none; outline: none;
	transition: border-color var(--av-dur), box-shadow var(--av-dur);
}
.av-sb-input::placeholder { color: var(--av-muted); }
.av-sb-input:focus { border-color: var(--av-primary); box-shadow: 0 0 0 3px var(--av-primary-lt); }

.av-sb-clear-text {
	position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
	border: none; background: none;
	font-size: 18px; color: var(--av-muted);
	cursor: pointer; padding: 0 2px; line-height: 1;
}
.av-sb-clear-text:hover { color: var(--av-primary); }

/* Select sidebar */
.av-sb-select-wrap { position: relative; }

.av-sb-select {
	width: 100%;
	padding: 9px 32px 9px 12px;
	border: 1.5px solid var(--av-border);
	border-radius: var(--av-radius-sm);
	font-size: 14px; font-family: var(--av-font); color: var(--av-text);
	background: var(--av-bg);
	-webkit-appearance: none; appearance: none; outline: none;
	cursor: pointer;
	transition: border-color var(--av-dur), box-shadow var(--av-dur);
}
.av-sb-select:focus { border-color: var(--av-primary); box-shadow: 0 0 0 3px var(--av-primary-lt); }

.av-sb-select-icon {
	position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
	pointer-events: none; color: var(--av-muted);
	display: flex;
}

/* Botón sidebar */
.av-sb-btn {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	width: 100%;
	padding: 11px 16px;
	background: var(--av-primary);
	color: #fff; border: none;
	border-radius: var(--av-radius-sm);
	font-size: 14px; font-weight: 700; font-family: var(--av-font);
	cursor: pointer;
	transition: background var(--av-dur), transform 100ms;
	margin-top: 4px;
}
.av-sb-btn:hover  { background: var(--av-primary-dk); }
.av-sb-btn:active { transform: scale(.98); }

/* Limpiar sidebar */
.av-sb-clear-all {
	display: block; width: 100%;
	border: none; background: none;
	font-family: var(--av-font); font-size: 13px; font-weight: 600;
	color: var(--av-muted); cursor: pointer;
	padding: 8px 0 0; text-align: center;
	text-decoration: underline; text-underline-offset: 2px;
	transition: color var(--av-dur);
}
.av-sb-clear-all:hover { color: var(--av-primary); }

/* ============================================================
   DROPDOWNS (compartidos)
============================================================ */
.av-filter { position: relative; }

.av-filter__trigger {
	display: inline-flex; align-items: center; gap: 7px;
	padding: 8px 14px;
	border: 1.5px solid var(--av-border);
	border-radius: var(--av-radius-pill);
	background: var(--av-bg);
	font-size: 14px; font-weight: 500; font-family: var(--av-font);
	color: var(--av-text); cursor: pointer; white-space: nowrap;
	transition: border-color var(--av-dur), background var(--av-dur), color var(--av-dur);
}
.av-filter__trigger:hover                       { border-color: var(--av-text); }
.av-filter__trigger.is-open                     { border-color: var(--av-text); }
.av-filter__trigger.has-value                   { background: var(--av-text); border-color: var(--av-text); color: #fff; }

/* Dentro de la searchbar: sin borde visible */
.av-searchbar .av-filter__trigger {
	border: none; padding: 4px 0;
	font-size: 15px; background: transparent; gap: 6px;
}
.av-searchbar .av-filter__trigger:hover,
.av-searchbar .av-filter__trigger.has-value { background: transparent; color: var(--av-text); border: none; }
.av-searchbar .av-filter__trigger.has-value { font-weight: 700; }

.av-filter__icon  { display: flex; align-items: center; opacity: .65; }

.av-filter__arrow {
	display: flex; align-items: center;
	transition: transform var(--av-dur) var(--av-ease);
}
.av-filter__trigger.is-open .av-filter__arrow { transform: rotate(180deg); }

/* Panel del dropdown */
.av-filter__dropdown {
	position: absolute; top: calc(100% + 8px); left: 0; z-index: 300;
	background: var(--av-bg);
	border: 1px solid var(--av-border);
	border-radius: var(--av-radius);
	box-shadow: var(--av-shadow-lg);
	min-width: 220px; max-width: 300px;
	opacity: 0; transform: translateY(-10px);
	transition: opacity var(--av-dur) var(--av-ease), transform var(--av-dur) var(--av-ease);
	pointer-events: none;
}
.av-filter__dropdown.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

.av-filter__dropdown-inner {
	padding: 6px; max-height: 300px;
	overflow-y: auto; scrollbar-width: thin;
}

.av-filter__option {
	display: block; width: 100%; text-align: left;
	padding: 9px 12px;
	border: none; background: transparent;
	font-size: 14px; font-family: var(--av-font); color: var(--av-text);
	cursor: pointer;
	border-radius: var(--av-radius-sm);
	transition: background var(--av-dur);
	line-height: 1.4;
}
.av-filter__option:hover    { background: var(--av-bg-alt); }
.av-filter__option.is-active { background: var(--av-primary); color: #fff; font-weight: 600; }

.av-filter__option--all {
	font-weight: 600;
	border-bottom: 1px solid var(--av-border);
	border-radius: 0; margin-bottom: 4px; padding-bottom: 12px;
}
.av-filter__group   { margin-bottom: 2px; }
.av-filter__option--parent {
	font-size: 11px; font-weight: 700;
	text-transform: uppercase; letter-spacing: .06em;
	color: var(--av-muted);
}
.av-filter__option--parent.is-active { color: #fff; }
.av-filter__children { padding-left: 6px; }
.av-filter__option--child { font-size: 14px; padding: 7px 12px; }

/* ============================================================
   CHIPS
============================================================ */
.av-chips { display: flex; flex-wrap: nowrap; gap: 8px; padding: 2px 0; }

.av-chip {
	padding: 7px 16px;
	border: 1.5px solid var(--av-border);
	border-radius: var(--av-radius-pill);
	background: var(--av-bg);
	font-size: 13px; font-weight: 500; font-family: var(--av-font);
	color: var(--av-text); cursor: pointer; white-space: nowrap; flex-shrink: 0;
	transition: border-color var(--av-dur), background var(--av-dur), color var(--av-dur), transform 80ms;
}
.av-chip:hover  { border-color: var(--av-text); }
.av-chip:active { transform: scale(.95); }
.av-chip.is-active { background: var(--av-primary); border-color: var(--av-primary); color: #fff; }

/* ============================================================
   FILTROS ACTIVOS
============================================================ */
.av-search__active-filters {
	display: flex; flex-wrap: wrap; align-items: center;
	gap: 8px; padding: 10px 0;
	border-top: 1px solid var(--av-border);
	margin-bottom: 16px;
}

.av-active-tags { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }

.av-active-tag {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 4px 10px 4px 12px;
	background: var(--av-bg-alt);
	border: 1px solid var(--av-border);
	border-radius: var(--av-radius-pill);
	font-size: 13px; font-weight: 500; color: var(--av-text);
	animation: av-tag-in var(--av-dur) var(--av-ease) both;
}
@keyframes av-tag-in { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: scale(1); } }

.av-active-tag__remove {
	display: flex; align-items: center; justify-content: center;
	width: 18px; height: 18px;
	border: none; background: var(--av-border);
	border-radius: 50%; font-size: 14px; cursor: pointer;
	color: var(--av-text); padding: 0; line-height: 1;
	transition: background var(--av-dur);
}
.av-active-tag__remove:hover { background: var(--av-primary); color: #fff; }

.av-btn-clear {
	border: none; background: none;
	font-family: var(--av-font); font-size: 13px; font-weight: 600;
	color: var(--av-muted); cursor: pointer; padding: 4px 0;
	text-decoration: underline; text-underline-offset: 2px;
	transition: color var(--av-dur); flex-shrink: 0;
}
.av-btn-clear:hover { color: var(--av-primary); }

/* ============================================================
   CONTADOR
============================================================ */
.av-search__meta  { min-height: 22px; margin-bottom: 14px; }
.av-search__count { font-size: 14px; color: var(--av-muted); font-weight: 500; }

/* ============================================================
   RESULTADOS
============================================================ */
.av-results { position: relative; min-height: 160px; }
.av-results__grid { transition: opacity var(--av-dur) var(--av-ease); }

/* ============================================================
   SKELETON
============================================================ */
.av-results__loading { display: grid; grid-template-columns: 1fr; gap: 20px; }

.av-skeleton-card {
	border-radius: var(--av-radius); overflow: hidden;
	background: var(--av-bg); box-shadow: var(--av-shadow-sm);
}
.av-skeleton-card__body { padding: 13px 15px 18px; }

.av-skeleton {
	background: linear-gradient(90deg, #ececec 25%, #f5f5f5 50%, #ececec 75%);
	background-size: 200% 100%;
	animation: av-shimmer 1.5s infinite; border-radius: 4px;
}
@keyframes av-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.av-skeleton--img   { width: 100%; aspect-ratio: 4/3; border-radius: 0; }
.av-skeleton--title { height: 15px; width: 68%; margin-bottom: 10px; }
.av-skeleton--text  { height: 12px; width: 42%; }

/* ============================================================
   VACÍO / ERROR
============================================================ */
.av-results__empty { display: flex; justify-content: center; padding: 48px 16px; }

.av-empty-state     { text-align: center; max-width: 300px; }
.av-empty-state__icon  { font-size: 44px; margin-bottom: 14px; display: block; }
.av-empty-state__title { font-size: 17px; font-weight: 700; color: var(--av-text); margin: 0 0 8px; }
.av-empty-state__text  { font-size: 14px; color: var(--av-muted); line-height: 1.6; margin: 0; }

.av-search__error {
	padding: 18px; text-align: center;
	color: #b91c1c; font-size: 14px;
	background: #fdf3f2; border-radius: var(--av-radius-sm);
}

/* ============================================================
   PAGINACIÓN AJAX
============================================================ */
.av-pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 6px;
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--av-border);
}

.av-page-btn {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 38px; height: 38px; padding: 0 12px;
	border: 1.5px solid var(--av-border);
	border-radius: var(--av-radius-sm);
	background: var(--av-bg);
	font-size: 14px; font-weight: 500; font-family: var(--av-font);
	color: var(--av-text); cursor: pointer;
	transition: border-color var(--av-dur), background var(--av-dur), color var(--av-dur);
}
.av-page-btn:hover        { border-color: var(--av-text); }
.av-page-btn.is-active    { background: var(--av-primary); border-color: var(--av-primary); color: #fff; cursor: default; }
.av-page-btn--prev,
.av-page-btn--next        { font-size: 13px; }

/* ============================================================
   RESPONSIVE — Tablet 640px
============================================================ */
@media (min-width: 640px) {
	.av-results__loading,
	.av-grid--cols-2,
	.av-grid--cols-3,
	.av-grid--cols-4 { grid-template-columns: repeat(2, 1fr); }

	.av-chips { flex-wrap: wrap; }
}

/* ============================================================
   RESPONSIVE — Desktop 1024px
============================================================ */
@media (min-width: 1024px) {

	/* Barra en fila */
	.av-searchbar {
		flex-direction: row; align-items: center;
		border-radius: var(--av-radius-pill);
		padding: 6px; overflow: visible;
	}
	.av-searchbar__field {
		flex: 1; padding: 8px 18px;
		border-bottom: none;
	}
	.av-searchbar__field--text { flex: 1.6; }
	.av-searchbar__field--btn  { flex: 0 0 auto; }

	.av-searchbar__divider {
		display: block; width: 1px; height: 32px;
		background: var(--av-border); flex-shrink: 0;
	}

	.av-searchbar__btn {
		border-radius: var(--av-radius-pill);
		padding: 13px 22px;
	}

	/* Grids */
	.av-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
	.av-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
	.av-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }

	.av-results__loading { grid-template-columns: repeat(3, 1fr); }

	/* Sidebar */
	.av-search--sidebar .av-grid--cols-1 { grid-template-columns: 1fr; }
	.av-search--sidebar .av-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   v3 ADDITIONS — al final de search.css
============================================================ */

/* ---- Estado IDLE (bienvenida antes de buscar) ---- */
.av-results__idle {
	display: flex;
	justify-content: center;
	padding: 56px 16px;
}
.av-results__idle .av-empty-state__icon { font-size: 48px; }

/* ---- Flatpickr fecha — campo en sidebar ---- */
.av-sb-field--fechas .av-sb-input {
	padding-right: 32px;
	cursor: pointer;
	background-color: var(--av-bg);
}

/* ---- Campo de fechas en barra HORIZONTAL ---- */
.av-searchbar__field--fechas {
	flex: 1.2;
	min-width: 160px;
}

.av-searchbar__field--fechas .av-searchbar__input {
	cursor: pointer;
	padding-right: 28px;
}

/* ---- BUSCADOR: mejorar contraste y legibilidad ---- */
.av-searchbar__label {
	font-size: 11px;
	font-weight: 800;
	color: #111;
	letter-spacing: .05em;
}

.av-searchbar__input {
	font-size: 15px;
	font-weight: 400;
	color: #111;
}

.av-searchbar__input::placeholder {
	color: #999;
	font-weight: 400;
}

/* Mayor padding interno en cada campo */
.av-searchbar__field {
	padding: 14px 18px;
}

/* ---- Sidebar: mejorar spacing y legibilidad ---- */
.av-sidebar-search__panel { padding: 24px; }

.av-sb-label {
	font-size: 11px;
	font-weight: 800;
	color: #444;
	letter-spacing: .06em;
	margin-bottom: 8px;
}

.av-sb-input,
.av-sb-select {
	font-size: 14px;
	color: #111;
	padding: 10px 32px 10px 14px;
	border-color: #ccc;
}

.av-sb-input:focus,
.av-sb-select:focus {
	border-color: var(--av-primary);
	box-shadow: 0 0 0 3px var(--av-primary-lt);
}

/* ---- Cards: separación clara entre estrellas y botón ---- */
.av-card__body {
	padding: 14px 16px 18px;
	display: flex;
	flex-direction: column;
	gap: 0;
}

.av-card__location { margin-bottom: 4px; }
.av-card__title    { margin-bottom: 4px; }
.av-card__stars    { margin-bottom: 6px; }
.av-card__excerpt  { margin-bottom: 8px; flex-grow: 1; }
.av-card__price    { margin-bottom: 10px; }
.av-card__btn      { margin-top: auto; display: block; }

/* ---- Paginación: espaciado mejorado ---- */
.av-pagination {
	gap: 8px;
	padding-top: 28px;
	margin-top: 36px;
}

.av-page-btn {
	min-width: 40px; height: 40px;
	font-size: 14px;
	border-radius: var(--av-radius-sm);
}
