/* Barra de herramientas debajo del header */
.toolbar-wrap {
  position: fixed;
  top: 60px; /* debajo del header fijo */
  left: 0;
  right: 0;
  z-index: 800;
  background: var(--toolbar-bg, #f9fafb);
  border-bottom: 1px solid var(--border);
}

/* Contenedor interno */
.tbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  padding: 8px 16px;
}

/* Breadcrumb (lado izquierdo) */
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted, #6b7280);
  min-width: 0;
  flex-shrink: 0;
}

/* Botón fijo: Collection / Corpus */
.crumb-link {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.crumb-link strong {
  font-weight: 600; /* negrita para Collection / Corpus seleccionados */
}

.crumb-sep {
  padding: 0 2px;
}

.crumb-link:hover {
  color: #000000;
  text-decoration: underline;
}

/* Selects level_3/4/5 dentro del breadcrumb */
.crumb-select {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--border, #e5e7eb);
  background: #ffffff;
  color: #111827;
  width: auto;
  min-width: 0;
  max-width: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.crumb-select:disabled {
  opacity: 0.6;
}

/* Loading estilo barra en los selects de breadcrumb */
select.crumb-select-loading {
  text-align: center;
  color: #ffffff; /* el JS ajusta según porcentaje, aquí reforzamos */
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

select.crumb-select-loading option {
  text-align: center;
}

/* Área de búsqueda (lado derecho) */
.search {
  flex: 1 1 0;
  display: flex;
  justify-content: flex-end;
}

/* Wrapper interno para poder colocar la lupa dentro del input */
.search-inner {
  position: relative;
  width: 100%;
  max-width: 100%;
}

/* Campo de búsqueda */
#tbar-search {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border, #d1d5db);
  padding: 8px 32px 8px 12px;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted, #6b7280);
  background: color-mix(in srgb, var(--accent) 5%, var(--bg));
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

#tbar-search::placeholder {
  color: var(--muted, #6b7280);
}

#tbar-search:focus-visible {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 1px var(--accent, #2563eb);
}

/* Icono de lupa al final del campo */
.search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: #000000;
}

.search-icon .icon-search {
  width: 16px;
  height: 16px;
}

/* Layout responsive: en mobile el buscador va debajo del breadcrumb */
@media (max-width: 768px) {
  /* En pantallas tipo celular: primera línea breadcrumbs, segunda línea buscador */
  .tbar {
    padding: 4px 8px;
    gap: 4px 8px;       /* fila x columna */
    flex-wrap: wrap;    /* permitimos varias líneas */
    align-items: flex-start;
  }

  .crumbs {
    font-size: 0.8rem;
    flex: 0 0 100%;     /* ocupa toda la primera línea */
    min-width: 0;
    order: 0;
    overflow-x: auto;   /* si hay muchos niveles, que scrollee horizontal */
  }

  .crumb-select {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
  }

  .search {
    flex: 0 0 100%;     /* buscador a lo ancho en segunda línea */
    order: 1;
    justify-content: flex-start;
  }

  .search-inner {
    width: 100%;
    max-width: none;
  }

  #tbar-search {
    width: 100%;
    max-width: 100%;
  }
}


/* Cuando el usuario escribe, el texto del buscador se ve como los dropdowns (bold y mismo tamaño) */
#tbar-search:not(:placeholder-shown) {
  font-weight: 600;
  color: #111827; /* mismo tono que los dropdowns */
}
