* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
}

form[id^="views-exposed-form-filtro-profesores-home-block-"] {
  max-width: 345px;
  margin: 0 auto;
}

select.form-select.views-ajax-trigger {
  border: none !important;
  box-shadow: 0 4px 15px 0 #0000001a !important;
}

select {
  width: 100%;
  height: 45px;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #282425;
  background-color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}

select:focus {
  outline: none;
}

select#keyword-select,
select#area-select,
select#idioma-select,
select#nivel-select,
select#disponibilidad-select,
select#hablante-select,
select#precio-select,
::picker(select) {
  appearance: base-select;
  border: none;
  box-shadow: 0 4px 15px 0 #0000001a;
}

::picker(select#precio-select) {
  display: flex;
  flex-direction: row;
}

select#area-select,
select#idioma-select,
select#nivel-select,
select#disponibilidad-select,
select#hablante-select,
select#precio-select,
::picker(select) {
  margin-top: 10px;
}

select#keyword-select::picker-icon {
  display: none;
}

select#area-select::picker-icon,
select#idioma-select::picker-icon,
select#nivel-select::picker-icon,
select#disponibilidad-select::picker-icon,
select#hablante-select::picker-icon,
select#precio-select::picker-icon {
  color: #ff6a2d;
}

select#keyword-select > option,
select#area-select > option,
select#idioma-select > option,
select#nivel-select > option,
select#disponibilidad-select > option,
select#hablante-select > option,
select#precio-select > option {
  padding: 16px 12px;
  background-color: #eeeeee;
}

select#keyword-select > option:hover,
select#area-select > option:hover,
select#idioma-select > option:hover,
select#nivel-select > option:hover,
select#disponibilidad-select > option:hover,
select#hablante-select > option:hover,
select#precio-select > option:hover {
  background-color: #ff6a2d;
  transition: background-color 300ms ease-out;
}

select#keyword-select > option::checkmark,
select#idioma-select > option::checkmark,
select#nivel-select > option::checkmark,
select#disponibilidad-select > option::checkmark,
select#hablante-select > option::checkmark,
select#precio-select > option::checkmark {
  display: none;
}

/* Primera sección */

.filter-container {
  background-color: #f2f9f9;
  border-radius: 8px;
  padding: 24px;
}

.filter-title {
  font-size: 32px;
  font-weight: 700;
  color: #282425;
  margin-bottom: 16px;
}

.filter-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.select-wrapper {
  flex: 1;
  position: relative;
}

/* Icono de busqueda */

.select-with-icon {
  position: relative;
}

.select-with-icon .select-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  pointer-events: none;
  z-index: 1;
}

.select-with-icon select {
  padding-left: 48px;
}

/* CSS particular de las opciones del select */

select#keyword-select:invalid {
  color: #9b9b9b;
}

.filter-button {
  padding: 12px 24px;
  background-color: #ffffff;
  color: #282425;
  border: none;
  border-radius: 4px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap;
  box-shadow: 0 4px 15px 0 #0000001a;
}

/* Segunda sección */

.filter-panel {
  display: none;
  background-color: #f2f9f9;
  border-radius: 8px;
  padding: 20px;
  margin-top: 16px;
}

.filter-panel.active {
  display: block;
}

.filter-group {
  margin-bottom: 16px;
}

.filter-group:last-of-type {
  margin-bottom: 0;
}

/* Selector especial area */

.custom-multiselect-wrapper {
  position: relative;
}

.custom-multiselect {
  position: relative;
  width: 100%;
}

.multiselect-trigger {
  width: 100%;
  height: 45px;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  background-color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 15px 0 #0000001a;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.multiselect-trigger .arrow {
  position: absolute;
  right: 16px;
  font-size: 10px;
  color: #ff6a2d;
  transition: transform 300ms ease-out;
}

.multiselect-options {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background-color: #eeeeee;
  box-shadow: 0 4px 15px 0 #0000001a;
  z-index: 100;
  max-height: 250px;
  overflow-y: auto;
}

.custom-multiselect.open .multiselect-options {
  display: block;
}

.multiselect-option {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #282425;
  cursor: pointer;
  transition: background-color 300ms ease-out;
}

.multiselect-option:last-child {
  margin-bottom: 0;
}

.multiselect-option:hover {
  background-color: #ff6a2d;
}

.multiselect-option input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  margin-right: 12px;
  cursor: pointer;
  border: 2px solid #1d1d1b;
  border-radius: 3px;
  background-color: transparent;
  position: relative;
  transition: all 300ms ease-out;
}

/* Cuando está checked */
.multiselect-option input[type="checkbox"]:checked {
  border-color: #ff6a2d;
  background-color: transparent;
}

/* Crear el checkmark (✓) cuando está checked */
.multiselect-option input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  color: #ff6a2d;
  font-size: 14px;
  font-weight: bold;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Cuando el label tiene hover */
.multiselect-option:hover input[type="checkbox"] {
  border-color: #1d1d1b; /* Mantener el color original cuando NO está checked */
}

/* Cuando el label tiene hover Y el checkbox está checked */
.multiselect-option:hover input[type="checkbox"]:checked {
  border-color: #ffffff;
}

/* Cuando el label tiene hover y el checkbox está checked */
.multiselect-option:hover input[type="checkbox"]:checked::after {
  color: #ffffff;
}

.multiselect-option span {
  flex: 1;
}

.price-range {
  display: flex;
  gap: 12px;
}

.price-input {
  flex: 1;
}

div.form-actions-wrapper {
  height: 45px;
}

.search-button {
  width: 100%;
  padding: 16px;
  background-color: #282425;
  color: #ebf2f2;
  border: none;
  border-radius: 4px;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
  border: 1px solid #282425;
}

.search-button:hover {
  transition: background-color 300ms ease-out;
  background-color: transparent;
  color: #282425;
}

/* Media queries */

@media (min-width: 768px) {
  form[id^="views-exposed-form-filtro-profesores-home-block-"] {
    max-width: 1240px;
  }

  /* Ocultar el botón de filtros en desktop */
  .filter-button {
    display: none;
  }

  .filter-container {
    border-end-start-radius: 0;
    border-end-end-radius: 0;
  }

  /* Mostrar el panel de filtros siempre visible */
  .filter-panel {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 24px 12px;
    margin-top: 0;
    background-color: #f2f9f9;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
  }

  /* Todos los filter-group en una fila */
  .filter-group {
    flex: 1;
    margin-bottom: 0;
    height: 45px;
  }

  /* El botón de búsqueda al final de la fila */
  .search-button {
    flex-shrink: 0;
    width: 148px;
    padding: 16px;
    margin-top: 0;
    height: 45px;
  }

  /* Ajustar multiselect para desktop */
  #idioma-select {
    width: 109px;
  }

  #nivel-select {
    width: 97px;
  }

  #disponibilidad-select {
    width: 158px;
  }

  #hablante-select {
    width: 176px;
  }

  #precio-select {
    width: 172px;
  }

  /* Eliminar margen top de los selects en desktop */
  select#area-select,
  select#idioma-select,
  select#nivel-select,
  select#disponibilidad-select,
  select#hablante-select,
  select#precio-select {
    margin-top: 0;
  }
}

@media (min-width: 1248px) {
  .filter-panel {
    justify-content: space-between;
    margin-bottom: 50px;
  }
}
