/**
 * Estilo del sidebar de listados: navegación (modelo A) + facetas (modelo B).
 * Aplica a /trabajo (vista anuncios_busqueda).
 */

:root {
  --ln-blue: #013e5e;      /* azul oscuro corporativo */
  --ln-blue-2: #00659b;    /* primario del sitio (enlaces/activo) */
  --ln-ink: #1e293b;
  --ln-muted: #64748b;
  --ln-line: #e6eef8;      /* borde de tarjeta del sitio */
  --ln-bg: #e3f2fd;        /* hover azul claro del sitio */
  --ln-pill: #f0f6ff;      /* fondo de pill/tag del sitio */
  --ln-radius: 10px;
}

/* ── Ocultar el filtro expuesto crudo de Views (la búsqueda vive en el header) ── */
.view-anuncios-busqueda .views-exposed-form {
  display: none;
}

/* ── Título de la página (full-width, en la región header) + subtítulo conteo ── */
[role="heading"] .trabajando-page-header,
.region-header .trabajando-page-header {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.2;
  color: #0f2942;
  margin: 12px 0 8px;
}
.view-anuncios-busqueda .view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 15px;
  font-weight: 600;
  color: var(--ln-muted);
  margin: 2px 0 22px;
}
.listado-intro {
  max-width: 820px;
  margin: 4px 0 22px;
  color: #475569;
  font-size: 15px;
  line-height: 1.6;
}

/* Controles del listado: orden + (filtros en móvil). */
.view-anuncios-busqueda .view-header .lo-count { white-space: nowrap; }
.lo-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lo-orden {
  display: flex;
  align-items: center;
  gap: 7px;
}
.lo-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ln-muted);
}
.lo-select {
  appearance: none;
  -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300659b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 9px center/12px no-repeat;
  border: 1px solid var(--ln-line);
  border-radius: 9px;
  padding: 8px 30px 8px 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ln-blue-2);
  cursor: pointer;
  transition: border-color .15s;
}
.lo-select:hover { border-color: var(--ln-blue-2); }
@media (max-width: 560px) {
  .lo-label { display: none; }
}

/* ── Sidebar sticky inteligente (sticky-bottom) ──
 * Cuando los filtros superan el alto del viewport, el `top` del sticky se ajusta
 * por JS (listado-facets.js, behavior listadoStickySidebar): se vuelve negativo
 * para que el sidebar acompañe el scroll y revele las facetas inferiores, y al
 * llegar a su base se pega. Si caben en pantalla, sticky normal arriba (top:20px
 * del tema). En móvil el sidebar es un drawer (no aplica). */

/* ── Paneles del sidebar (nav y facetas comparten contenedor de tarjeta) ── */
#block-listadonav,
.region-sidebar-first .block-facets {
  background: #fff;
  border: 1px solid var(--ln-line);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 20px;
}

/* Encabezados de sección */
#block-listadonav h3,
.region-sidebar-first .block-facets h2,
.region-sidebar-first .block-facets > h3 {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ln-muted);
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ln-line);
}
/* Segundo bloque de nav (Categorías dentro del mismo panel) */
#block-listadonav h3 + ul + h3 {
  margin-top: 22px;
}

#block-listadonav ul,
.region-sidebar-first .block-facets ul.js-facets-checkbox-links,
.region-sidebar-first .block-facets ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── NAVEGACIÓN (modelo A): enlaces con conteo en pill + chevron ── */
.ln-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--ln-ink);
  text-decoration: none;
  font-size: 14px;
  transition: background .12s, color .12s;
}
.ln-link:hover {
  background: var(--ln-bg);
  color: var(--ln-blue-2);
}
.ln-name {
  flex: 1 1 auto;
  min-width: 0;
}
.ln-count {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--ln-blue-2);
  background: var(--ln-pill);
  border: 1px solid var(--ln-line);
  border-radius: 999px;
  padding: 0 8px;
  line-height: 18px;
}
.ln-link::after {
  content: "›";
  flex: 0 0 auto;
  color: #94a3b8;
  font-size: 1.1rem;
  line-height: 1;
}
.ln-link:hover::after { color: var(--ln-blue-2); }

/* "Ver más / menos" del nav (soft-limit por JS) */
.ln-more {
  display: inline-block;
  margin: 8px 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ln-blue-2);
  text-decoration: none;
  cursor: pointer;
}
.ln-more:hover { text-decoration: underline; }

/* Entrada destacada "Trabajo remoto" al inicio del nav de ciudades. */
.ln-remoto {
  font-weight: 600;
  color: var(--ln-blue-2);
  margin-bottom: 6px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--ln-line);
}
.ln-remoto .ln-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ln-remoto .ln-name::before {
  content: "";
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300659b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18'/%3E%3Cpath d='M12 3a14 14 0 0 1 0 18 14 14 0 0 1 0-18'/%3E%3C/svg%3E") center/contain no-repeat;
}
.ln-remoto:hover { background: var(--ln-bg); }

/* ── FILTROS (modelo B): facetas (widget links) con checkbox dibujado por CSS ──
 * Markup simple <a><span value><span count></a> → misma fuente que el nav. */
.region-sidebar-first .block-facets .facet-item {
  margin: 0;
  padding: 0;
}
.region-sidebar-first .block-facets .facet-item > a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--ln-ink);
  font-size: 14px;
}
.region-sidebar-first .block-facets .facet-item > a:hover {
  background: var(--ln-bg);
  color: var(--ln-blue-2);
}
/* Caja del checkbox dibujada (el widget links no inyecta input). */
.region-sidebar-first .block-facets .facet-item > a::before {
  content: "";
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 1.5px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  transition: background .12s, border-color .12s;
}
.region-sidebar-first .block-facets .facet-item > a.is-active::before {
  border-color: var(--ln-blue-2);
  background: var(--ln-blue-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M6.4 11.6 3 8.2l1.2-1.2 2.2 2.2 5.2-5.2L13 5.2z'/%3E%3C/svg%3E") center/12px no-repeat;
}
.facet-item__value {
  flex: 1 1 auto;
  min-width: 0;
}
.facet-item__count {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--ln-blue-2);
  background: var(--ln-pill);
  border: 1px solid var(--ln-line);
  border-radius: 999px;
  padding: 0 8px;
  line-height: 18px;
}

/* Soft-limit "Mostrar más / menos" */
.region-sidebar-first .block-facets .facets-soft-limit-link {
  display: inline-block;
  margin: 8px 0 0 8px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ln-blue-2);
  cursor: pointer;
  text-decoration: none;
}

/* ── Chips de filtros activos (bloque custom FiltrosActivosBlock) ── */
.filtros-activos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 2px 0 20px;
}
.filtros-activos .fa-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--ln-pill);
  color: var(--ln-blue-2);
  border: 1px solid var(--ln-line);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background .12s, border-color .12s;
}
.filtros-activos .fa-chip::after {
  content: "✕";
  font-size: 11px;
  line-height: 1;
  color: var(--ln-muted);
}
.filtros-activos .fa-chip:hover {
  background: var(--ln-bg);
  border-color: var(--ln-blue-2);
}
.filtros-activos .fa-chip:hover::after { color: var(--ln-blue-2); }
.filtros-activos .fa-reset {
  margin-left: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ln-muted);
  text-decoration: none;
}
.filtros-activos .fa-reset:hover { color: var(--ln-blue-2); text-decoration: underline; }

/* ── Enlaces internos al pie del listado (SEO cross-linking) ── */
.enlaces-populares {
  background: #fff;
  border: 1px solid var(--ln-line);
  border-radius: 14px;
  padding: 26px 28px;
  margin: 32px 0 14px;
}
.enl-group { margin-bottom: 26px; }
.enl-group:last-child { margin-bottom: 0; }
.enl-group h3 {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ln-muted);
  margin: 0 0 16px;
}
.enl-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 13px 24px;
}
.enl-group ul li { margin: 0; }
.enl-group ul a {
  color: var(--ln-blue-2);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
}
.enl-group ul a:hover { text-decoration: underline; }

/* ── Mobile: sidebar como drawer tras un botón "Filtros" ── */
.listado-filtros-toggle { display: none; }
/* La cabecera azul del drawer (inyectada por JS) solo existe en móvil. */
aside.col-sm-3.px-1.sticky-sidebar .offcanvas-header { display: none; }

@media (max-width: 768px) {
  .listado-filtros-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: var(--ln-blue-2);
    border: 1px solid var(--ln-line);
    border-radius: 10px;
    padding: 9px 16px;
    font-weight: 600;
    font-size: 14px;
    margin: 0;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
    transition: border-color .15s, box-shadow .15s;
  }
  .listado-filtros-toggle:hover {
    border-color: var(--ln-blue-2);
    box-shadow: 0 2px 8px rgba(0, 101, 155, .1);
  }
  .listado-filtros-toggle svg { flex: 0 0 auto; }
  /* El tema oculta el aside en móvil (display:none); lo convertimos en drawer
   * off-canvas con el MISMO estilo que los demás drawers del sitio (offcanvas). */
  aside.col-sm-3.px-1.sticky-sidebar {
    display: block !important;
    position: fixed;
    inset: 0 0 0 auto;
    width: 320px;
    max-width: 86%;
    margin: 0;
    background: #fff;
    z-index: 2000;
    padding: 0;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  body.listado-filtros-open aside.col-sm-3.px-1.sticky-sidebar {
    transform: translateX(0);
  }
  body.listado-filtros-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 1999;
  }
  /* Cabecera azul (inyectada por JS) pegada al tope del drawer. */
  aside.col-sm-3.px-1.sticky-sidebar .offcanvas-header {
    display: flex;
    position: sticky;
    top: 0;
  }
  /* Contenido (paneles) bajo la cabecera. */
  aside.col-sm-3.px-1.sticky-sidebar .region-sidebar-first {
    padding: 16px 14px 28px;
  }
}
